Search in sources :

Example 11 with SharedStoreMasterPolicyConfiguration

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;
}
Also used : HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)

Example 12 with SharedStoreMasterPolicyConfiguration

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);
}
Also used : SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 13 with SharedStoreMasterPolicyConfiguration

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);
}
Also used : InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) ScaleDownConfiguration(org.apache.activemq.artemis.core.config.ScaleDownConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 14 with SharedStoreMasterPolicyConfiguration

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);
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) Configuration(org.apache.activemq.artemis.core.config.Configuration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ArrayList(java.util.ArrayList) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) NodeManager(org.apache.activemq.artemis.core.server.NodeManager) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) Pair(org.apache.activemq.artemis.api.core.Pair)

Example 15 with SharedStoreMasterPolicyConfiguration

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;
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) CoreQueueConfiguration(org.apache.activemq.artemis.core.config.CoreQueueConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ScaleDownConfiguration(org.apache.activemq.artemis.core.config.ScaleDownConfiguration) ArrayList(java.util.ArrayList) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) CoreQueueConfiguration(org.apache.activemq.artemis.core.config.CoreQueueConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ScaleDownConfiguration(org.apache.activemq.artemis.core.config.ScaleDownConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)

Aggregations

SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)27 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)21 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)20 Configuration (org.apache.activemq.artemis.core.config.Configuration)16 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)9 InVMNodeManager (org.apache.activemq.artemis.core.server.impl.InVMNodeManager)9 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)8 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)7 ArrayList (java.util.ArrayList)6 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)6 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)5 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)5 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)4 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)4 ScaleDownConfiguration (org.apache.activemq.artemis.core.config.ScaleDownConfiguration)3 ColocatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration)3 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)3 NodeManager (org.apache.activemq.artemis.core.server.NodeManager)3