activemq-artemis

How to make ActiveMQ Artemis master/slave work with shared storage, ensuring the slave takes control when the master goes down?


I have 2 servers. I installed ActiveMQ Artemis 2.28.0 master/slave with shared storage.

The console is working on both and sending a message work with the master, but if the master goes down the slave server doesn't go live.

Master Broker :

      <connectors>
         <!-- Connector used to be announced through cluster connections and notifications -->
         <connector name="artemis">tcp://master:61616</connector>
         <connector name="artemis1">tcp://slave:61616</connector>
      </connectors>

      <broadcast-groups>
         <broadcast-group name="bg-group1">
            <group-address>231.7.7.7</group-address>
            <group-port>9876</group-port>
            <broadcast-period>5000</broadcast-period>
            <connector-ref>artemis</connector-ref>
         </broadcast-group>
      </broadcast-groups>

      <discovery-groups>
         <discovery-group name="dg-group1">
            <group-address>231.7.7.7</group-address>
            <group-port>9876</group-port>
            <refresh-timeout>10000</refresh-timeout>
         </discovery-group>
      </discovery-groups>

      <cluster-connections>
         <cluster-connection name="my-cluster">
            <connector-ref>artemis</connector-ref>
            <!-- <message-load-balancing>ON_DEMAND</message-load-balancing>
            <max-hops>0</max-hops>-->
            <static-connectors>
               <connector-ref>artemis1</connector-ref>
            </static-connectors>
            <!--<discovery-group-ref discovery-group-name="dg-group1"/>-->
         </cluster-connection>
      </cluster-connections>

      <ha-policy>
         <shared-store>
            <master>
               <failover-on-shutdown>true</failover-on-shutdown>
            </master>
         </shared-store>
      </ha-policy>

Slave Broker:

      <connectors>
         <!-- Connector used to be announced through cluster connections and notifications -->
         <connector name="artemis">tcp://slave:61616</connector>
         <connector name="artemis1">tcp://master:61616</connector>
      </connectors>


      <broadcast-groups>
         <broadcast-group name="bg-group1">
            <group-address>231.7.7.7</group-address>
            <group-port>9876</group-port>
            <broadcast-period>5000</broadcast-period>
            <connector-ref>artemis</connector-ref>
         </broadcast-group>
      </broadcast-groups>

      <discovery-groups>
         <discovery-group name="dg-group1">
            <group-address>231.7.7.7</group-address>
            <group-port>9876</group-port>
            <refresh-timeout>10000</refresh-timeout>
         </discovery-group>
      </discovery-groups>

      <cluster-connections>
         <cluster-connection name="my-cluster">
            <connector-ref>artemis</connector-ref>
            <!--<message-load-balancing>ON_DEMAND</message-load-balancing>
            <max-hops>0</max-hops>-->
            <static-connectors>
               <connector-ref>artemis1</connector-ref>
            </static-connectors>
            <!-- <discovery-group-ref discovery-group-name="dg-group1"/> -->
         </cluster-connection>
      </cluster-connections>

      <ha-policy>
         <shared-store>
            <slave>
               <allow-failback>true</allow-failback>
            </slave>
         </shared-store>
      </ha-policy>

When the Master go down its look in Log Slave server that its detected but the Slave didn't go Live.

Log in Slave Broker if Master is down:

23-05-30 15:31:30,986 INFO  [org.apache.activemq.artemis] AMQ241003: Starting embedded web server
2023-05-30 15:31:30,990 INFO  [org.apache.activemq.artemis.core.server] AMQ221032: Waiting to become backup node
2023-05-30 15:31:30,990 INFO  [org.apache.activemq.artemis.core.server] AMQ221033: ** got backup lock
2023-05-30 15:31:31,092 INFO  [org.apache.activemq.artemis.core.server] AMQ221012: Using AIO Journal
2023-05-30 15:31:31,300 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1073741824
2023-05-30 15:31:31,545 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2023-05-30 15:31:31,546 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2023-05-30 15:31:31,546 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2023-05-30 15:31:31,547 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2023-05-30 15:31:31,547 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2023-05-30 15:31:31,547 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2023-05-30 15:31:31,725 INFO  [org.apache.activemq.artemis.core.server] AMQ221051: Populating security roles from LDAP at: ldap://domain:389
2023-05-30 15:31:31,933 INFO  [org.apache.activemq.artemis.core.server] AMQ221109: Apache ActiveMQ Artemis Backup Server version 2.28.0 [4047124e-fbe7-11ed-8354-005056a768c0] started, waiting live to fail before it gets active
2023-05-30 15:31:32,104 INFO  [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2023-05-30 15:31:32,202 INFO  [org.apache.activemq.artemis.core.server] AMQ221031: backup announced
2023-05-30 15:31:32,230 INFO  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
23-05-30 15:31:32,104 INFO  [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2023-05-30 15:31:32,202 INFO  [org.apache.activemq.artemis.core.server] AMQ221031: backup announced
2023-05-30 15:31:32,230 INFO  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2023-05-30 15:31:32,543 INFO  [io.hawt.HawtioContextListener] Initialising hawtio services
2023-05-30 15:31:32,555 INFO  [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2023-05-30 15:31:32,557 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to Hawtio 2.15.0
2023-05-30 15:31:32,572 INFO  [io.hawt.web.auth.AuthenticationConfiguration] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq,admins" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2023-05-30 15:31:32,592 INFO  [io.hawt.web.auth.LoginRedirectFilter] Hawtio loginRedirectFilter is using 1800 sec. HttpSession timeout
2023-05-30 15:31:32,609 INFO  [io.hawt.web.proxy.ProxyServlet] Proxy servlet is disabled
2023-05-30 15:31:32,620 INFO  [io.hawt.web.servlets.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/home/slave/artemis-slave/etc/jolokia-access.xml]
2023-05-30 15:31:32,801 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://slave:8161
2023-05-30 15:31:32,805 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://slave:8161/console/jolokia
2023-05-30 15:31:32,816 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://slave:8161/console
2023-05-30 15:31:34,249 INFO  [io.hawt.web.auth.LoginServlet] Hawtio login is using 1800 sec. HttpSession timeout
2023-05-30 15:31:38,209 INFO  [io.hawt.web.auth.keycloak.KeycloakServlet] Keycloak integration is disabled
2023-05-30 15:32:18,211 INFO  [io.hawt.web.auth.LoginServlet] Logging in user: XX
2023-05-30 15:33:12,450 WARN  [org.apache.activemq.artemis.core.client] AMQ212037: Connection failure to master/master:61616 has been detected: AMQ219015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
2023-05-30 15:33:12,454 WARN  [org.apache.activemq.artemis.core.client] AMQ212037: Connection failure to master/master:61616 has been detected: AMQ219015: The connection was disconnected because of server shutdown [code=DISCONNECTED]

The Slave Server didn't go live.


Solution

  • i found the Problem it was in mount the shared Folder it was didn`t correct