DEV Community

leo
leo

Posted on

Example of manual installation of active and standby shared storage(openGauss)

Example of manual installation
Compared with the traditional gs_initdb database construction, shared storage database construction divides the directory into three types, each instance is exclusive and not shared, each instance is exclusive and shared, and all instances are shared. The directories that need to be shared need to be stored on the disk array device, and the directories that are not shared should be stored on the local disk. In addition, to build a database on the standby machine, you only need to create its own directory, and you don't need to create a directory structure shared by all instances again. Added relevant GUC parameters for active and standby shared storage, and switched the system table storage mode from page to segment page.

Note: The single-step manual installation here means that after the project is compiled, the relevant commands can be executed in a single step to build a shared storage library. For the general installation of openGauss, please refer to the "Installation Guide".

Preconditions

The project has completed code compilation.
The host has mounted the disk array LUN device and installed the ultrapath multipath software, and the disk array device is available.
Steps

Create a soft link for the drive letter of the disk array LUN and assign corresponding user permissions (assuming that the drive letter corresponding to the disk array LUN is /dev/sde, /dev/sdf).

sudo ln -s /dev/sde /dev/tpcc_data
sudo ln -s /dev/sdf /dev/tpcc_log
sudo chmod 777 /dev/tpcc_data
sudo chmod 777 /dev/tpcc_log
Authorize executable files that require disk array RAWIO permissions.

sudo -i setcap CAP_SYS_RAWIO+ep 绝对路径/perctrl
perctrl: An executable tool used to grant read and write permissions to dss-related tools and processes.

Create the DSS server process and the configuration files required to create a shared repository.

Test directory (assumed to be /data/test)

└─dss_home/
├── cfg
│ ├── dss_inst.ini
│ └── dss_vg_conf.ini
└── log // 启动前需存在log目录
dss_init.ini configuration content is as follows:

INST_ID=0
_LOG_LEVEL=55
_LOG_BACKUP_FILE_COUNT=128
_LOG_MAX_FILE_SIZE =20M
LSNR_PATH=/data/test/dss_home
STORAGE_MODE=RAID
_SHM_KEY=12
The parameters in the above configuration are described as follows:

INST_ID configures the instance number, the value range is [0, 63], and the dssserver processes under each active and standby are different.
_LOG_LEVEL log level.
_LOG_BACKUP_FILE_COUNT The maximum number of log files to keep.
_LOG_MAX_FILE_SIZE is the maximum size of a single log file.
LSNR_PATH is the directory saved by the domain socket used for communication between the DSS client and the server, and is generally set as the home directory of the DSS server process.
STORAGE_MODE is the storage device type corresponding to DSS, and the disk array is configured as RAID.
_SHM_KEY shared memory KEY, it is necessary to ensure that each DSS is different.
dss_vg_conf.ini configuration content is as follows,

data:/dev/tpcc_data
log: /dev/tpcc_log
Indicates that the contents of the +data directory are stored on the /dev/tpcc_data device, and the contents of the +log directory are stored on the /dev/tpcc_log device. It should be noted here that it is agreed whether there is a + character in the root directory name to distinguish whether it is a file in the file system or a file in DSS. Users can treat DSS as a distributed file system.

Use the DSS client tool (dsscmd) to initialize the VG on the disk array device (similar to the operation of initializing a file system on a bare disk).

清空磁阵LUN开头数据

dd if=/dev/zero bs=2048 count=100000 of=/dev/tpcc_data
dd if=/dev/zero bs=2048 count=100000 of=/dev/tpcc_log

创建VG

dsscmd cv -g data -v /dev/tpcc_data -s 2048 -D /data/ss_test/dss_home
dsscmd cv -g log -v /dev/tpcc_log -s 65536 -D /data/ss_test/dss_home

拉起dssserver

dssserver -D /data/ss_test/dss_home &
Create a shared repository via gs_initdb.

gs_initdb -D /data/ss_test/dn_primary --nodename=single_node -w Gauss_234 --vgname="+data,+log" --enable-dss --dms_url="0:127.0.0.1:1611,1:127.0.0.1:1711" -I 0 --socketpath="UDS:/data/ss_test/dss_home/.dss_unix_d_socket"
Among them, 5 related parameters are added:

–vgname volume group name, which specifies the volume group under which the shared repository is built. This name is related to the configuration items in the dss_vg_conf.ini file. The volume group name needs to appear in the configuration file and start with a '+' character.
–enable_dss indicates that the shared repository should be built into DSS.
–dms_url "0:127.0.0.1:1611,1:127.0.0.1:1711", the format is instance_id:ip:port.
-I specifies the instance number of the current node, and the value range is [0,63].
–socketpath specifies the location where the unix domain socket used for communication between the DSS client (here, the DSS client dynamic library integrated into the database-related executable file) and the server is stored.
The shared repository is built successfully, and the database process is pulled through the gs_ctl start command.

gs_ctl start -D /data/ss_test/dn_primary
Follow the steps above and re-install the standby machine.

Top comments (0)