use of org.apache.activemq.artemis.core.config.ScaleDownConfiguration in project activemq-artemis by apache.
the class AutomaticColocatedQuorumVoteTest method getConfiguration.
private Configuration getConfiguration(String identity, boolean scaleDown, TransportConfiguration liveConnector, TransportConfiguration liveAcceptor, TransportConfiguration... otherLiveNodes) throws Exception {
Configuration configuration = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(liveAcceptor).addConnectorConfiguration(liveConnector.getName(), liveConnector).setJournalDirectory(getJournalDir() + identity).setBindingsDirectory(getBindingsDir() + identity).setLargeMessagesDirectory(getLargeMessagesDir() + identity).setPagingDirectory(getPageDir() + identity).addQueueConfiguration(new CoreQueueConfiguration().setAddress("testQueue").setName("testQueue"));
List<String> transportConfigurationList = new ArrayList<>();
final ColocatedPolicyConfiguration haPolicy = new ColocatedPolicyConfiguration();
for (TransportConfiguration otherLiveNode : otherLiveNodes) {
configuration.addConnectorConfiguration(otherLiveNode.getName(), otherLiveNode);
transportConfigurationList.add(otherLiveNode.getName());
haPolicy.getExcludedConnectors().add(otherLiveNode.getName());
}
String[] input = new String[transportConfigurationList.size()];
transportConfigurationList.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), input));
haPolicy.setBackupPortOffset(100);
haPolicy.setBackupRequestRetries(-1);
haPolicy.setBackupRequestRetryInterval(500);
haPolicy.setMaxBackups(1);
haPolicy.setRequestBackup(true);
configuration.setHAPolicyConfiguration(haPolicy);
if (!replicated) {
SharedStoreMasterPolicyConfiguration ssmc = new SharedStoreMasterPolicyConfiguration();
SharedStoreSlavePolicyConfiguration sssc = new SharedStoreSlavePolicyConfiguration();
haPolicy.setLiveConfig(ssmc);
haPolicy.setBackupConfig(sssc);
if (scaleDown) {
sssc.setScaleDownConfiguration(new ScaleDownConfiguration());
}
} else {
ReplicatedPolicyConfiguration rpc = new ReplicatedPolicyConfiguration();
ReplicaPolicyConfiguration rpc2 = new ReplicaPolicyConfiguration();
haPolicy.setLiveConfig(rpc);
haPolicy.setBackupConfig(rpc2);
if (scaleDown) {
rpc2.setScaleDownConfiguration(new ScaleDownConfiguration());
}
}
return configuration;
}
use of org.apache.activemq.artemis.core.config.ScaleDownConfiguration 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.ScaleDownConfiguration in project activemq-artemis by apache.
the class ScaleDown3NodeTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
setupLiveServer(0, isFileStorage(), false, isNetty(), true);
servers[0].getConfiguration().setSecurityEnabled(true);
setupLiveServer(1, isFileStorage(), false, isNetty(), true);
servers[1].getConfiguration().setSecurityEnabled(true);
setupLiveServer(2, isFileStorage(), false, isNetty(), true);
servers[2].getConfiguration().setSecurityEnabled(true);
LiveOnlyPolicyConfiguration haPolicyConfiguration0 = (LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration();
ScaleDownConfiguration scaleDownConfiguration0 = new ScaleDownConfiguration();
haPolicyConfiguration0.setScaleDownConfiguration(scaleDownConfiguration0);
LiveOnlyPolicyConfiguration haPolicyConfiguration1 = (LiveOnlyPolicyConfiguration) servers[1].getConfiguration().getHAPolicyConfiguration();
ScaleDownConfiguration scaleDownConfiguration1 = new ScaleDownConfiguration();
haPolicyConfiguration1.setScaleDownConfiguration(scaleDownConfiguration1);
scaleDownConfiguration0.setGroupName("bill");
scaleDownConfiguration1.setGroupName("bill");
scaleDownConfiguration1.setEnabled(false);
setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
String scaleDownConnector = servers[0].getConfiguration().getClusterConfigurations().get(0).getStaticConnectors().get(0);
Assert.assertEquals(61617, servers[0].getConfiguration().getConnectorConfigurations().get(scaleDownConnector).getParams().get(TransportConstants.PORT_PROP_NAME));
scaleDownConfiguration0.getConnectors().add(scaleDownConnector);
startServers(0, 1, 2);
setupSessionFactory(0, isNetty(), false, servers[0].getConfiguration().getClusterUser(), servers[0].getConfiguration().getClusterPassword());
setupSessionFactory(1, isNetty(), false, servers[1].getConfiguration().getClusterUser(), servers[1].getConfiguration().getClusterPassword());
setupSessionFactory(2, isNetty(), false, servers[2].getConfiguration().getClusterUser(), servers[2].getConfiguration().getClusterPassword());
IntegrationTestLogger.LOGGER.info("===============================");
IntegrationTestLogger.LOGGER.info("Node 0: " + servers[0].getClusterManager().getNodeId());
IntegrationTestLogger.LOGGER.info("Node 1: " + servers[1].getClusterManager().getNodeId());
IntegrationTestLogger.LOGGER.info("Node 2: " + servers[2].getClusterManager().getNodeId());
IntegrationTestLogger.LOGGER.info("===============================");
}
use of org.apache.activemq.artemis.core.config.ScaleDownConfiguration in project activemq-artemis by apache.
the class ScaleDownTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
setupLiveServer(0, isFileStorage(), isNetty(), true);
setupLiveServer(1, isFileStorage(), isNetty(), true);
LiveOnlyPolicyConfiguration haPolicyConfiguration0 = (LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration();
haPolicyConfiguration0.setScaleDownConfiguration(new ScaleDownConfiguration());
LiveOnlyPolicyConfiguration haPolicyConfiguration1 = (LiveOnlyPolicyConfiguration) servers[1].getConfiguration().getHAPolicyConfiguration();
haPolicyConfiguration1.setScaleDownConfiguration(new ScaleDownConfiguration());
if (useScaleDownGroupName) {
haPolicyConfiguration0.getScaleDownConfiguration().setGroupName("bill");
haPolicyConfiguration1.getScaleDownConfiguration().setGroupName("bill");
}
setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
haPolicyConfiguration0.getScaleDownConfiguration().getConnectors().addAll(servers[0].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
haPolicyConfiguration1.getScaleDownConfiguration().getConnectors().addAll(servers[1].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
servers[0].getConfiguration().getAddressesSettings().put("#", new AddressSettings().setRedistributionDelay(0));
servers[1].getConfiguration().getAddressesSettings().put("#", new AddressSettings().setRedistributionDelay(0));
startServers(0, 1);
setupSessionFactory(0, isNetty());
setupSessionFactory(1, isNetty());
}
Aggregations