openGauss数据库下载地址如下:
https://opengauss.org/zh/download.html
目录规划
目录名称 | 所属用户 | 目录路径 | 权限 |
数据库软件目录 | omm | /opt/openGauss | 755 |
数据库数据目录 | omm | /data/openGauss | 700 |
数据库备份目录 | omm | /data/backup | 700 |
数据库归档目录 | omm | /data/archive_wals | 700 |
数据库core_dump目录 | omm | /data/core_pattern/ | 700 |
1.查看系统环境
[root@ccf03 ~]# lscpu
[root@ccf03 ~]# cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Sword)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Sword)"
ANSI_COLOR="0;31"
2.安装前环境配置
2.1修改主机名
hostnamectl set-hostname ccf03
2.2关闭防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
2.3selinux设置
vim /etc/selinux/config
将SELINUX=enforcing修改为SELINUX=disabled
2.4关闭transparent_hugepage(未成功)
echo "transparent_hugepage=never">> /etc/default/grub
重新生成引导
grub2-mkconfig -o /boot/grub2/grub.cfg
重启主机
reboot
再次检查
[root@ccf03 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[root@ccf03 ~]# grep -i huge /proc/meminfo
2.5IPC参数设置
[root@ccf03 ~]# echo "RemoveIPC=no">> /etc/systemd/logind.conf
[root@ccf03 ~]# echo "RemoveIPC=no">> /usr/lib/systemd/system/systemd-logind.service
[root@ccf03 ~]# systemctl daemon-reload
[root@ccf03 ~]# systemctl stop systemd-logind
[root@ccf03 ~]# systemctl start systemd-logind
2.6内核参数调整/etc/sysctl.conf添加以下内容
[root@ccf03 ~]# vi /etc/sysctl.conf
net.ipv4.tcp_max_tw_buckets=10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_keepalive_probes=9
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_retries1 = 5 #默认为3
net.ipv4.tcp_syn_retries = 5 #默认为6
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_retries2 = 12 #默认为15
net.ipv4.tcp_rmem = 8192 250000 16777216
vm.overcommit_memory = 0
net.ipv4.tcp_wmem = 8192 250000 16777216
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
fs.aio-max-nr=1048576
fs.file-max= 76724600
kernel.sem = 4096 2147483647 2147483646 512000
kernel.shmall = 1048576 # page, 80% MEM
kernel.shmmax = 4294967296 # bytes, 80% MEM
kernel.shmmni = 819200
net.core.netdev_max_backlog = 65535
net.core.somaxconn = 65535
net.ipv4.tcp_fin_timeout = 60
vm.swappiness = 0
net.ipv4.ip_local_port_range = 26000 65535
fs.nr_open = 20480000
2.7时区配置,如果不是CST建议调整
[root@ccf03 ~]# cat /etc/localtime
2.8创建用户与目录
groupadd -g 1000 dbgrp
useradd -u 1000 omm -g dbgrp
echo "Omm@1000"|passwd omm --stdin
mkdir -p /data/{openGauss,backup,archive_wals,core_pattern}
chmod 700 /data/{openGauss,backup,archive_wals,core_pattern}
chown -R omm:dbgrp /data/{openGauss,backup,archive_wals,core_pattern}
mkdir -p /opt/openGauss
chown omm:dbgrp -R /opt/openGauss/
chmod 755 /opt/openGauss/
2.9修改资源限制/etc/security/limits.conf添加以下内容
[root@ccf03 ~]# vi /etc/security/limits.conf
omm soft nproc unlimited
omm hard nproc unlimited
omm soft nofile 102400
omm hard nofile 102400
omm soft stack unlimited
omm hard stack unlimited
omm soft core unlimited
omm hard core unlimited
omm soft memlock unlimited
2.10core_pattern设置
[root@ccf03 ~]# cat /proc/sys/kernel/core_pattern
[root@ccf03 ~]# echo "/data/core_pattern/core-%e-%p-%t"> /proc/sys/kernel/core_pattern
2.11配置yum源并安装依赖包
umount /dev/sr0
mount /dev/sr0 /mnt
[root@ccf03 yum.repos.d]# vi /etc/yum.repos.d/kylin_x86_64.repo
###Kylin Linux Advanced Server 10 - os repo###
[local]
name=Kylin Linux Advanced Server 10
baseurl=file:///mnt
enabled=1
gpgcheck=0
gpgkey=file:///mnt/RPM-GPG-KEY-kylin
[root@ccf03 yum.repos.d]#yum repolist
[root@ccf03 yum.repos.d]#yum install -y zlib-devel libaio libuuid readline-devel krb5-libs libicu libxslt tcl perl openldap pam openssl-devel libxml2 python3
2.12修改默认python版本
[root@ccf03 script]# python -V
Python 2.7.18
[root@ccf03 script]# which python
/usr/bin/python
[root@ccf03 script]# mv /usr/bin/python /usr/bin/pythonbak
[root@ccf03 script]# ln -s /usr/bin/python3
python3 python3.7m python3-chardetect
python3.7 python3.7m-config python3-config
python3.7-config python3.7m-x86_64-config
[root@ccf03 script]# ln -s /usr/bin/python3 /usr/bin/python
[root@ccf03 script]#
[root@ccf03 script]# python -V
Python 3.7.9
3.数据库安装及启动
3.1解压文件及配置cluster_config.xml
[root@ccf03 ~]# cd /opt/openGauss/
[root@ccf03 openGauss]# mv /root/openGauss-3.0.0-openEuler-64bit-all.tar.gz ./
tar -zxvf openGauss-3.0.0-openEuler-64bit-all.tar.gz
tar -zxvf openGauss-3.0.0-openEuler-64bit-om.tar.gz
[root@ccf03 openGauss]# cp script/gspylib/etc/conf/cluster_config_template.xml /home/omm/cluster_config.xml
[root@ccf03 openGauss]# vi /home/omm/cluster_config.xml
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<CLUSTER>
<PARAM name="clusterName" value="openGauss" />
<PARAM name="nodeNames" value="ccf03"/>
<PARAM name="gaussdbAppPath" value="/opt/openGauss/app" />
<PARAM name="gaussdbLogPath" value="/var/log/omm" />
<PARAM name="tmpMppdbPath" value="/opt/openGauss/tmp"/>
<PARAM name="gaussdbToolPath" value="/opt/openGauss/install/om" />
<PARAM name="corePath" value="/opt/openGauss/corefile"/>
<PARAM name="backIp1s" value="192.168.6.200"/>
</CLUSTER>
<DEVICELIST>
<DEVICE sn="ccf03">
<PARAM name="name" value="ccf03"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<PARAM name="backIp1" value="192.168.6.200"/>
<PARAM name="sshIp1" value="192.168.6.200"/>
<!-- dn -->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="15400"/>
<PARAM name="dataNode1" value="/data/openGauss"/>
<PARAM name="dataNode1_syncNum" value="0"/>
</DEVICE>
</DEVICELIST>
</ROOT>
3.2执行预安装脚本
[root@ccf03 script]# ./gs_preinstall -U omm -G dbgrp -X /home/omm/cluster_config.xml
[root@ccf03 script]# chown omm:dbgrp -R /opt/openGauss/
3.3执行安装脚本
[root@ccf03 script]# su - omm
[omm@ccf03 ~]$ cd /opt/openGauss/script/
[omm@ccf03 script]$ ./gs_install -X /home/omm/cluster_config.xml
3.4安装完成,环境变量修改.bashrc添加以下内容
[omm@ccf03 script]$ cd
[omm@ccf03 ~]$ vi .bashrc
export PGPORT=5432 #改成前面cluster_config.xml配置的端口
export PGDATA=/data/openGauss
[omm@ccf03 ~]$ source .bashrc
3.5数据库参数配置$PGDATA/postgresql.conf(根据实际情况修改)
[omm@ccf03 ~]$ vi $PGDATA/postgresql.conf
max_process_memory = 4GB #75%MEM
shared_buffers = 2GB #25%MEM
maintenance_work_mem = 1024MB #64MB~20GB
3.6启动数据库
[omm@ccf03 ~]$ gs_ctl stop
[omm@ccf03 ~]$ gs_ctl start -D $PGDATA
#数据库状态检查
[omm@ccf03 ~]$ gs_ctl query
[2022-09-27 05:41:14.753][2867][][gs_ctl]: gs_ctl query ,datadir is /data/openGauss
HA state:
local_role : Normal
static_connections : 0
db_state : Normal
detail_information : Normal
Senders info:
No information
Receiver info:
No information
#测试连接
[omm@ccf03 ~]$ gsql -d postgres -p
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:19 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=#
文章被以下合辑收录
评论
