Search in sources :

Example 16 with SharedStoreMasterPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.

the class MultipleServerFailoverTestBase method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    liveServers = new ArrayList<>();
    backupServers = new ArrayList<>();
    backupConfigs = new ArrayList<>();
    liveConfigs = new ArrayList<>();
    for (int i = 0; i < getLiveServerCount(); i++) {
        HAPolicyConfiguration haPolicyConfiguration = null;
        if (isSharedStore()) {
            haPolicyConfiguration = new SharedStoreMasterPolicyConfiguration();
        } else {
            haPolicyConfiguration = new ReplicatedPolicyConfiguration();
            if (getNodeGroupName() != null) {
                ((ReplicatedPolicyConfiguration) haPolicyConfiguration).setGroupName(getNodeGroupName() + "-" + i);
            }
        }
        Configuration configuration = createDefaultConfig(isNetty()).clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true, i)).setHAPolicyConfiguration(haPolicyConfiguration);
        if (!isSharedStore()) {
            configuration.setBindingsDirectory(getBindingsDir(i, false));
            configuration.setJournalDirectory(getJournalDir(i, false));
            configuration.setPagingDirectory(getPageDir(i, false));
            configuration.setLargeMessagesDirectory(getLargeMessagesDir(i, false));
        } else {
        // todo
        }
        TransportConfiguration livetc = getConnectorTransportConfiguration(true, i);
        configuration.addConnectorConfiguration(livetc.getName(), livetc);
        List<String> connectors = new ArrayList<>();
        for (int j = 0; j < getLiveServerCount(); j++) {
            if (j != i) {
                TransportConfiguration staticTc = getConnectorTransportConfiguration(true, j);
                configuration.getConnectorConfigurations().put(staticTc.getName(), staticTc);
                connectors.add(staticTc.getName());
            }
        }
        String[] input = new String[connectors.size()];
        connectors.toArray(input);
        configuration.addClusterConfiguration(basicClusterConnectionConfig(livetc.getName(), input));
        liveConfigs.add(configuration);
        ActiveMQServer server = createServer(true, configuration);
        TestableServer activeMQServer = new SameProcessActiveMQServer(server);
        activeMQServer.setIdentity("Live-" + i);
        liveServers.add(activeMQServer);
    }
    for (int i = 0; i < getBackupServerCount(); i++) {
        HAPolicyConfiguration haPolicyConfiguration = null;
        if (isSharedStore()) {
            haPolicyConfiguration = new SharedStoreSlavePolicyConfiguration();
        } else {
            haPolicyConfiguration = new ReplicaPolicyConfiguration();
            if (getNodeGroupName() != null) {
                ((ReplicaPolicyConfiguration) haPolicyConfiguration).setGroupName(getNodeGroupName() + "-" + i);
            }
        }
        Configuration configuration = createDefaultConfig(isNetty()).clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(false, i)).setHAPolicyConfiguration(haPolicyConfiguration);
        if (!isSharedStore()) {
            configuration.setBindingsDirectory(getBindingsDir(i, true));
            configuration.setJournalDirectory(getJournalDir(i, true));
            configuration.setPagingDirectory(getPageDir(i, true));
            configuration.setLargeMessagesDirectory(getLargeMessagesDir(i, true));
        } else {
        // todo
        }
        TransportConfiguration backuptc = getConnectorTransportConfiguration(false, i);
        configuration.addConnectorConfiguration(backuptc.getName(), backuptc);
        List<String> connectors = new ArrayList<>();
        for (int j = 0; j < getBackupServerCount(); j++) {
            TransportConfiguration staticTc = getConnectorTransportConfiguration(true, j);
            configuration.addConnectorConfiguration(staticTc.getName(), staticTc);
            connectors.add(staticTc.getName());
        }
        for (int j = 0; j < getBackupServerCount(); j++) {
            if (j != i) {
                TransportConfiguration staticTc = getConnectorTransportConfiguration(false, j);
                configuration.getConnectorConfigurations().put(staticTc.getName(), staticTc);
                connectors.add(staticTc.getName());
            }
        }
        String[] input = new String[connectors.size()];
        connectors.toArray(input);
        configuration.addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), input));
        backupConfigs.add(configuration);
        ActiveMQServer server = createServer(true, configuration);
        TestableServer testableServer = new SameProcessActiveMQServer(server);
        testableServer.setIdentity("Backup-" + i);
        backupServers.add(testableServer);
    }
}
Also used : 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) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ArrayList(java.util.ArrayList) TestableServer(org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) 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) Before(org.junit.Before)

Example 17 with SharedStoreMasterPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.

the class FailoverListenerTest method createConfigs.

@Override
protected void createConfigs() throws Exception {
    nodeManager = new InVMNodeManager(false);
    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(), backupConnector.getName())).addConnectorConfiguration(liveConnector.getName(), liveConnector).addConnectorConfiguration(backupConnector.getName(), backupConnector);
    liveServer = createTestableServer(liveConfig);
}
Also used : InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) 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 18 with SharedStoreMasterPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration 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);
}
Also used : InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) ScaleDownConfiguration(org.apache.activemq.artemis.core.config.ScaleDownConfiguration) 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 19 with SharedStoreMasterPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration in project activemq-artemis by apache.

the class SingleLiveMultipleBackupsFailoverTest method createLiveConfig.

protected void createLiveConfig(int liveNode) throws Exception {
    TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(liveNode, isNetty()));
    Configuration config0 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(liveNode, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName())).addConnectorConfiguration(liveConnector.getName(), liveConnector).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode);
    SameProcessActiveMQServer server = new SameProcessActiveMQServer(createInVMFailoverServer(true, config0, nodeManager, liveNode));
    addActiveMQComponent(server);
    servers.put(liveNode, server);
}
Also used : 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) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 20 with SharedStoreMasterPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration 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);
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) 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)

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