use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.
the class SpawnedServerSupport method createSharedFolderConfig.
static Configuration createSharedFolderConfig(String folder, int thisport, int otherport, boolean isBackup) {
HAPolicyConfiguration haPolicyConfiguration = null;
if (isBackup) {
haPolicyConfiguration = new SharedStoreSlavePolicyConfiguration();
((SharedStoreSlavePolicyConfiguration) haPolicyConfiguration).setAllowFailBack(false);
} else {
haPolicyConfiguration = new SharedStoreMasterPolicyConfiguration();
}
Configuration config = createConfig(folder).clearAcceptorConfigurations().setJournalFileSize(15 * 1024 * 1024).addAcceptorConfiguration(createTransportConfigiguration(true, thisport)).addConnectorConfiguration("thisServer", createTransportConfigiguration(false, thisport)).addConnectorConfiguration("otherServer", createTransportConfigiguration(false, otherport)).setMessageExpiryScanPeriod(500).addClusterConfiguration(isBackup ? setupClusterConn("thisServer", "otherServer") : setupClusterConn("thisServer")).setHAPolicyConfiguration(haPolicyConfiguration);
return config;
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.
the class FailoverTestBase method createConfigs.
protected void createConfigs() throws Exception {
nodeManager = createNodeManager();
TransportConfiguration liveConnector = getConnectorTransportConfiguration(true);
TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
backupConfig = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(false)).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()).addConnectorConfiguration(liveConnector.getName(), liveConnector).addConnectorConfiguration(backupConnector.getName(), backupConnector).addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName()));
backupServer = createTestableServer(backupConfig);
liveConfig = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true)).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName())).addConnectorConfiguration(liveConnector.getName(), liveConnector);
liveServer = createTestableServer(liveConfig);
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.
the class LiveToLiveFailoverTest method createConfigs.
@Override
protected void createConfigs() throws Exception {
nodeManager0 = new InVMNodeManager(false);
nodeManager1 = new InVMNodeManager(false);
TransportConfiguration liveConnector0 = getConnectorTransportConfiguration(true, 0);
TransportConfiguration liveConnector1 = getConnectorTransportConfiguration(true, 1);
backupConfig = super.createDefaultInVMConfig(1).clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true, 1)).setHAPolicyConfiguration(new ColocatedPolicyConfiguration().setRequestBackup(true).setLiveConfig(new SharedStoreMasterPolicyConfiguration()).setBackupConfig(new SharedStoreSlavePolicyConfiguration().setScaleDownConfiguration(new ScaleDownConfiguration().addConnector(liveConnector1.getName())))).addConnectorConfiguration(liveConnector0.getName(), liveConnector0).addConnectorConfiguration(liveConnector1.getName(), liveConnector1).addClusterConfiguration(basicClusterConnectionConfig(liveConnector1.getName(), liveConnector0.getName()));
backupServer = createColocatedTestableServer(backupConfig, nodeManager1, nodeManager0, 1);
liveConfig = super.createDefaultInVMConfig(0).clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true, 0)).setHAPolicyConfiguration(new ColocatedPolicyConfiguration().setRequestBackup(true).setBackupRequestRetryInterval(1000).setLiveConfig(new SharedStoreMasterPolicyConfiguration()).setBackupConfig(new SharedStoreSlavePolicyConfiguration().setScaleDownConfiguration(new ScaleDownConfiguration()))).addConnectorConfiguration(liveConnector0.getName(), liveConnector0).addConnectorConfiguration(liveConnector1.getName(), liveConnector1).addClusterConfiguration(basicClusterConnectionConfig(liveConnector0.getName(), liveConnector1.getName()));
liveServer = createColocatedTestableServer(liveConfig, nodeManager0, nodeManager1, 0);
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.
the class MultiServerTestBase method setupLiveServer.
protected Pair<ActiveMQServer, NodeManager> setupLiveServer(final int node, final boolean realFiles, final boolean sharedStorage) throws Exception {
NodeManager nodeManager = null;
TransportConfiguration serverConfigAcceptor = createTransportConfiguration(useNetty(), true, generateParams(node, useNetty()));
TransportConfiguration thisConnector = createTransportConfiguration(useNetty(), false, generateParams(node, useNetty()));
if (sharedStorage) {
nodeManager = new InVMNodeManager(false);
}
Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).setThreadPoolMaxSize(10).clearAcceptorConfigurations().addAcceptorConfiguration(serverConfigAcceptor).addConnectorConfiguration("thisConnector", thisConnector).setHAPolicyConfiguration(sharedStorage ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration());
List<String> targetServersOnConnection = new ArrayList<>();
for (int targetNode = 0; targetNode < getNumberOfServers(); targetNode++) {
if (targetNode == node) {
continue;
}
String targetConnectorName = "target-" + targetNode;
TransportConfiguration targetServer = createTransportConfiguration(useNetty(), false, generateParams(targetNode, useNetty()));
configuration.getConnectorConfigurations().put(targetConnectorName, targetServer);
targetServersOnConnection.add(targetConnectorName);
// The connector towards a backup.. just to have a reference so bridges can connect to backups on their configs
String backupConnectorName = "backup-" + targetNode;
TransportConfiguration backupConnector = createTransportConfiguration(useNetty(), false, generateParams(targetNode + getNumberOfServers(), useNetty()));
configuration.getConnectorConfigurations().put(backupConnectorName, backupConnector);
}
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration().setName("localCluster" + node).setAddress("cluster-queues").setConnectorName("thisConnector").setRetryInterval(100).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(targetServersOnConnection);
configuration.getClusterConfigurations().add(clusterConf);
ActiveMQServer server;
if (sharedStorage) {
server = createInVMFailoverServer(realFiles, configuration, nodeManager, node);
} else {
server = createServer(realFiles, configuration);
}
server.setIdentity(this.getClass().getSimpleName() + "/Live(" + node + ")");
addServer(server);
return new Pair<>(server, nodeManager);
}
use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration 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;
}
Aggregations