Configuring HA on NFS Servers

Scenarios

If you use SFS Turbo to provide shared file storage, skip this section.

When NFS servers are deployed to work in active/standby mode, you must enable data synchronization on the NFS servers so that they can properly support SAP HANA.

Prerequisites

You have configured NFS servers to be trusty to each other and formatted the disks attached to NFS servers. For details, see sections Configuring NFS Servers to Be Trusty to Each Other and Formatting the Disks Attached to an NFS Server.

Procedure

  1. Initialize the cluster.

    1. Log in to the jump host. Ensure that user root and key file are used for authentication. Then, use SSH to switch to the active NFS server. The name of the NFS server is assumed to nfs01.
    2. Run the following command on the active NFS server to enter the cluster configuration page:

      ha-cluster-init

    3. When the system displays the following information, enter y and press Enter:
      WARNING: NTP is not configured to start at system boot.
      WARNING: No watchdog device found. If SBD is used, the cluster will be unable to start without a watchdog.
      Do you want to continue anyway? [y/N]
    4. When the system displays the following information, enter n and press Enter:
      /root/.ssh/id_rsa already exists - overwrite? [y/N]
    5. Enter the heartbeat network segment of the NFS server and press Enter.

      Take network segment 10.0.4.0 as an example:

      Network address to bind to (e.g.: 192.168.1.0) []
    6. When the system displays the following information, retain the default settings and press Enter:
      Multicast address (e.g.: 239.x.x.x) [239.97.171.218]
    7. When the system displays the following information, retain the default settings and press Enter:
      Multicast port [5405] 
    8. When the system displays the following information, enter n and press Enter:
      Do you wish to use SBD? [y/N]
    9. When the system displays the following information, enter n and press Enter:

      To ensure system security, change the hacluster password after configuring HA.

      ...
          Log in with username 'hacluster', password 'linux'
      WARNING: You should change the hacluster password to something more secure!
        Enabling pacemaker.service
        Waiting for cluster........done
        Loading initial configuration 
      ...
      Do you wish to configure an administration IP? [y/N]
    10. During the cluster initialization, the system displays the following information:
      Done (log saved to /var/log/ha-cluster-bootstrap.log)

  2. Add the standby NFS server to the cluster.

    1. On the active NFS server nfs01, synchronize the corosync.conf configuration file to the standby NFS server.

      The command is in the following format:

      scp /etc/corosync/corosync.conf Name of the standby NFS server:/etc/corosync/

      The following command is used as an example:

      scp /etc/corosync/corosync.conf nfs02:/etc/corosync/

    2. Log in to the standby NFS server from the active one using SSH.

      ssh nfs02

    3. Run the following command to add the standby NFS server to the cluster:

      ha-cluster-join

    4. When the system displays the following information, enter y and press Enter:
      WARNING: NTP is not configured to start at system boot.
      WARNING: No watchdog device found. If SBD is used, the cluster will be unable to start without a watchdog.
      Do you want to continue anyway? [y/N]
    5. When the system displays the following information, enter the heartbeat plane IP address of the active NFS server, for example, 10.0.4.101, and press Enter:
      IP address or hostname of existing node (e.g.: 192.168.1.1) [] 
    6. When the system displays the following information, enter n and press Enter:
      /root/.ssh/id_rsa already exists - overwrite? [y/N]
    7. During the cluster initialization after the standby NFS server is added to the cluster, the system displays the following information:
      ......
      WARNING: You should change the hacluster password to something more secure!
      Enabling pacemaker.service
      Waiting for cluster........done
      Done (log saved to /var/log/ha-cluster-bootstrap.log)

  3. Configure basic cluster parameters.

    1. Use VNC and user root password to log in to the active NFS server as user root and switch to the CLI mode.
    2. Run the yast2 command to enter the YaST2 Control Center page.
      Figure 1 YaST2 Control Center page
    3. Choose High Availability > Cluster. The system displays a message, asking you to install the hawk software package, as shown in Figure 2. Select Cancel and press Enter.
      Figure 2 Installing the hawk software package
    4. The system displays the message "If you continue without installing required packages, YaST may not work properly." Select Continue and press Enter. The configuration information page of the cluster is displayed.
    5. On the left side of the page, choose Communication Channels. Then, configure parameters on the right side of the page. Figure 3 shows an example.

      Set the parameters as follows:

      • Transport: Set this parameter to Unicast.
      • In the Channel pane, select the network segment for the NFS server heartbeat link, which is the network segment of the heartbeat plane, for example, 10.0.4.0, for Bind Network Address; retain the default setting of Multicast Port.
      • Auto Generate Node ID: Select this parameter.
      • Redundant Channel: You do not need to configure this parameter.
      • Member Address: Use Add to add the heartbeat plane IP addresses as well as the server or backup plane IP addresses of the active and standby NFS servers to Member Address.
      Figure 3 Communication Channels page
    6. On the left side of the page, choose Security. Then, configure parameters on the right side of the page.

      Enable Security Auth: Select this parameter.

      Select Generate Auth Key File and press Enter. In the dialog box showing the file generation message, select OK and press Enter to generate the authentication key file.

      Figure 4 Security page
    7. On the left side of the page, choose Configure Csync2. Then, configure parameters on the right side of the page.

      Select a Sync Host node and Generate Pre-Shared-Keys and press Enter to generate the file. In addition, ensure that Turn csync2 OFF in the lower right corner of the page is displayed, indicating that Csync2 has been enabled.

      Figure 5 Configure Csync2 page
    8. On the left side of the page, choose Service. Then, configure parameters on the right side of the page.

      Set the parameters as follows:

      • Booting: On is selected by default, which indicates that the cluster is automatically started when the server starts.
      • Switch on and off: Ensure that the cluster has been started.
      • Firewall Settings: Ensure that Firewall is disabled is selected.
      Figure 6 Service page
    9. Select Finish and press Enter to complete the configuration.
    10. Copy the key_hagroup and csync2.cfg files on the active NFS server to the standby NFS server.

      Log in to the active NFS server as user root and run the following command:

      scp /etc/csync2/key_hagroup /etc/csync2/csync2.cfg Name of the standby NFS server:/etc/csync2

      The following command is used as an example:

      scp /etc/csync2/key_hagroup /etc/csync2/csync2.cfg nfs02:/etc/csync2

    11. Run the following commands on the active NFS server:

      systemctl enable csync2.socket

      systemctl enable xinetd

      systemctl restart xinetd

    12. Run the following commands on the standby NFS server.

      Log in to the standby NFS server as user root and run the following commands:

      systemctl enable csync2.socket

      systemctl enable xinetd

      systemctl restart xinetd

    13. Run the following command on the active NFS server to synchronize the configuration file:

      csync2 -xv

    14. Run the following command on the active NFS server to check the cluster status:

      Ensure that the cluster status is active (running).

      If the command output indicating that the STONITH disk has not been configured, this is normal. The STONITH disk will be configured in the subsequent steps.

      systemctl status pacemaker

    15. Run the following commands on the active NFS server to restart the cluster:

      systemctl stop pacemaker

      systemctl start pacemaker

    16. Run the following command on the standby NFS server to check the cluster status:

      Ensure that the cluster status is active (running).

      If the command output indicating that the STONITH disk has not been configured, this is normal. The STONITH disk will be configured in the subsequent steps.

      systemctl status pacemaker

    17. Run the following commands on the standby NFS server to restart the cluster:

      systemctl stop pacemaker

      systemctl start pacemaker

    18. Run the following command on the active NFS server to check the cluster heartbeat status:

      corosync-cfgtool -s

      The system displays the heartbeats of the active and standby links. Ensure that the configurations are correct. An example is provided as follows:

      Printing ring status.
      Local node ID 167772739
      RING ID 0
      id= 10.0.4.101
      status= ring 0 active with no faults
      RING ID 1
      id= 10.0.5.101
      status= ring 1 active with no faults
    19. Run the following command to check the cluster status on the active NFS server:

      crm_mon -r1

      The terminal display is as follows, where two NFS servers are in Online state, indicating that the cluster is functional:

      Last updated: Wed Oct 19 17:40:31 2016
      Last change: Tue Oct 18 15:32:00 2016 by root via cibadmin on hana01
      Stack: classic openais (with plugin)
      Current DC: nfs01 - partition with quorum
      Version: 1.1.12-f47ea56
      2 Nodes configured, 2 expected votes
      0 Resources configured
      
      
      Online: [ nfs01 nfs02 ]

  4. Configure the softdog.

    1. Run the following command on the active NFS server to open the file and enter i to enter editing mode:

      vi /etc/init.d/boot.local

    2. Add the following information to the last line of the file:
      modprobe softdog >/dev/null 2>&1
    3. Press Esc, enter :x!, and press Enter to exit the configuration.
    4. On the CLI, run the following command:

      modprobe softdog

    5. Repeat steps 4.a to 4.d to configure the softdog on the standby NFS server.

  5. Configure SBD on the Fence devices.

    1. Run the following command on the active and standby NFS servers to start the SBD service automatically once the active and standby NFS servers start:

      systemctl enable sbd

    2. Run the following command on the active NFS server to create an SBD partition:

      The command is in the following format:

      sbd -d /dev/disk/by-id/Partition ID create

      To query an SDB disk ID, run the ll /dev/disk/by-id |grep Partition name|grep scsi-3 command. For example, if the partition name is /dev/sdb1, run the ll /dev/disk/by-id |grep sdb|grep scsi-3 command to query the ID corresponding to sdb1.

      The following command is used as an example:

      sbd -d /dev/disk/by-id/scsi-36888603000000db7fa179ea56210049-part1 create

    3. Run the following command to allocate the partition to the active NFS server:

      The command is in the following format:

      sbd -d /dev/disk/by-id/Partition ID allocate Active node host name

      The following command is used as an example:

      sbd -d /dev/disk/by-id/scsi-36888603000000db7fa179ea56210049-part1 allocate nfs01

    4. Run the following command to allocate the partition to the standby NFS server:

      The command is in the following format:

      sbd -d /dev/disk/by-id/Partition ID allocate Standby node host name

      The following command is used as an example:

      sbd -d /dev/disk/by-id/scsi-36888603000000db7fa179ea56210049-part1 allocate nfs02

    5. Run the following command to query the allocated partition:

      The command is in the following format:

      sbd -d /dev/disk/by-id/Partition ID list

      The following command is used as an example:

      sbd -d /dev/disk/by-id/scsi-36888603000000db7fa179ea56210049-part1 list

      The command output is as follows:

      0  nfs01 clear
      1  nfs02 clear
    6. Run the following command to dump the partition:

      sbd -d /dev/disk/by-id/Partition ID dump

      The following command is used as an example:

      sbd -d /dev/disk/by-id/scsi-36888603000000db7fa179ea56210049-part1 dump

    7. Open the sbd file and add data to the file.

      Run the vi /etc/sysconfig/sbd command to open the file and add data to the file.

      An example is provided as follows:

      Enter the path of the partition for SBD in SBD_DEVICE. The partition in the following terminal display is for reference only.

      SBD_DEVICE="/dev/disk/by-id/scsi-36888603000000db7fa179ea56210049-part1"
      SBD_OPTS="-W"
    8. On active NFS server, synchronize the configuration file to the standby NFS server.

      scp /etc/sysconfig/sbd Standby node host name:/etc/sysconfig

      The following command is used as an example:

      scp /etc/sysconfig/sbd nfs02:/etc/sysconfig

    9. Run the following commands on the active NFS server to restart the cluster:

      systemctl stop pacemaker

      systemctl start pacemaker

    10. Run the following commands on the standby NFS server to restart the cluster:

      systemctl stop pacemaker

      systemctl start pacemaker

    11. Check cluster configurations.

      crm_mon -r1

      The terminal display is as follows, where two NFS servers are in Online state, indicating that the cluster is functional:

      Last updated: Wed Oct 19 17:40:31 2016
      Last change: Tue Oct 18 15:32:00 2016 by root via cibadmin on hana01
      Stack: classic openais (with plugin)
      Current DC: nfs01 - partition with quorum
      Version: 1.1.12-f47ea56
      2 Nodes configured, 2 expected votes
      0 Resources configured
      
      
      Online: [ nfs01 nfs02 ]

  6. Add Fence SBD resources.

    1. Run the following command on the active NFS server to switch to the CRM configuration mode:

      crm

      Information similar to the following is displayed:

      crm(live)#
    2. Run the following command to switch to the configuration mode:

      configure

    3. Run the following commands to add SBD resources:

      primitive r_sbd stonith:external/sbd params pcmk_delay_max=40

      commit

  7. Assign a virtual service IP address.

    1. On the management console, click Service List and choose Computing > Elastic Cloud Server to switch to the Elastic Cloud Server page.
    2. Locate the ECS on which an NFS server is deployed and click the ECS name. Then, the page for the ECS details is displayed.
    3. Click the NIC tab and then Manage Private IP in the row of the server or management plane NIC. Then, the system displays the Virtual IP Address page.
    4. Click Assign Virtual IP Address to assign a floating IP address. Locate the row that contains the target IP address, click Bind to Server to bind the IP address to the target ECS, and repeat this operation to bind the IP address to other ECSs.
    5. Run the following commands on the active NFS server in CRM configuration mode.

      In the commands, params ip is the virtual service IP address of the NFS server. This value is for reference only.

      primitive nfs_vip ocf:heartbeat:IPaddr2 params ip=10.0.1.103 op monitor interval="10" timeout="20" on-fail=restart

      commit

  8. Create cluster shared volume file systems.

    Run the following commands on the active NFS server to create the cluster shared disk file system for the shared and backup volumes, respectively:

    In the commands, params device and directory specify the volume ID and path, and the values provided are for reference only. For instructions about how to query a volume ID, see 5.b.

    primitive nfs_shared ocf:heartbeat:Filesystem params device="/dev/disk/by-id/Volume ID" directory="/shared" fstype=xfs op monitor interval="10" timeout="40" on-fail=restart

    primitive nfs_bak ocf:heartbeat:Filesystem params device="/dev/disk/by-id/Volume ID" directory="/backup" fstype=ext3 op monitor interval="10" timeout="40" on-fail=restart

    primitive nfs_sapmnt ocf:heartbeat:Filesystem params device="/dev/disk/by-id/Volume ID" directory="/sapmnt " fstype=ext3 op monitor interval="10" timeout="40" on-fail=restart

    primitive nfs_sys ocf:heartbeat:Filesystem params device="/dev/disk/by-id/Volume ID" directory="/usr/sap/A01/SYS" fstype=ext3 op monitor interval="10" timeout="40" on-fail=restart

    primitive nfs_sapcd ocf:heartbeat:Filesystem params device="/dev/disk/by-id/Volume ID" directory="/sapcd" fstype=ext3 op monitor interval="10" timeout="40" on-fail=restart

    commit

  9. Create the nfsserver resource.

    In the CRM configuration mode on the active NFS server, create the nfsserver resource.

    If the floating IP address (specified by nfs_ip) of the NFS server is 10.0.1.103, run the following commands:

    primitive nfsserver nfsserver params nfs_ip=10.0.5.103 nfs_shared_infodir="/shared" nfs_shared_infodir="/backup" nfs_shared_infodir="/sapmnt" nfs_shared_infodir="/usr/sap/A01/SYS" nfs_shared_infodir="/sapcd" operations $id=nfsserver-operations op monitor interval="10" timeout="20" on-fail=restart

    commit

  10. Create the resource group nfs_group.

    Run the following commands on the active NFS server in CRM configuration mode to create resource group nfs_group for the resource created from 7.e to 9:

    group nfs_group nfs_vip nfs_shared nfs_bak nfs_sapmnt nfs_sys nfs_sapcd nfsserver

    commit

  11. Create Clone Ping.

    Run the following commands on the active NFS server in the CRM configuration mode to create Clone Ping:

    primitive r_ping ocf:pacemaker:ping params multiplier="100" dampen="5" host_list="10.0.5.1" op monitor interval="15" timeout="60" start="60" op start interval="0" timeout="60"

    clone PING r_ping

    commit

    Set the parameters as follows:

    • r_ping: specifies the Clone Ping resource name.
    • Multiplier: an efficiency enhancer that uses the benchmark of 100. When packet loss occurs during the ping operation between two nodes, the multiplier decreases a certain value from 100 to determine the service NIC communication status of the nodes.
    • dampen: indicates that the ping operation is performed once every 5s.
    • 10.0.5.1: indicates the gateway IP address of the server or backup plane network segment for the NFS servers.
    • monitor: monitors resources; interval: indicates that if pinging the upper-layer switch fails within 15s, the system will migrate resources at most 60s (timeout) later.

  12. Create restraint nfs_conn.

    Run the following commands on the active NFS server in the CRM configuration mode to create restraint nfs_conn on resource group nfs_group:

    location nfs_conn nfs_group rule -inf: not_defined pingd or pingd lte 0

    commit

  13. Configure other information.

    1. Configure the stonith parameter:

      property startup-fencing=true

      property stonith-enabled=true

      property stonith-action=off

      commit

    2. Configure the failure timeout duration:

      rsc_defaults failure-timeout=600

      commit

    3. Press Ctrl+C on the active NFS server to exit the CRM configuration mode.