use of org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration in project activemq-artemis by apache.
the class SharedStoreBackupTest method createConfigs.
@Override
protected void createConfigs() throws Exception {
nodeManager = new InVMNodeManager(false);
TransportConfiguration liveConnector = getConnectorTransportConfiguration(true);
TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
System.out.println("backup config created - mnovak");
backupConfig = super.createDefaultConfig(false).clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(false)).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration().setScaleDownConfiguration(new ScaleDownConfiguration().setEnabled(false)).setRestartBackup(false)).addConnectorConfiguration(liveConnector.getName(), liveConnector).addConnectorConfiguration(backupConnector.getName(), backupConnector).addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName()));
backupServer = createTestableServer(backupConfig);
liveConfig = super.createDefaultConfig(false).clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true)).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration().setFailoverOnServerShutdown(true)).addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName())).addConnectorConfiguration(liveConnector.getName(), liveConnector);
liveServer = createTestableServer(liveConfig);
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration in project activemq-artemis by apache.
the class HAAutomaticBackupSharedStoreTest method setUpHAPolicy.
private void setUpHAPolicy(int node) {
ActiveMQServer server = getServer(node);
ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration();
HAPolicyConfiguration liveConfiguration = new SharedStoreMasterPolicyConfiguration();
haPolicyConfiguration.setLiveConfig(liveConfiguration);
HAPolicyConfiguration backupConfiguration = new SharedStoreSlavePolicyConfiguration();
haPolicyConfiguration.setBackupConfig(backupConfiguration);
server.getConfiguration().setHAPolicyConfiguration(haPolicyConfiguration);
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration in project activemq-artemis by apache.
the class BridgeTestBase method createBackupActiveMQServer.
protected ActiveMQServer createBackupActiveMQServer(final int id, final Map<String, Object> params, final boolean netty, final int liveId, final NodeManager nodeManager) throws Exception {
TransportConfiguration tc = new TransportConfiguration();
if (netty) {
params.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + id);
tc = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params);
} else {
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, id);
tc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params);
}
Configuration serviceConf = createBasicConfig().setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir(liveId, false)).setJournalMinFiles(2).setJournalDirectory(getJournalDir(liveId, false)).setPagingDirectory(getPageDir(liveId, false)).setLargeMessagesDirectory(getLargeMessagesDir(liveId, false)).setJournalFileSize(100 * 1024).addAcceptorConfiguration(tc).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration());
ActiveMQServer server;
if (nodeManager == null) {
server = ActiveMQServers.newActiveMQServer(serviceConf, true);
} else {
server = new InVMNodeManagerServer(serviceConf, nodeManager);
}
return addServer(server);
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration in project activemq-artemis by apache.
the class JMSFailoverListenerTest method startServers.
/**
* @throws Exception
*/
protected void startServers() throws Exception {
NodeManager nodeManager = new InVMNodeManager(false);
backuptc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, backupParams);
livetc = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
liveAcceptortc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
backupAcceptortc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams);
backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
backupConf = createBasicConfig().addAcceptorConfiguration(backupAcceptortc).addConnectorConfiguration(livetc.getName(), livetc).addConnectorConfiguration(backuptc.getName(), backuptc).setJournalType(getDefaultJournalType()).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams)).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), livetc.getName()));
backupServer = addServer(new InVMNodeManagerServer(backupConf, nodeManager));
backupJMSServer = new JMSServerManagerImpl(backupServer);
backupJMSServer.setRegistry(new JndiBindingRegistry(ctx2));
backupJMSServer.getActiveMQServer().setIdentity("JMSBackup");
log.info("Starting backup");
backupJMSServer.start();
liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName()));
liveServer = addServer(new InVMNodeManagerServer(liveConf, nodeManager));
liveJMSServer = new JMSServerManagerImpl(liveServer);
liveJMSServer.setRegistry(new JndiBindingRegistry(ctx1));
liveJMSServer.getActiveMQServer().setIdentity("JMSLive");
log.info("Starting life");
liveJMSServer.start();
JMSUtil.waitForServer(backupServer);
}
Aggregations