# 安装依赖包
yum -y install bzip2 python3 libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel net-tools
# 升级pip工具
pip3 install --upgrade pip
# 关闭色Linux和防火墙
vi /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled
systemctl disable firewalld.service
systemctl stop firewalld.service
# 关闭swap
swapoff -a
vi /etc/fstab
#/dev/mapper/centos_opengauss5--212-swap swap swap defaults 0 0
# 关闭logind的RemoveIPC
vi /etc/systemd/logind.conf
RemoveIPC=no
# 创建安装介质目录,解压安装介质
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software
mv openGauss-5.0.0-CentOS-64bit-all.tar.gz /opt/software/openGauss
mv /home/omm/cluster_config.xml /opt/software/openGauss
cd /opt/software/openGauss
tar zxvf openGauss-5.0.0-CentOS-64bit-all.tar.gz
tar zxvf openGauss-5.0.0-CentOS-64bit-om.tar.gz
# 最好手动配一下hosts,不配也可以,安装脚本会自动安装
vi /etc/hosts
192.168.14.212 opengauss5-212
# 可以不手动创建omm用户和dbgrp用户组,安装脚本会自动安装;
groupadd dbgrp
useradd omm -g dbgrp
# 如下python3的模块必须要装,使用普通用户不会有WARNING,使用root也可以。
su - omm
$ pip3 install psutil
$ pip3 install netifaces
$ pip3 install cffi
$ pip3 install pycparser
$ pip3 install cryptography
$ pip3 install pynacl
$ pip3 install bcrypt
$ pip3 install paramiko
# 禁用transparent_hugepage
vi /etc/default/grub
#GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos_opengauss5-212/root rd.lvm.lv=centos_opengauss5-212/swap rhgb quiet"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos_opengauss5-212/root rd.lvm.lv=centos_opengauss5-212/swap rhgb quiet transparent_hugepage=never"
grub2-mkconfig -o /boot/grub2/grub.cfg
# 调整内核参数
vi /etc/sysctl.d/99-sysctl.conf
net.ipv4.tcp_retries1=5
net.ipv4.tcp_syn_retries=5
# 调整limit限制参数
vi /etc/security/limits.conf
root soft nproc unlimited
omm soft nproc unlimited
root hard nproc unlimited
omm hard nproc unlimited
root soft nofile 1000000
omm soft nofile 1000000
root hard nofile 1000000
omm hard nofile 1000000
# 调整网卡参数
vi /etc/sysconfig/network-scripts/ifcfg-ens160
MTU="8192"
TX="4096"
RX="4096"
# 重启令 selinux等配置生效
reboot
# 执行验证查看是否环境是否准备好:没有Abnormal状态即可;Warning状态的可以处理可以不处理。
/opt/software/openGauss/script/gs_checkos -i A -h opengauss5-212 --detail
Checking items:
A1. [ OS version status ] : Normal
[opengauss5-212]
centos_7.6.1810_64bit
A2. [ Kernel version status ] : Normal
The names about all kernel versions are same. The value is "3.10.0-957.el7.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.
A11.[ Network card configuration status ] : Warning
[opengauss5-212]
BondMode Null
Warning reason: network 'ens160' 'rx' RealValue '4032' ExpectValue '4096'.
A12.[ Time consistency status ] : Warning
[opengauss5-212]
The NTPD not detected on machine and local time is "2023-07-06 21:06:59".
A13.[ Firewall service status ] : Normal
The firewall service is stopped.
A14.[ THP service status ] : Normal
The THP service is stopped.
Total numbers:13. Abnormal numbers:0. Warning numbers:2.
# root下执行预安装
cd /opt/software/openGauss/script
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
……
Preinstallation succeeded. #--- 表示预安装成功
# omm用户下执行安装
su - omm
$ gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Last time end with Start cluster.
Continue this step.
Successfully created the backup directory.
begin deploy..
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
# 验证是否安装成功:cluster_state : Normal
$ gs_om -t status
-----------------------------------------------------------------------
cluster_name : single
cluster_state : Normal
redistributing : No
-----------------------------------------------------------------------
# 访问
$ gsql -d postgres -p 15400
gsql ((openGauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=#
FAQ
#问题:执行pip3 install安装python模块失败
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ap19dhuq/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_g6qbyqx-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ap19dhuq/psutil/
#解决:
pip3 install --upgrade pip
#问题:执行pip3 install 输出告警
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#解决:
使用普通用户执行pip3 install
#问题:执行gs_install安装命令报错
Traceback (most recent call last):
File "/opt/huawei/install/om/script/local/Install.py", line 812, in <module>
functionDict[g_opts.action]()
File "/opt/huawei/install/om/script/local/Install.py", line 743, in startCluster
dn.start(self.time_out)
File "/opt/huawei/install/om/script/local/../gspylib/component/Kernel/Kernel.py", line 106, in start
"failure details." + "\n" + output)
Exception: [GAUSS-51607] : Failed to start instance. Error: Please check the gs_ctl log for failure details.
[2023-07-06 21:15:37.786][10670][][gs_ctl]: gs_ctl started,datadir is /opt/huawei/install/data/dn
[2023-07-06 21:15:37.894][10670][][gs_ctl]: waiting for server to start...
……
2023-07-06 21:15:38.181 64a6be79.1 [unknown] 139985881190656 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3543 Mbytes) is larger.
2023-07-06 21:15:38.181 64a6be79.1 [unknown] 139985881190656 [unknown] 0 dn_6001 42809 0 [BACKEND] FATAL: could not create shared memory segment: Cannot allocate memory
2023-07-06 21:15:38.181 64a6be79.1 [unknown] 139985881190656 [unknown] 0 dn_6001 42809 0 [BACKEND] DETAIL: Failed system call was shmget(key=15400001, size=3715893576, 03600).
2023-07-06 21:15:38.181 64a6be79.1 [unknown] 139985881190656 [unknown] 0 dn_6001 42809 0 [BACKEND] HINT: This error usually means that openGauss's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter. You can either reduce the request size or reconfigure the kernel with larger SHMALL. To reduce the request size (currently 3715893576 bytes), reduce openGauss's shared memory usage, perhaps by reducing shared_buffers.
The openGauss documentation contains more information about shared memory configuration.
2023-07-06 21:15:38.185 64a6be79.1 [unknown] 139985881190656 [unknown] 0 dn_6001 00000 0 [BACKEND] LOG: FiniNuma allocIndex: 0.
[2023-07-06 21:15:38.895][10670][][gs_ctl]: waitpid 10673 failed, exitstatus is 256, ret is 2
[2023-07-06 21:15:38.896][10670][][gs_ctl]: stopped waiting
[2023-07-06 21:15:38.896][10670][][gs_ctl]: could not start server
Examine the log output.
解决:主要是因为小马拉大车的原因
1、根据服务器内存配置适当的kernel.shmall和kernel.shmmax
2、$ vi /opt/huawei/install/data/dn/postgresql.conf
#max_process_memory = 2GB
max_process_memory = 3GB
#shared_buffers = 720MB # min 128kB
shared_buffers = 128MB # min 128kB
关注 M r . m a t e r i a l , \color{Violet} \rm Mr.material\ , Mr.material , 更 \color{red}{更} 更 多 \color{blue}{多} 多 精 \color{orange}{精} 精 彩 \color{green}{彩} 彩! 主要专栏内容包括: †《LAMMPS小技巧》: ‾ \textbf…