Synchronizing primary and secondary nodes

Install rsync and inotify-tools in the primary and secondary nodes to synchronize changes between these two nodes.

Procedure

  1. Install rsync and inotify-tools on both the nodes.
    yum install rsync
    yum install inotify-tools
    Note: Installation of rsync and inotify-tools might not be required on some nodes depending on the version of Red Hat you are using.

    For example, in Red Hat v8.3, rsync is already installed. You can manually install inotify-tools, by using the following command:

    cd /tmp
    git clone https://github.com/rvoicilas/inotify-tools.git
    cd inotify-tools
    ./autogen.sh
    ./configure && make && make install
    
  2. Confirm that inotifywait exists.
    updatedb
    locate inotifywait

    Note down the location, for example, /usr/local/bin/inotifywait. You might be required to specify this location, in syncup.sh.

  3. On both primary and secondary nodes, update the /etc/hosts file with the fully qualified domain name (root authority needed). You can either use the default domain name or change it to your choice.

  4. Change the hostname.
    vi /etc/hostname

  5. (Optional) Modify the hostname value on both the nodes by editing the /etc/sysconfig/network system file.

  6. If you changed the hostname, run the following command on both the nodes:
    hostname dmc-1
    hostname dmc-2
  7. Verify that the hostnames are correct on both the nodes.

  8. Restart the primary and secondary nodes after you complete the configuration changes.
  9. Configure Secure Shell (SSH) on both nodes to synchronize the file changes between these two nodes:
    1. Run the ssh-keygen command on both the nodes.
      ssh-keygen -t rsa
    2. Copy the contents of the output file id_rsa.pub on the primary node and append it to the /root/.ssh/authorized_keys file on the secondary node.
      cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
    3. To verify, run the following command:
      cat /root/.ssh/authorized_keys