openGauss 7.0.0-RC1 版本体验:一主一备快速安装指南
【摘要】 openGauss 7.0.0-RC1 版本正式发布,在内核能力、DataVec 向量化能力、DataPod 三层资源池化架构、DataKit 数据全生命周期管理平台、生态兼容性等方面全面增强。详见官网。下面我将为您介绍如何快速搭建一个一主一备的 openGauss 环境进行体验。
本文作者:孙莹
openGauss 7.0.0-RC1 版本正式发布,在内核能力、DataVec 向量化能力、DataPod 三层资源池化架构、DataKit 数据全生命周期管理平台、生态兼容性等方面全面增强。详见官网。下面我将为您介绍如何快速搭建一个一主一备的 openGauss 环境进行体验。
安装环境说明
环境准备
关闭防火墙
注意下面操作,主备都需要执行
systemctl stop firewalld.service
systemctl stop iptables.service
systemctl disable firewalld.service
systemctl disable iptables.service
优化系统服务
关闭一些不需要的系统服务
systemctl stop postfix.service
systemctl stop avahi-daemon.socket
systemctl stop avahi-daemon.service
systemctl stop atd.service
systemctl stop bluetooth.service
systemctl stop wpa_supplicant.service
systemctl stop accounts-daemon.service
systemctl stop atd.service cups.service
systemctl stop postfix.service
systemctl stop ModemManager.service
systemctl stop debug-shell.service
systemctl stop rtkit-daemon.service
systemctl stop rpcbind.service
systemctl stop rngd.service
systemctl stop upower.service
systemctl stop rhsmcertd.service
systemctl stop rtkit-daemon.service
systemctl stop ModemManager.service
systemctl stop mcelog.service
systemctl stop colord.service
systemctl stop gdm.service
systemctl stop libstoragemgmt.service
systemctl stop ksmtuned.service
systemctl stop brltty.service
systemctl stop avahi-dnsconfd.service
systemctl stop abrt-ccpp.service
systemctl stop abrtd.service
systemctl stop auditd
systemctl disable auditd
systemctl disable firewalld.service
systemctl disable postfix.service
systemctl disable avahi-daemon.socket
systemctl disable avahi-daemon.service
systemctl disable atd.service
systemctl disable bluetooth.service
systemctl disable wpa_supplicant.service
systemctl disable accounts-daemon.service
systemctl disable atd.service cups.service
systemctl disable postfix.service
systemctl disable ModemManager.service
systemctl disable debug-shell.service
systemctl disable rtkit-daemon.service
systemctl disable rpcbind.service
systemctl disable rngd.service
systemctl disable upower.service
systemctl disable rhsmcertd.service
systemctl disable rtkit-daemon.service
systemctl disable ModemManager.service
systemctl disable mcelog.service
systemctl disable colord.service
systemctl disable gdm.service
systemctl disable libstoragemgmt.service
systemctl disable ksmtuned.service
systemctl disable brltty.service
systemctl disable avahi-dnsconfd.service
systemctl disable abrt-ccpp.service
systemctl disable abrtd.service
注意我们这里有一些系统服务会报Failed to stop或者disable unit: Unit file xxxxxx.service does not exist.这是因为我们没有安装这个系统服务,可以忽略
关闭swap交换内存
关闭swap交换内存是为了保障数据库的访问性能,避免把数据库的缓冲区内存淘汰到磁盘上。 如果服务器内存比较小,内存过载时,可打开swap交换内存保障正常运行。
#临时关闭swap
swapoff -a
修改/etc/fstab
#永久swap交换内存,删除SWAP mount信息
cp /etc/fstab /etc/fstab.bak
sed -i '/swap/s/^/#/' /etc/fstab
cat /etc/fstab|grep -v ^#|grep -v '^$'
检查:
free -m
关闭selinux
setenforce 0
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
limit.conf限制
- soft nofile
表示软限制,即表示任何用户能打开的最大文件数量为1000000,不管它开启多少个shell。 - hard nofile
表示硬限制,软限制要小于等于硬限制。 - soft nproc
参数用来限制每个用户的最大processes数量。
echo "* soft nofile 1000000" >> /etc/security/limits.conf
echo "* hard nofile 1000000" >> /etc/security/limits.conf
echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf
关闭透明大页THP特性
cat >> /etc/rc.d/rc.local <<EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled;
then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag;
then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod +x /etc/rc.d/rc.local
reboot
重启后确认
cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
cat /sys/kernel/mm/transparent_hugepage/defrag
always defer defer+madvise madvise [never]
返回都是[never]说明关闭成功
系统环境变量
修改系统环境变量
vi /etc/profile
在最后添加export LANG=en_US.UTF-8
保存并退出:wq
设置网卡MTU值
对于x86,MTU值推荐1500。这里我们是x86系统默认不需要修改
对于ARM,MTU值推荐8192。
ifconfig 网卡编号 mtu 值
#临时修改
ifconfig ens33 mtu 1500 up
#永久修改
vi /etc/sysconfig/network-scripts/ifcfg-ens33
添加
MTU=1500
systemctl restart network
操作系统用户
groupadd dbgrp
useradd -g dbgrp -m omm
echo omm | passwd --stdin omm
文件规划存放
安装系统依赖包
yum install -y libaio-devel gcc gcc-c++ zlib-devel expect numactl flex bison ncurses-devel patch readline-devel glibc psmisc bzip2 libffi-devel
python 3.7+(如果是基于openEuler操作系统,不需要单独安装)
安装前确认主备集群中所有节点服务器能够正常执行python3指令,同时检查python3版本。
安装python3.7
tar -xvf Python-3.7.10.tar.xz
cd Python-3.7.10/
./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPIC
make && make install
#设置python3软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
cp /usr/local/python3/lib/libpython3.7m.so.1.0 /usr/lib64
检查python3版本
python3 -V
Python 3.11.6
注意我们这里是openEuler操作系统不用单独安装,检查即可
解决libreadline.so文件报错(如果是基于非openEuler操作系统,不需要单独设置软连接)
[root@og1 ~]# find / -name 'libreadline.so*'
/usr/lib64/libreadline.so.8.2
/usr/lib64/libreadline.so.8
/usr/lib64/libreadline.so
[root@og1 ~]# ln -sv /usr/lib64/libreadline.so.8 /usr/lib64/libreadline.so.7
'/usr/lib64/libreadline.so.7' -> '/usr/lib64/libreadline.so.8'
[root@og1 ~]#
[root@og2 ~]# find / -name 'libreadline.so*'
/usr/lib64/libreadline.so.8
/usr/lib64/libreadline.so
/usr/lib64/libreadline.so.8.2
[root@og2 ~]# ln -sv /usr/lib64/libreadline.so.8 /usr/lib64/libreadline.so.7
'/usr/lib64/libreadline.so.7' -> '/usr/lib64/libreadline.so.8'
[root@og2 ~]#
以上所有操作均需要在所有节点执行
时区配置
检查系统时区
timedatectl | grep "Time zone"
查看原始状态
timedatectl |grep "Time zone"
Time zone: Asia/Shanghai (CST, +0800)
修改
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
关闭RemoveIPC
vi /etc/systemd/logind.conf
#修改
RemoveIPC=no
vi /usr/lib/systemd/system/systemd-logind.service
#修改
RemoveIPC=no
#重新加载配置参数
systemctl daemon-reload
systemctl restart systemd-logind
#检查修改是否生效
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC
设置/etc/hosts
cat >> /etc/hosts <<EOF
192.168.17.7 og1
192.168.17.8 og2
EOF
主节点创建数据库软件目录
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software
安装opengauss数据库软件
数据库软件安装,如没有特殊说明,均在主节点执行,执行用户为root
上传安装文件
上传安装文件openGauss-All-7.0.0-RC1-openEuler24.03-x86_64.tar.gz到/opt/software/openGauss 目录下解压
[root@og1 ~]# cd /opt/software/openGauss/
[root@og1 openGauss]# ll -h
total 148M
-rw-r--r-- 1 root root 148M Apr 1 09:07 openGauss-All-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
[root@og1 openGauss]# tar -zxf openGauss-All-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
[root@og1 openGauss]# tar -zxf openGauss-OM-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
[root@og1 openGauss]# tar -zxf openGauss-CM-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
[root@og1 openGauss]# ls -lh
total 296M
drwxr-xr-x 2 root root 4.0K Mar 28 10:56 bin
drwxr-xr-x 20 root root 4.0K Mar 28 10:56 lib
-rw-r--r-- 1 root root 148M Apr 1 09:07 openGauss-All-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
-rw-r--r-- 1 root root 0 Mar 28 10:56 openGauss-CM-7.0.0-RC1-openEuler24.03-x86_64.sha256
-rw-r--r-- 1 root root 22M Mar 28 10:56 openGauss-CM-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
-rw-r--r-- 1 root root 65 Mar 28 10:54 openGauss-OM-7.0.0-RC1-openEuler24.03-x86_64.sha256
-rw-r--r-- 1 root root 17M Mar 28 10:54 openGauss-OM-7.0.0-RC1-openEuler24.03-x86_64.tar.gz
-rw-r--r-- 1 root root 65 Mar 28 10:56 openGauss-Server-7.0.0-RC1-openEuler24.03-x86_64.sha256
-rw-r--r-- 1 root root 110M Mar 28 10:56 openGauss-Server-7.0.0-RC1-openEuler24.03-x86_64.tar.bz2
drwxr-xr-x 11 root root 4.0K Mar 28 10:54 script
drwxr-xr-x 3 root root 4.0K Mar 28 10:56 share
drwxr-xr-x 3 root root 4.0K Mar 28 10:56 tool
-rw------- 1 root root 65 Mar 28 10:53 upgrade_sql.sha256
-rw------- 1 root root 663K Mar 28 10:53 upgrade_sql.tar.gz
-rw-r--r-- 1 root root 39 Mar 28 10:54 version.cfg
[root@og1 openGauss]#
创建XML配置文件
[root@og1 openGauss]# vi /opt/software/openGauss/cluster_config.xml
[root@og1 openGauss]# cat /opt/software/openGauss/cluster_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CLUSTER>
<PARAM name="clusterName" value="og" />
<PARAM name="nodeNames" value="og1,og2" />
<PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />
<PARAM name="gaussdbLogPath" value="/var/log/omm" />
<PARAM name="tmpMppdbPath" value="/opt/huawei/tmp"/>
<PARAM name="gaussdbToolPath" value="/opt/huawei/install/om" />
<PARAM name="corePath" value="/opt/huawei/corefile"/>
<PARAM name="backIp1s" value="192.168.17.7,192.168.17.8"/>
</CLUSTER>
<DEVICELIST>
<DEVICE sn="og1">
<PARAM name="name" value="og1"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<PARAM name="backIp1" value="192.168.17.7"/>
<PARAM name="sshIp1" value="192.168.17.7"/>
<PARAM name="sshPort" value="22"/>
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="15400"/>
<PARAM name="dataNode1" value="/opt/huawei/install/data/dn,og2,/opt/huawei/install/data/dn"/>
<PARAM name="dataNode1_syncNum" value="0"/>
</DEVICE>
<DEVICE sn="og2">
<PARAM name="name" value="og2"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<PARAM name="backIp1" value="192.168.17.8"/>
<PARAM name="sshIp1" value="192.168.17.8"/>
<PARAM name="sshPort" value="22"/>
</DEVICE>
</DEVICELIST>
</ROOT>
[root@og1 openGauss]#
预安装
在script目录下执行./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml,在安装过程中请输入root,omm两个用户的密码
[root@og7host1 openGauss]# cd script/
[root@og1 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)?yes
Please enter password for root
Please enter password for current user[root].
Password:
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Distributing trust keys file to all node successfully.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Verifying SSH trust on all hosts by ip.
Successfully verified SSH trust on all hosts by ip.
Verifying SSH trust on all hosts by hostname.
Successfully verified SSH trust on all hosts by hostname.
Successfully verified SSH trust on all hosts.
Start set cron for root
Successfully to set cron for root
Successfully created SSH trust.
Successfully created SSH trust for the root permission user.
Setting host ip env
Successfully set host ip env.
Distributing package.
Begin to distribute package to tool path.
Successfully distribute package to tool path.
Begin to distribute package to package path.
Successfully distribute package to package path.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Preparing SSH service.
Successfully prepared SSH service.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Please enter password for current user[omm].
Password:
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Distributing trust keys file to all node successfully.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Verifying SSH trust on all hosts by ip.
Successfully verified SSH trust on all hosts by ip.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [omm] user.
Checking OS software.
Successfully check OS software.
Checking OS version.
Successfully checked OS version.
Checking cpu instructions.
Successfully checked cpu instructions.
Creating cluster's path.
Successfully created cluster's path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h og1,og2 -X /opt/software/openGauss/cluster_config.xml --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
[root@og1 script]# /opt/software/openGauss/script/gs_checkos -i A -h og1,og2 -X /opt/software/openGauss/cluster_config.xml --detail
Checking items:
A1. [ OS version status ] : Normal
[og1]
openEuler_24.03_64bit
[og2]
openEuler_24.03_64bit
A2. [ Kernel version status ] : Normal
The names about all kernel versions are same. The value is "6.6.0-72.0.0.76.oe2403sp1.x86_64".
A3. [ Unicode status ] : Normal
The values of all unicode are same. The value is "LANG=en_US.UTF-8".
A4. [ Time zone status ] : Normal
The informations about all timezones are same. The value is "+0800".
A5. [ Swap memory status ] : Normal
The value about swap memory is correct.
A6. [ System control parameters status ] : Normal
All values about system control parameters are correct.
A7. [ File system configuration status ] : Normal
Both soft nofile and hard nofile are correct.
A8. [ Disk configuration status ] : Normal
The value about XFS mount parameters is correct.
A9. [ Pre-read block size status ] : Normal
The value about Logical block size is correct.
A10.[ IO scheduler status ] : Normal
The value of IO scheduler is correct.
A11.[ Network card configuration status ] : Warning
[og2]
BondMode Null
Warning reason: network 'ens33' 'mtu' RealValue '1500' ExpectedValue '8192'
[og1]
BondMode Null
Warning reason: network 'ens33' 'mtu' RealValue '1500' ExpectedValue '8192'
A12.[ Time consistency status ] : Normal
The system time is consistent.
A13.[ Firewall service status ] : Normal
The firewall service is stopped.
A14.[ THP service status ] : Normal
The THP service is stopped.
Total numbers:14. Abnormal numbers:0. Warning numbers:1.
[root@og1 script]#
注意这里操作系统网卡mtu1500值告警可以忽略
切换用户执行安装
su – omm
gs_install -X /opt/software/openGauss/cluster_config.xml
数据库密码输入huawei@123
[root@og1 script]# su - omm
Last login: Tue Apr 1 09:27:49 CST 2025
Welcome to 6.6.0-72.0.0.76.oe2403sp1.x86_64
System information as of time: Tue Apr 1 09:30:05 AM CST 2025
System load: 0.10
Memory used: 3.5%
Swap used: 0.0%
Usage On: 10%
IP address: 192.168.17.7
Users online: 2
To run a command as administrator(user "root"),use "sudo <command>".
[omm@og1 ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully checked gs_uninstall on every node.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/huawei/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Successfully check consistence of memCheck and coresCheck on all nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
[omm@og1 ~]$
至此我们已经安装完毕
登陆验证
[omm@og1 ~]$ gsql -d postgres -p 15400
gsql ((openGauss 7.0.0-RC1 build cff7b04d) compiled at 2025-03-28 10:40:19 commit 0 last mr release)
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=# select version();
version
--------------------------------------------------------------------------------------------------------------------
openGauss 7.0.0-RC1 (openGauss 7.0.0-RC1 build cff7b04d) compiled at 2025-03-28 10:40:19 commit 0 last mr release
(1 row)
openGauss=#
查看主从状态
gs_ctl -D /opt/huawei/install/data/dn/ query
gs_om -t status --detail
[omm@og1 ~]$ gs_ctl -D /opt/huawei/install/data/dn/ query
[2025-04-01 09:37:25.864][77054][][gs_ctl]: gs_ctl query ,datadir is /opt/huawei/install/data/dn
HA state:
local_role : Primary
static_connections : 1
db_state : Normal
detail_information : Normal
Senders info:
sender_pid : 73994
local_role : Primary
peer_role : Standby
peer_state : Normal
state : Streaming
sender_sent_location : 0/40005C8
sender_write_location : 0/40005C8
sender_flush_location : 0/40005C8
sender_replay_location : 0/40005C8
receiver_received_location : 0/40005C8
receiver_write_location : 0/40005C8
receiver_flush_location : 0/40005C8
receiver_replay_location : 0/40005C8
sync_percent : 100%
sync_state : Quorum
sync_priority : 1
sync_most_available : Off
channel : 192.168.17.7:15401-->192.168.17.8:52064
Receiver info:
No information
[omm@og1 ~]$ gs_om -t status --detail
[ Cluster State ]
cluster_state : Normal
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
nodenode_ip port instance state
------------------------------------------------------------------------------------------
1 og1 192.168.17.7 15400 6001 /opt/huawei/install/data/dn P Primary Normal
2 og2 192.168.17.8 15400 6002 /opt/huawei/install/data/dn S Standby Normal
[omm@og1 ~]$
数据库参数调优
#内存相关参数
gs_guc set -I all -N all -c "max_process_memory=5GB"
gs_guc set -I all -N all -c "shared_buffers=1GB"
gs_guc set -I all -N all -c "work_mem=16MB"
gs_guc set -I all -N all -c "maintenance_work_mem=256MB"
gs_guc set -I all -N all -c "cstore_buffers=16MB"
gs_guc set -I all -N all -c "wal_buffers=1GB"
gs_guc set -I all -N all -c "local_syscache_threshold=32MB"
gs_guc set -I all -N all -c "standby_shared_buffers_fraction=1"
#连接访问相关参数
gs_guc set -I all -N all -c "max_connections=1000"
gs_guc set -I all -N all -c "max_prepared_transactions=1000"
gs_guc set -I all -N all -c "listen_addresses = '*'"
gs_guc set -I all -N all -c "remote_read_mode=non_authentication"
gs_guc set -I all -N all -c "password_encryption_type=1"
gs_guc set -I all -N all -c "password_reuse_time=0"
gs_guc set -I all -N all -c "password_lock_time=0"
gs_guc set -I all -N all -c "password_effect_time=0"
gs_guc set -I all -N all -c "session_timeout=0"
#wal相关参数
gs_guc set -I all -N all -c "wal_level=logical"
gs_guc set -I all -N all -c "full_page_writes=off"
gs_guc set -I all -N all -c "wal_log_hints=off"
gs_guc set -I all -N all -c "xloginsert_locks=48"
gs_guc set -I all -N all -c "advance_xlog_file_num=10"
#复制相关参数
gs_guc set -I all -N all -c "synchronous_commit=on"
gs_guc set -I all -N all -c "wal_keep_segments=1024"
gs_guc set -I all -N all -c "max_wal_senders=16"
gs_guc set -I all -N all -c "recovery_max_workers=4"
gs_guc set -I all -N all -c "most_available_sync=on"
gs_guc set -I all -N all -c "max_size_for_xlog_prune=104857600"
gs_guc set -I all -N all -c "catchup2normal_wait_time=0"
gs_guc set -I all -N all -c "enable_slot_log=on"
gs_guc set -I all -N all -c "max_replication_slots=32"
gs_guc set -I all -N all -c "wal_receiver_timeout=60s"
gs_guc set -I all -N all -c "sync_config_strategy=none_node"
#日志相关参数
gs_guc set -I all -N all -c "logging_collector=on"
gs_guc set -I all -N all -c "log_duration=on"
gs_guc set -I all -N all -c "log_line_prefix='%m %u %d %r %p %S'"
gs_guc set -I all -N all -c "log_checkpoints=on"
gs_guc set -I all -N all -c "plog_merge_age=0"
mkdir -p /opt/huawei/install/archive
gs_guc set -I all -N all -c "archive_dest='/opt/huawei/install/archive'"
#性能统计相关参数
gs_guc set -I all -N all -c "vacuum_cost_limit=1000"
gs_guc set -I all -N all -c "autovacuum_max_workers=10"
gs_guc set -I all -N all -c "autovacuum_naptime=20s"
gs_guc set -I all -N all -c "autovacuum_vacuum_cost_delay=10"
gs_guc set -I all -N all -c "autovacuum_vacuum_scale_factor=0.05"
gs_guc set -I all -N all -c "autovacuum_analyze_scale_factor=0.02"
gs_guc set -I all -N all -c "autovacuum_vacuum_threshold=200"
gs_guc set -I all -N all -c "autovacuum_analyze_threshold=200"
gs_guc set -I all -N all -c "autovacuum_io_limits=104857600"
gs_guc set -I all -N all -c "instr_unique_sql_count=20000"
gs_guc set -I all -N all -c "enable_save_datachanged_timestamp=off"
gs_guc set -I all -N all -c "track_sql_count=off"
gs_guc set -I all -N all -c "enable_instr_rt_percentile=off"
gs_guc set -I all -N all -c "enable_instance_metric_persistent=off"
gs_guc set -I all -N all -c "enable_logical_io_statistics=off"
gs_guc set -I all -N all -c "enable_user_metric_persistent=off"
gs_guc set -I all -N all -c "enable_mergejoin=on"
gs_guc set -I all -N all -c "enable_nestloop=on"
gs_guc set -I all -N all -c "enable_pbe_optimization=off"
gs_guc set -I all -N all -c "enable_resource_track=on"
gs_guc set -I all -N all -c "enable_wdr_snapshot=on"
gs_guc set -I all -N all -c "instr_unique_sql_count=5000"
#客户端白名单
gs_guc set -I all -N all -h "host all all 0.0.0.0/0 sha256"
#其他参数
gs_guc set -I all -N all -c "checkpoint_segments=1024"
gs_guc set -I all -N all -c "checkpoint_completion_target=0.8"
gs_guc set -I all -N all -c "pagewriter_sleep=200"
gs_guc set -I all -N all -c "enable_alarm=off"
gs_guc set -I all -N all -c "enable_codegen=off"
gs_guc set -I all -N all -c "audit_enabled=on"
gs_guc set -I all -N all -c "enable_asp=off"
gs_guc set -I all -N all -c "lc_messages='en_US.UTF-8'"
gs_guc set -I all -N all -c "lc_monetary='en_US.UTF-8'"
gs_guc set -I all -N all -c "lc_numeric='en_US.UTF-8'"
gs_guc set -I all -N all -c "lc_time='en_US.UTF-8'"
gs_guc set -I all -N all -c "update_lockwait_timeout=1min"
gs_guc set -I all -N all -c "lockwait_timeout=1min"
gs_guc set -I all -N all -c "max_files_per_process=100000"
gs_guc set -I all -N all -c "behavior_compat_options='display_leading_zero'"
gs_guc set -I all -N all -c "enable_thread_pool=off"
重启数据库集群服务
gs_om -t stop
gs_om -t start
[omm@og1 ~]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
[omm@og1 ~]$ gs_om -t status --detail
[ Cluster State ]
cluster_state : Unavailable
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
nodenode_ip port instance state
------------------------------------------------------------------------------------------
1 og1 192.168.17.7 15400 6001 /opt/huawei/install/data/dn P Down Manually stopped
2 og2 192.168.17.8 15400 6002 /opt/huawei/install/data/dn S Down Manually stopped
[omm@og1 ~]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] og1
2025-04-01 09:44:11.552 67eb44eb.1 [unknown] 139921684286016 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2025-04-01 09:44:11.553 67eb44eb.1 [unknown] 139921684286016 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4529 Mbytes) is larger.
[SUCCESS] og2
2025-04-01 09:44:13.555 67eb44ed.1 [unknown] 139760136251968 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2025-04-01 09:44:13.556 67eb44ed.1 [unknown] 139760136251968 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4529 Mbytes) is larger.
=========================================
Successfully started.
[omm@og1 ~]$ gs_om -t status --detail
[ Cluster State ]
cluster_state : Normal
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
nodenode_ip port instance state
------------------------------------------------------------------------------------------
1 og1 192.168.17.7 15400 6001 /opt/huawei/install/data/dn P Primary Normal
2 og2 192.168.17.8 15400 6002 /opt/huawei/install/data/dn S Standby Normal
[omm@og1 ~]$
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)