Resource Pooling

OCK SCRLock

Introduction

This chapter describes how to install and use the SCRLock feature of the openGauss database. When resource pooling is enabled, SCRLock can be used to provide the distributed lock capability, improving distributed lock performance.

Preparations

Obtaining the Installation Package

Obtain the UWAL installation package from the openGauss community.

Environment Requirements

Table 1 Environment requirements

Item

Configuration

Description

Network adapter

The model is subject to the actual environment, for example, Mellanox CX4/CX5 NICs.

It must support RDMA and Ethernet, and the RDMA protocol must be enabled. For details, refer to RDMA Network Guide.

OS

  • Arm
    • openEuler 22.03 LTS
    • openEuler 20.03 LTS
    • openEuler 20.03 LTS SP1
    • openEuler 20.03 LTS SP3
  • x86
    • openEuler 22.03 LTS
    • openEuler 20.03 LTS
    • openEuler 20.03 LTS SP1
    • openEuler 20.03 LTS SP3

For the same SP version, if the kernel minor versions are inconsistent or an incompatibility error is reported during kernel component installation, you need to modify the OS weak-modules script. For details, refer to Modification of the weak-modules Script for OS Compatibility.

Software

MLNX_OFED_LINUX

To enable the RDMA protocol, install the RDMA NIC driver. For details about the mapping between OS and OFED versions, see Table 2.

  • OCK_scrlock_openEuler-20.03-LTS-SP1-aarch64.tar.gz
  • OCK_scrlock_openEuler-20.03-LTS-SP1-x86_64.tar.gz
  • OCK_scrlock_openEuler-20.03-LTS-SP3-aarch64.tar.gz
  • OCK_scrlock_openEuler-20.03-LTS-SP3-x86_64.tar.gz
  • OCK_scrlock_openEuler-20.03-LTS-aarch64.tar.gz
  • OCK_scrlock_openEuler-20.03-LTS-x86_64.tar.gz
  • OCK_scrlock_openEuler-22.03-LTS-aarch64.tar.gz
  • OCK_scrlock_openEuler-22.03-LTS-x86_64.tar.gz

SCRLock installation package. In the package names, openEuler-22.03-LTS-SP1/openEuler-22.03-LTS indicates the OS, and aarch64/x86_64 indicates the server architecture. Select an SCRLock installation package as required.

Table 2 Mapping between OS and OFED versions

OS Version

OFED Version

x86

Arm

openEuler 20.03 LTS

MLNX_OFED_LINUX-5.4-3.6.8.1-openeuler20.03-x86_64.tgz

MLNX_OFED_LINUX-5.4-3.1.0.0-openeuler20.03-aarch64.tgz

openEuler 20.03 LTS SP1

MLNX_OFED_LINUX-5.4-3.6.8.1-openeuler20.03sp1-x86_64.tgz

MLNX_OFED_LINUX-5.4-3.1.0.0-openeuler20.03sp1-aarch64.tgz

openEuler 20.03 LTS SP3

MLNX_OFED_LINUX-5.8-1.1.2.1-openeuler20.03sp3-x86_64.tgz

MLNX_OFED_LINUX-5.8-1.1.2.1-openeuler20.03sp3-aarch64.tgz

openEuler 22.03 LTS

MLNX_OFED_LINUX-5.8-1.1.2.1-openeuler22.03-x86_64.tgz

MLNX_OFED_LINUX-5.8-1.1.2.1-openeuler22.03-aarch64.tgz

Installation and Uninstallation

One-Click Deployment of the SCRLock Feature

SCRLock provides a simple deployment script. You can enter the installation path, installation user, and node information to perform one-click deployment.

  • Prerequisites

    • RDMA is enabled. This function depends on the CX4/CX5 NIC.
    • openGauss has been deployed.
    • Obtain the SCRLock installation package corresponding to the OS and CPU architecture in use, for example, OCK_scrlock_openEuler-20.03-LTS-SP1-aarch64.tar.gz.
    • The ${GAUSSHOME}/lib directory exists on the active and standby nodes.
    • Users with the same user name and password are created for servers where SCRLock needs to be deployed. The users must have the permission to run the rmmod, rpm, depmod, and modprobe commands.
  • Procedure

    1. Log in to the node as <SCRLock-install-user> and upload the installation package. Run the following command in the directory where the installation package is stored to decompress the installation package:

      tar -xzvf OCK_scrlock_openEuler-20.03-LTS-SP1-aarch64.tar.gz
      

      The following files are extracted.

      File

      Description

      OCK_scrlock_openEuler_aarch64.tar.gz

      Source package

      OCK_scrlock_openEuler_aarch64.tar.gz.txt

      Signature file

      OCK_scrlock_openEuler_aarch64.tar.gz.cms

      Description file

    2. Decompress the source package.

      tar -xzvf OCK_scrlock_openEuler_aarch64.tar.gz
      

      The following files are extracted.

      File

      Description

      scrlock_lib

      SO file

      scripts

      Installation script

      umdk_rpm

      RPM dependency package

      bin

      Signature verification file

    3. Use the verification binary file in the bin directory to verify the software package signature.

      ./bin/verification OCK_scrlock_openEuler_aarch64.tar.gz OCK_scrlock_openEuler_aarch64.tar.gz.cms OCK_scrlock_openEuler_aarch64.tar.gz.txt
      

      NOTE: The verification binary file requires three parameters in sequence: source package, signature file, and description file.

      • If the verification is successful, the console displays the following information:

        Starting to verify OCK_scrlock_openEuler_aarch64.tar.gz...
        Verify the source file passed.
        Verify the sha file passed.
        
      • If the verification fails, the console displays the following information:

        Starting to verify OCK_scrlock_openEuler_aarch64.tar.gz...
        ...
        Verify the source file failed.
        

        Or

        Starting to verify OCK_scrlock_openEuler_aarch64.tar.gz...
        ...
        Verify the sha file failed.
        

        NOTE: If the verification fails, the installation package has been tampered with. You are advised to obtain the installation package again and verify it again.

    4. After the installation package is verified, go to the scripts directory.

      cd scripts
      
    5. Run the deployment script and enter the password of <SCRLock-install-user> as prompted.

      sh scrlock_install.sh -H '192.168.4.164 192.168.4.165 192.168.4.166' -U omm -G dbgrp -D /home/omm/lib
      

      NOTE:

      • -H: IP addresses in the cluster. Example: '192.168.4.164 192.168.4.165 192.168.4.166'
      • -U: user name of the database administrator. Example: omm
      • -G: user group of the database administrator. Example: dbgrp
      • -D: path to the ${GAUSSHOME}/lib library. Example: /home/omm/lib
      • -h: help information. Deployment through scripts requires a high-privilege user. After the operations are complete, disable the high-privilege user's permission to remotely log in to the server using SSH to improve system security.
    6. Switch to the database administrator.

      su - omm
      
    7. (Optional) Kill the om_monitor process.

      gs_om -t killmonitor
      
    8. Load environment variables.

      source ~/.bashrc
      

      NOTICE: Perform steps 6 to 8 on the standby node.

Enabling the SCRLock Feature

To enable the SCRLock feature, modify the configuration file and restart the database for the modification to take effect.

  • Prerequisites

    • The openGauss version that contains the SCRLock feature has been installed on the active and standby nodes.
    • The SCRLock feature has been deployed in one-click mode.
  • Procedure

    1. Log in to the management node as the database administrator.

    2. Modify the postgresql.conf file of the database.

      1. Open the postgresql.conf file.

        vim postgresql.conf
        
      2. Press i to enter the insert mode, find the following parameters, and modify them as required. Table 1 describes the parameters.

        ss_enable_scrlock = off
        ss_enable_srclock_sleep_mode = off
        ss_scrlock_server_port = 8000
        ss_scrlock_worker_count = 2
        ss_scrlock_worker_bind_core = ''
        ss_scrlock_server_bind_core = ''
        

        Table 1 SCRLock configuration parameters

        Parameter

        Type

        Description

        Value Range

        Default Value

        ss_enable_scrlock

        Boolean

        Specifies whether to enable SCRLock.

        • on: enable.
        • off: disable.

        off

        ss_enable_scrlock_sleep_mode

        Boolean

        Specifies whether to enable the SCRLock sleep mode.

        • on: enable.
        • off: disable.

        on

        ss_scrlock_server_port

        Integer

        Specifies the listening port number of the SCRLock server.

        1024–65535

        8000

        ss_scrlock_worker_count

        Integer

        Specifies the number of workers on the SCRLock client.

        2–16

        2

        ss_scrlock_worker_bind_core

        Character string

        Specifies the start and end CPU cores bound to SCRLock workers.

        Format: "Start_CPU_core_index End_CPU_core_index". Separate the two indexes with a space. Example: 10 15

        ""

        ss_scrlock_server_bind_core

        Character string

        Specifies the start and end CPU cores bound to the SCRLock server.

        Format: "Start_CPU_core_index End_CPU_core_index". Separate the two indexes with a space. Example: 10 15

        ""

      3. Press Esc, type :wq!, and press Enter to save the file and exit.

    3. Restart the database to enable the SCRLock feature.

      1. Stop openGauss.

        cm_ctl stop
        
      2. Start openGauss.

        cm_ctl start
        

        NOTE: If the startup fails, rectify the fault based on the postgresql-YYYY-MM-DD_HHMMSS.log file in the openGauss log directory.

    4. Verify that the SCRLock feature is successfully enabled.

      gsql -d postgres -p 16600 -c "show ss_enable_scrlock"
      

      If the following information is displayed, the feature is enabled successfully:

      ss_enable_scrlock
      -------------------
      on
      (1 row)
      

      NOTE:

      • -p 16600: 16600 indicates the database port number. Change it based on the actual environment.
      • To view SCRLock log files, run the following command to view the last 20 lines:
      tail -fn20 ${GAUSSLOG}/pg_log/scrlock*.log
      

Disabling the SCRLock Feature

To disable the SCRLock feature, modify the configuration file and restart the database for the configuration to take effect.

  • Procedure

    1. Modify the postgresql.conf file in the root directory of the database.

      1. Open the postgresql.conf file.

        vim postgresql.conf
        
      2. Press i to enter the insert mode. Change the value of ss_enable_scrlock to off to disable the SCRLock feature.

        ss_enable_scrlock = off
        
      3. Press Esc, type :wq!, and press Enter to save the file and exit.

    2. Stop openGauss.

      cm_ctl stop
      
    3. (Optional) To uninstall the SCRLock feature, perform this step. Delete the SCRLock dynamic library file and clear the environment variable.

      rm -f /home/omm/lib/libscrlock.so
      unset OCK_SCRLOCK_LIB_PATH
      

      In the preceding commands, /home/omm/lib/ indicates the absolute path of the directory where libscrlock.so is located.

    4. Start openGauss.

      cm_ctl start
      
Feedback
编组 3备份
    openGauss 2024-05-19 00:42:09
    cancel