Configuring an Active-Active Replication

An active-active replication requires a load balancer and two database nodes, with the option of adding one or more application nodes to each database node.

The following figure depicts an active-active topology with example IP addresses. This topology will be used to illustrate the steps you take to configure your cluster.

Cluster With Two Database Nodes and Two Application Nodes

The basic steps to configure this topology are:

  1. From the command line interface of the primary DB node, configure both the primary and secondary database nodes.
  2. From the command line interface of the primary DB node, configure any application nodes, one at a time, that are part of the same node group as the primary DB.
  3. From the command line interface of the secondary DB node, configure any application nodes, one at a time, that are part of the same node group as the secondary DB.

The more detailed steps below walk you through the configuration of the database nodes. It is assumed that you have already deployed two Cloudpath ES systems with the same .OVA file.

Procedure to Configure the Two Database Nodes:

  1. On the primary Cloudpath system, open a terminal window and log in to the service account:
    Note: For purposes of this example, the node whose IP address is 192.168.94.243 is the primary node.
    • Port 8022 with SSH unless you change the port number
    • Username: cpn_service
    • Password: Enter the password.

    The command-line configuration utility prompt (#) should display.

  2. Enter the command: replication setup
  3. When presented with cluster-type options, select Active-Active and continue.

    You are then presented with the following options for Active - Active:

     ------------------------------------------------------------------------------
       * Active-Active cluster configuration
    
       1) Without NAT - Cluster nodes are bidirectionally reachable directly with
                        the given IP address of each node.
    
       2) Behind NAT  - Cluster nodes are reachable via a public IP address which
                        differs from configured private IP address of each node.
     ------------------------------------------------------------------------------

  4. This example continues with the assumption that option 1 (Without NAT) is selected, and the dialogue continues.
    Note: If you are setting up an active - active system with NAT, you will need to know both the private and public IP addresses of the cluster nodes. Otherwise, the process is basically the same as active - active without NAT.
  5. You are next presented with the following information, to which, after reading, you can answer yes to proceed :
     ------------------------------------------------------------------------------
       WARNINGS:
         1.  The node which replication setup is initiated (this node) will be
             considered the primary database node.  The data on this node will be
             retained and replicated to the second database node. Some future
             maintenance operations such as software updates will be need initiated
             from the primary database node.
         2.  All data existing on the secondary node will be deleted and replaced
             with the data currently on the primary node. Before proceeding, create
             a VM snapshot of all cluster nodes.
         3.  The application running on both nodes will be shutdown. This process
             should be run during a maintenance period.
     ------------------------------------------------------------------------------
    
      Do you want to continue? [y/n]
  6. You are next presented with the following, to which you should answer yes and proceed:
     An existing database cluster configuration was not found. A new cluster configuration will be defined.
    
      Do you want this node (192.168.94.243) to be the primary database node? [y/n]
  7. After answering yes, you are prompted to enter the IP address of the other node, which is 192.168.94.244 in this example, then continue:
     192.168.94.243 will be the primary database node.
    
      Secondary database cluster node configuration:
    
      Secondary node IP: 192.168.94.244
  8. You are prompted to enter the SSH port for the secondary node. Enter 8022 (unless you have changed it), then proceed.
  9. You are presented with the following information; answer yes and proceed:
     WARNINGS:
         Configuring the cluster will cause any data existing on 192.168.94.244 be
         deleted and replaced with the data currently on 192.168.94.243
     ------------------------------------------------------------------------------
    
      Do you want to continue? [y/n]
  10. You are presented with the following; check to be sure it is correct and then proceed:
     ------------------------------------------------------------------------------
       Database cluster has been defined:
         Primary: 192.168.94.243   ssh port# 8022
         Secondary: 192.168.94.244   ssh port# 8022
    
         Cluster Type: Active-Active
         Network: Without NAT
     ------------------------------------------------------------------------------
    
      Is this correct? [y/n]
  11. You are then prompted to enter the virtual name of your load balancer, which you have set up in advance. Enter the name and continue.
    Load Balancer Virtual Host Name: jeff247.cloudpath.net
  12. You are next presented with the following information:
     ------------------------------------------------------------------------------
      Cluster DNS Name - The cluster as a whole must have a single unified DNS name
                         it is known as.  This is most likely the fully qualified
                         domain name (FQDN) of the HTTPS certificate for the
                         enrollment portal as a whole.
    
                         This DNS name in most cases will resolve to the load
                         balancer fronting the cluster. Example:
                         Node 1 : node1.my-company.com
                         Node 2 : node2.my-company.com
                         Cluster DNS Name : wifi-onboarding.my-compandy.com
    
      IMPORTANT: If certificate based enrollments already exist you must re-use
                 the hostname that was in place at the time of the enrollments
                 occurred as the "Cluster DNS Name".  If this name is modified,
                 all existing certificates will be invalidated as their OCSP URL
                 will no longer match the answering address of the CA (which must
                 be the cluster as a whole.)
    
      Cluster DNS Name: jeff243.cloudpath.net
        - Please ensure this is correct.
        - This name should match up with the host portion of the "OCSP URL" within
          the browser based Admin UI.  See "Certificate Authority > Manage CAs"
          If this is a new install you may want to create a new root CA if this
          does not match.
        - This value may not be changed after certificate based enrollments occur
          without requiring users to re-enroll.
     ------------------------------------------------------------------------------
    
      Do you want to keep jeff243.cloudpath.net? [y/n]

    It is recommended to enter yes and proceed.

    Note: If you enter no and proceed, you will later need to follow instructions from the command dialogue to update certificates.

  13. You are then presented with the following:
     ------------------------------------------------------------------------------
       Cluster DNS Name is set: jeff243.cloudpath.net.
       At later time, you will need to make DNS changes:
         Rename Load Balancer's Host Name to jeff243.cloudpath.net.
         Rename hostname of the primary database node.
     ------------------------------------------------------------------------------
    
      Do you want to continue? [y/n]

    Enter yes to proceed.

    Note: The dialogue informs you that you will need to make some DNS changes. This is described following these numbered steps.
  14. The process completes, as shown in the following example. Check that you receive "Replication cluster setup complete:"
    Will establish ssh 192.168.94.244:8022 ...
     ------------------------------------------------------------------------------
        * You will be prompted for the password of the remote VM 192.168.94.244.
     ------------------------------------------------------------------------------
    yes: standard output: Broken pipe
    yes: write error
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/repl_user/.ssh/id_rsa.pub"
    cpn_service@192.168.94.244's password:
    id_rsa.pub                                                                                                100%  406   940.8KB/s   00:00
    Checking remote host 192.168.94.244 ...
    Will copy cluster configuration to node 192.168.94.244 ...
    Will establish ssh from 192.168.94.244 to 192.168.94.243 ...
    SSH connection from 192.168.94.244 to 192.168.94.243: SSH test succeeded
    Will update network configuration ...
    Will update database server configuration ...
    Will stop local application service ...
    Will restart database service...
    Will configure local database service permission ...
    Will transfer application database to the secondary database node at 192.168.94.244 ...
    Will restart local application service ...
    Will provision new remote node 192.168.94.244 ...
    Done provisioning new remote node 192.168.94.244 :
    Will replicate web cluster name jeff243.cloudpath.net ...
    Will replicate web cluster name jeff243.cloudpath.net on 192.168.94.244 ...
    Done replicating web cluster name.
    Will enable local cluster monitoring service ...
    Created symlink from /etc/systemd/system/multi-user.target.wants/cloudpath-repld.service to /etc/systemd/system/cloudpath-repld.service.
    Will enable cluster monitoring service on 192.168.94.244 ...
    Created symlink from /etc/systemd/system/multi-user.target.wants/cloudpath-repld.service to /etc/systemd/system/cloudpath-repld.service.
    Replication cluster setup complete.
    #

Verifying That the Cluster was Properly Created With Two DB Nodes:

To verify that your two-DB-node replication has been created correctly, follow these steps:

  1. Log in to the Cloudpath UI on any either of the two DB nodes in the cluster.
  2. Go to Administration > Replication.
  3. Make sure that the status indicates that both nodes are present in the cluster and have green check marks next to their names. as shown in the screen below that is based on the example in the topology presented in this section.

    Cluster Status Successful After Configuration of Both Database Nodes Completes

Changes to Make Before Using Cluster for Enrollments:

Before you begin using the cluster for enrollments, you need to make the DNS changes (using your DNS configuration tool) that were listed in the command dialogue as you entered your information. Those changes are necessary for the load balancer to be able to route traffic to both nodes in the cluster. In the example shown above, two DNS changes are required:

Cluster DNS Name is set: jeff243.cloudpath.net.
   At later time, you will need to make DNS changes:
     Rename Load Balancer's Host Name to jeff243.cloudpath.net.
     Rename hostname of the primary database node.

  1. Rename the load balancer from jeff247.cloudpath.net to jeff243.cloudpath.net so that the load balancer and the cluster host names are the same.
    Note: The cluster host name must be the host name of the load balancer.
  2. Rename the host name of the primary node from jeff243.cloudpath.net to a different name so that it does not conflict with cluster name.
Note: If you are adding application nodes to your cluster, proceed to Adding Application Nodes to a Cluster.