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
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. | |
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. | ||
To enable the RDMA protocol, install the RDMA NIC driver. For details about the mapping between OS and OFED versions, see Table 2. | ||
| 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
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
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.
Decompress the source package.
tar -xzvf OCK_scrlock_openEuler_aarch64.tar.gz
The following files are extracted.
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.
After the installation package is verified, go to the scripts directory.
cd scripts
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.
Switch to the database administrator.
su - omm
(Optional) Kill the om_monitor process.
gs_om -t killmonitor
source ~/.bashrc
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
Log in to the management node as the database administrator.
Modify the postgresql.conf file of the database.
Open the postgresql.conf file.
vim postgresql.conf
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
Press Esc, type :wq!, and press Enter to save the file and exit.
Restart the database to enable the SCRLock feature.
Stop openGauss.
cm_ctl stop
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.
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
Modify the postgresql.conf file in the root directory of the database.
Open the postgresql.conf file.
vim postgresql.conf
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
Press Esc, type :wq!, and press Enter to save the file and exit.
Stop openGauss.
cm_ctl stop
(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.
Start openGauss.
cm_ctl start