幫助中心
這里有最新的使用文檔和教程
openGauss是由華為開源的一款關系型數據庫,基于PostgreSQL數據庫開發。
操作系統:CentOS 7.x
官方網站:https://opengauss.org/zh/
下載地址:https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/x86/openGauss-3.1.0-CentOS-64bit-all.tar.gz
安裝前系統設置
1、關閉SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注釋掉
#SELINUXTYPE=targeted #注釋掉
SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效
2、開啟防火墻5432端口
CentOS 7.x默認使用的是firewall作為防火墻,這里改為iptables防火墻。
2.1、關閉firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啟動
systemctl mask firewalld
systemctl stop firewalld
yum remove firewalld
2.2、安裝iptables防火墻
yum install iptables-services #安裝
vi /etc/sysconfig/iptables #編輯防火墻配置文件
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重啟防火墻使配置生效
systemctl enable iptables.service #設置防火墻開機啟動
/usr/libexec/iptables/iptables.init restart #重啟防火墻
3、操作系統參數設置
cat>> /etc/sysctl.conf <<EOF
net.ipv4.tcp_retries1=5
net.ipv4.tcp_syn_retries=5
net.sctp.path_max_retrans=10
net.sctp.max_init_retransmits=10
kernel.shmmax = 17179869184
kernel.shmall = 4194304
kernel.sem= 500 5120000 2500 9000
EOF
lsmod |grep sctp
yum -y install lksctp*
modprobe sctp
sysctl -p #設置立即生效
echo 17179869184 > /proc/sys/kernel/shmmax
echo 4194304 > /proc/sys/kernel/shmall
echo "* soft stack 3072" >> /etc/security/limits.conf
echo "* hard stack 3072" >> /etc/security/limits.conf
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
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.d/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
/usr/bin/sh /etc/rc.d/rc.local
4、修改主機名稱
這里設置主機名為:opengauss-master
hostnamectl set-hostname opengauss-master #CentOS 7.x 8.x
vi /etc/hostname #編輯配置文件CentOS 7.x
opengauss-master #修改localhost.localdomain為opengauss-master
:wq! #保存退出
vi /etc/hosts #編輯配置文件
127.0.0.1 opengauss-master localhost #修改localhost.localdomain為opengauss-master
192.168.21.128 opengauss-master
:wq! #保存退出
5、設置操作系統字符集編碼
LANG=en_US.UTF-8
echo "LANG=en_US.UTF-8" >> /etc/profile
source /etc/profile
echo $LANG
6、設置時區同步時間
rm -rf /etc/localtime #先刪除默認的時區設置
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #替換上海/北京作為默認
yum install -y ntp #安裝ntp
ntpdate time1.aliyun.com #執行時間同步
hwclock --systohc #系統時鐘和硬件時鐘同步
7、安裝依賴包
yum install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb python3 bzip2
#服務器需要用到Python-3.x命令,但CentOS 7.x 默認版本Python-2.7.x,需要切換到Python-3.x版本
mv /usr/bin/python /usr/bin/python.bak
ln -s python3 /usr/bin/python
8、設置yum使用python2.7否則無法通過yum install安裝軟件
vi /usr/bin/yum
#!/usr/bin/python2.7
:wq! 保存退出
vi /usr/libexec/urlgrabber-ext-down
/usr/bin/python2.7
:wq! 保存退出
yum install telnet
#設置完成之后重啟下系統,繼續操作
安裝數據庫
1、上傳安裝包到目錄/usr/local/src/openGauss下面
2、安裝數據庫
<p style="margin: 0px 0px 10px; padding: 0px; border: 0px; font-size: 13px; background-image: initial; backg