Skip to main content
Older versions of Internet Explorer will not support certain site features. Chrome, Safari, Firefox, and Edge will provide the best experience.
Spok

Setting up RabbitMQ for an HA Spok Mobile Implementation

This procedure is used by Spok PSG resources to configure RabbitMQ for  Spok Mobile environments that have both High Availability and the Spok Notification Service, which delivers messages to non-GCM Android devices.

See also: Setting up a Highly Available Spok Mobile Environment

Make Sure Erlang Cookies Match on Primary and Secondary Spok Mobile Servers

  1. On the primary Spok Mobile server, locate the two .erlang.cookie files. Copy both of them.
    With Erlang versions starting with 20.2, the cookie file locations are:
    • %HOMEDRIVE%%HOMEPATH%\.erlang.cookie (usually C:\Users\%USERNAME%\.erlang.cookie)
    • %USERPROFILE%\.erlang.cookie (usually C:\WINDOWS\system32\config\systemprofile)
  2. Stop the RabbitMQ windows service on the secondary Spok Mobile server.
  3. Paste the .erlang.cookie files that you copied from the primary Spok Mobile server into the same locations on the secondary Spok Mobile server:
    • %HOMEDRIVE%%HOMEPATH%\.erlang.cookie (usually C:\Users\%USERNAME%\.erlang.cookie)
    • %USERPROFILE%\.erlang.cookie (usually C:\WINDOWS\system32\config\systemprofile)
  4. Open the files on both servers to verify that the content is the same. Both instances of RabbitMQ should now have the same .erlang.cookie files.
  5. Start the RabbitMQ windows service on the secondary Spok Mobile Server.

Determine the RabbitMQ Nodes on the Primary and Secondary Spok Mobile Servers

In the following procedure, you will be executing rabbitmqctl command line commands for RabbitMQ. For more details, see https://www.rabbitmq.com/rabbitmqctl.8.html.

  1. Оn the primary Spok Mobile Server, open a command prompt with Administrator rights, and navigate to RabbitMQ’s sbin folder (usually C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.0\sbin)

  2. Run the following command to check the current state of the clusters on the primary Spok Mobile server:

    rabbitmqctl cluster_status

    This should return the following (in this example, rabbit@SM-FT-45 is the RabbitMQ node of the primary Spok Mobile server):

    Cluster status of node rabbit@SM-FT-45 ...
    [{nodes,[{disc,['rabbit@SM-FT-45']}]},
    {running_nodes,['rabbit@SM-FT-45']},
    {alarms,[{'rabbit@SM-FT-45',[]}]}]
    
  3. Run the following command to check the current state of the clusters on the secondary Spok Mobile server:

    rabbitmqctl cluster_status

    This should return the following (in this example, rabbit@SM-2-FT-45 is the RabbitMQ node of the secondary Spok Mobile server):

    Cluster status of node rabbit@SM-2-FT-45 ...
    [{nodes,[{disc,['rabbit@SM-2-FT-45']}]},
    {running_nodes,['rabbit@SM-2-FT-45']},
    {alarms,[{'rabbit@SM-2-FT-45',[]}]}]
    

Join the Primary and Secondary Spok Mobile Servers in a Cluster

  1. Stop the secondary Spok Mobile server RabbitMQ node by running the following command:

    rabbitmqctl stop_app
  2. After the Rabbit application is stopped on the secondary Spok Mobile server node (rabbit@SM-2-FT-45 in this example), run the following command to create the cluster:

    rabbitmqctl join_cluster rabbit@SM-FT-45
  3. Start the secondary Spok Mobile server’s node by running the following command:

    rabbitmqctl start_app
  4. Check the cluster status of the secondary and primary Spok Mobile Servers by running the following command on each:

    rabbitmqctl cluster_status
    

    Both servers should return the following:

    Cluster status of node rabbit@SM-2-FT-45 ...
    [{nodes,[{disc,['rabbit@SM-2-FT-45','rabbit@SM-FT-45']}]},
    {running_nodes,['rabbit@SM-FT-45','rabbit@SM-2-FT-45']},
    {cluster_name,<<"rabbit@SM-FT-45.spokvdev.com">>},
    {partitions,[]},
    {alarms,[{'rabbit@SM-FT-45',[]},{'rabbit@SM-2-FT-45',[]}]}]
    

    There are now two nodes running in the cluster. If you open the Management UI on http://localhost:15672, you will see the cluster name on the top right corner of the UI.

  5. Now when you open RabbitMQ Web Management (http://localhost:15672) on one of the servers, the changes will be preserved on both nodes. For more information about the RabbitMQ Web Management, see https://www.rabbitmq.com/management.html.

Configuring the Spok Mobile Load Balancer for RabbitMQ

Customers are responsible for configuring and managing load balancers for the Spok Mobile solution. The Spok Mobile load balancer must direct traffic from port 8883 to the Spok Mobile servers. The RabbitMQ instances listen on this port.