一、系統(tǒng)環(huán)境優(yōu)化
1.1?關(guān)閉SELINUX
# 修改配置文件
cat /etc/selinux/config | grep -i SELINUX
SELINUX=disabled
# 關(guān)閉SELINUX
setenforce 0
1.2 內(nèi)核參數(shù)優(yōu)化
vi /etc/sysctl.conf 添加
# panweidb
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_retries2 = 12
vm.overcommit_memory = 0
net.ipv4.tcp_rmem = 8192 250000 16777216
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.ip_local_port_range = 26000 65535
kernel.sem = 250 6400000 1000 25600
net.core.somaxconn = 65535
net.ipv4.tcp_syncookies = 1
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_fin_timeout = 60
kernel.shmall = 1073741824
kernel.shmmax = 751619276800
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
vm.extfrag_threshold = 500
vm.overcommit_ratio = 90
vm.swappiness = 0
# 生效
sysctl -p
注意事項(xiàng):
1.3 配置資源限制
vi /etc/security/limits.conf 添加
# panweidb
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 655360
* hard nproc 655360
* soft memlock unlimited
* hard memlock unlimited
* soft core unlimited
* hard core unlimited
* soft stack unlimited
* hard stack unlimited
1.4 創(chuàng)建用戶omm和組dbgrp
groupadd -g 1101 dbgrp
useradd -g dbgrp -u 1101 -m omm
echo 'O2********1!'|passwd --stdin omm
創(chuàng)建目錄
mkdir -p /opt/panweidb
1.5 安裝數(shù)據(jù)庫(kù)依賴包
注意事項(xiàng):
1)libnsl 包在BCLinux8.2 系統(tǒng)中需要安裝。Centos7 環(huán)境和 BC-Linux7.6、BC-Linux7.8環(huán)境中不用安裝
yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel python3 expect* bzip2 libnsl gcc gcc-c++ zlib-devel ncurses-devel expect
1.6 配置python3(集群版要求,單機(jī)版可能不需要)
檢查python3
下載地址:https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
# 檢查 python3 版本,如果為 Python 3.6.9 則滿足要求,如果不滿足則需進(jìn)行編譯安裝
python3 --version
[root@work2 yum.repos.d]# python3 --version
Python 3.6.8
[root@work2 yum.repos.d]#
# 從下載安裝包
tar -zxf Python-3.6.9.tgz
cd Python-3.6.9
./configure --prefix=/opt/python/Python-3.6.9 --enable-shared --enable-optimizations --with-ssl
make -j 12 && make install
ln -s /opt/python/Python-3.6.9/bin/python3 /usr/bin/python3
ln -s /opt/python/Python-3.6.9/bin/python3.6-config /usr/bin/python3-config
cp /opt/python/Python-3.6.9/lib/libpython3.6m.so.1.0 /usr/lib64
chmod -R 755 /usr/lib64/libpython3.6m.so.1.0
ln -s /usr/lib64/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m.so
cat >> /etc/profile <<-EOF
export PYTHON_HOME=/opt/python/Python-3.6.9
export PATH=$PYTHON_HOME/bin:$PATH
EOF
source /etc/profile
二、磐維數(shù)據(jù)庫(kù)panweidb安裝
-
使用omm用戶登錄到openGauss包安裝的主機(jī),解壓openGauss壓縮包到安裝目錄(假定安裝目錄為/opt/panweidb/soft,請(qǐng)用實(shí)際值替換)。
tar -xf PanWeiDB_1.0.0_CentOS7_x86.tar.gz tar -jxf PanWeiDB-1.0.0-CentOS-64bit.tar.bz2 -C /opt/panweidb/soft
-
假定解壓包的路徑為/opt/panweidb/soft,進(jìn)入解壓后目錄下的simpleInstall。
cd /opt/panweidb/soft/simpleInstall
-
執(zhí)行install.sh腳本安裝openGauss。
sh install.sh -w "強(qiáng)密碼" && source ~/.bashrc
-
上述命令中,-w是指初始化數(shù)據(jù)庫(kù)密碼(gs_initdb指定),安全需要必須設(shè)置。
-
安裝執(zhí)行完成后,使用ps和gs_ctl查看進(jìn)程是否正常。
ps ux | grep gaussdb gs_ctl query -D /opt/panweidb/soft/data/single_node
執(zhí)行ps命令,顯示類似如下信息:
[omm@work2 simpleInstall]$ ps ux | grep gaussdb omm 1576 4.5 2.7 3029804 444624 ? Ssl 11:13 0:04 /opt/panweidb/soft/bin/gaussdb -D /opt/panweidb/soft/data/single_node omm 2591 0.0 0.0 110492 904 pts/1 S+ 11:15 0:00 grep --color=auto gaussdb [omm@work2 simpleInstall]$ gs_ctl query -D /opt/panweidb/soft/data/single_node [2023-05-24 11:16:55.542][3360][][gs_ctl]: gs_ctl query ,datadir is /opt/panweidb/soft/data/single_node HA state: local_role : Normal static_connections : 0 db_state : Normal detail_information : Normal Senders info: No information Receiver info: No information [omm@work2 simpleInstall]$ 連接數(shù)據(jù)庫(kù) ? [omm@work2 ~]$ gsql -d postgres gsql ((PanWeiDB(openGauss) 1.0.0 build 9a7e96bc) compiled at 2022-10-15 20:54:36 commit 0 last mr ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. PanWeiDB=#
三、創(chuàng)建和使用數(shù)據(jù)庫(kù)
a.創(chuàng)建用戶USER
CREATE USER testza IDENTIFIED BY 'she********sa';
b. 使用如下命令創(chuàng)建一個(gè)新的表空間testzaq_tbs,并將表空間escspdb_tbs授權(quán)給用戶testzaq
CREATE TABLESPACE testza_tbs OWNER testza RELATIVE LOCATION 'tablespace/testza_tbs1';
c. 使用如下命令創(chuàng)建一個(gè)新的數(shù)據(jù)庫(kù)escspdb,放在使用escspdb_tbs表空間中。
CREATE DATABASE testza WITH TABLESPACE = testza_tbs;
d.授權(quán)用戶testza訪問(wèn)數(shù)據(jù)庫(kù)testza
grant all privileges on database testza to testza;
e.使用以下命令為數(shù)據(jù)庫(kù)設(shè)置默認(rèn)的模式搜索路徑。
ALTER DATABASE testza SET search_path TO pa_catalog,public;
f.使用如下命令修改數(shù)據(jù)庫(kù)表空間
ALTER DATABASE testza SET TABLESPACE testza_tbs;
g.測(cè)試數(shù)據(jù)庫(kù)連接
gsql -d testza -U testza -W 'she********sa' -r
四、開(kāi)啟遠(yuǎn)程訪問(wèn)數(shù)據(jù)庫(kù)
4.1 修改加密模式
在PostgreSQL數(shù)據(jù)庫(kù)目錄下的編輯postgresql.conf,修改password_encryption_type 為1,同時(shí)支持md5和sha256
password_encryption_type = 1
4.2 開(kāi)啟遠(yuǎn)程訪問(wèn)
在PostgreSQL數(shù)據(jù)庫(kù)目錄下的postgresql.conf文件更改此項(xiàng)參數(shù),并且重啟數(shù)據(jù)庫(kù)生效
listen_addresses = '*'
4.3 開(kāi)啟pg_hba.conf防火墻,放開(kāi)IP
host all all 10.1.161.184/32 sha256
4.4 使用navicat 進(jìn)行連接測(cè)試,反饋成功
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-461981.html
參考:單節(jié)點(diǎn)服務(wù)器安裝單節(jié)點(diǎn)服務(wù)器安裝 創(chuàng)建用戶組dbgroup。groupadd dbgroup 創(chuàng)建用戶組dbgroup下的普通用戶omm,并設(shè)置普通用戶omm的密碼,密碼建議設(shè)置為omm@123。useradd -g dbgroup omm passwd omm 使用omm用戶登錄到openGauss包安裝的主機(jī),解壓openGauss壓縮包到安裝目錄(假定安裝目錄為/opt/software/openGauss,請(qǐng)用實(shí)際值替換)。tar -jxf openGauss-x.x.x-操作系統(tǒng)-64bit.tar.bz2 -C /opt/software/openGauss 假定解壓包的路徑為/opt/software/openGauss,進(jìn)入解壓后目錄下的simpleInstall。cd /opt/software/openGauss/simpleInstall 執(zhí)行install.sh腳本安裝openGauss。sh install.sh -w xxxx 上述命令中,-w是指初始化數(shù)據(jù)庫(kù)密碼(gs_initdb指定),安全需要必須設(shè)置。安裝執(zhí)行完成后,使用ps和gs_ctl查看進(jìn)程是否正常。ps ux | grep gaussdb gs_ctl query -D /opt/software/openGauss/data/single_node 執(zhí)行ps命令,顯示類似如下信息:omm 24209 11.9 1.0 1852000 355816 pts/0 Sl 01:54 0:33 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/single_node omm 20377 0.0 0.0 119880 1216 pts/0 S+ 15:37 0:00 grep --color=auto gaussdb 執(zhí)行g(shù)s_ctl命令,顯示類似如下信息:gs_ctl query ,datadir is /opt/software/openGauss/data/single_node HA state: local_role : Normal static_connections : 0 db_state : Normal detail_information : Normal Senders info: No information Receiver info: No information https://docs.opengauss.org/zh/docs/5.0.0/docs/GettingStarted/%E5%8D%95%E8%8A%82%E7%82%B9%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%AE%89%E8%A3%85.html文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-461981.html
到了這里,關(guān)于磐維數(shù)據(jù)庫(kù)panweidb單節(jié)點(diǎn)服務(wù)器在centos7.9安裝(研發(fā)環(huán)境)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!