From 022311a9ea9c347159b5e99353435b5862cb46c6 Mon Sep 17 00:00:00 2001
From: jia_junfeng1 <287523394@qq.com>
Date: Tue, 28 Jul 2020 09:23:15 +0800
Subject: [PATCH 1/2] replace 2 files about deployment
add file 'Multi instances deployment and uninstall of openGauss (CentOS7.6+openGauss 1.0.0).md'
modify config.toml
---
config.toml | 6 +-
...f openGauss (CentOS7.6+openGauss 1.0.0).md | 545 +++++++++++++++
...e-inst Deployment of openGauss Database.md | 622 ------------------
... Deployment (CentOS7.6+openGauss 1.0.0).md | 316 ++++++---
... Deployment (CentOS7.6+openGauss 1.0.0).md | 390 ++++++++---
5 files changed, 1083 insertions(+), 796 deletions(-)
create mode 100644 content/zh/post/jiajunfeng/Multi instances deployment and uninstall of openGauss (CentOS7.6+openGauss 1.0.0).md
delete mode 100644 content/zh/post/jiajunfeng/Single-inst Deployment of openGauss Database.md
diff --git a/config.toml b/config.toml
index ded0edaa..1bbcad92 100644
--- a/config.toml
+++ b/config.toml
@@ -11,7 +11,11 @@ languageCode = "en-us"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true
-
+[markup]
+ defaultMarkdownHandler = "goldmark"
+ [markup.goldmark]
+ [markup.goldmark.renderer]
+ unsafe = true
[taxonomies]
tag = "tags"
diff --git a/content/zh/post/jiajunfeng/Multi instances deployment and uninstall of openGauss (CentOS7.6+openGauss 1.0.0).md b/content/zh/post/jiajunfeng/Multi instances deployment and uninstall of openGauss (CentOS7.6+openGauss 1.0.0).md
new file mode 100644
index 00000000..7645d279
--- /dev/null
+++ b/content/zh/post/jiajunfeng/Multi instances deployment and uninstall of openGauss (CentOS7.6+openGauss 1.0.0).md
@@ -0,0 +1,545 @@
++++
+title = "openGauss 多实例安装部署与卸载 "
+date = "2020-07-29"
+tags = ["openGauss安装部署"]
+archives = "2020-07"
+author = "贾军锋"
+summary = "openGauss 多实例安装部署与卸载"
+img = "/zh/post/jiajunfeng/img/DBlogo-20200722.png"
+times = "19:00"
++++
+
+# **openGauss 多实例安装部署与卸载(CentOS 7.6+openGauss 1.0.0)**
+
+
+
+ 在数据库的使用过程中,必然存在"一机多用"的场景,以此节约采购成本和运营成本。在openGauss官方文档中描述到 “若为共用环境需加入–sep-env-file=ENVFILE参数分离环境变量避免与其他用户相互影响” ,那么使用该参数安装需要做哪些操作?如何实现环境变量分离?这些在文档中并没有找到合适的示例。
+ 本文主要针对该场景,对openGauss的一机多实例部署进行基本配置和测试,示例内容仅供参考。
+
+
+
+##### **实验环境:**
+
+
+ 条目 |
+ 内容 |
+
+
+ 操作系统 |
+ CentOS 7.6 x86_64 |
+
+
+ CPU |
+ 16c |
+
+
+ 内存 |
+ 32GB |
+
+
+ 主机名 |
+ db1.opengauss.com / db2.opengauss.com |
+
+
+ 外网IP地址 |
+ 192.168.124.11(主)/192.168.124.12(备) |
+
+
+ 后端IP地址 |
+ 192.168.100.11(主)/192..168.100.12(备) |
+
+
+
+
+
+##### **已部署的HA集群信息:**
+```
+[omm@db1 ~]$ gs_om -t status --detail
+[ Cluster State ]
+
+cluster_state : Normal
+redistributing : No
+current_az : AZ_ALL
+
+[ Datanode State ]
+
+node node_ip instance state
+-------------------------------------------------------------------------------------
+1 db1.opengauss.com 192.168.100.11 6001 /gauss/data/db1 P Primary Normal
+2 db2.opengauss.com 192.168.100.12 6002 /gauss/data/slavedb2 S Standby Normal
+```
+##### **Tips:**
+由于HA集群环境已经部署运行,故系统参数等运行环境已经完备,无需再次进行配置,但需确保已安装的openGauss实例是以环境变量分离的模式安装,否则执行脚本会有报错,需要做适当调整(详见文章内容)。
+
+
+
+## **一、多实例安装部署**
+
+
+
+##### **Tips:**
+不建议提前创建用户并配置SSH互信,否则在运行gs_preinstall脚本时,在创建用户和SSH互信阶段选择"no",该操作可能导致gs_install脚本运行异常(详见文章内容)。
+
+
+
+#### **1.创建安装目录(主、备节点执行)**
+
+
+
+```
+mkdir -p /gauss1
+chgrp dbgrp -R /gauss1
+chmod 775 -R /gauss1
+```
+
+
+
+#### **2.配置clusterconfig文件(仅在主节点配置即可)**
+
+
+
+```
+# vi clusterconfig1.xml
+------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+------------------------------------------------
+## 26000-26005端口已经被其他实例使用,此处使用27000以后的端口。
+
+mv clusterconfig1.xml /soft/openGauss/
+```
+
+
+
+#### **3.执行预安装(--sep-env-file 设置分离环境变量) [新管理用户:omm2]**
+
+
+
+```
+[root@db1 script]# export LD_LIBRARY_PATH=/soft/openGauss/script/gspylib/clib:/usr/python3.6.11/lib:$LD_LIBRARY_PATH
+[root@db1 script]# cd /soft/openGauss/script
+[root@db1 script]# ./gs_preinstall -U omm2 -G dbgrp -X /soft/openGauss/clusterconfig1.xml --sep-env-file=/gauss1/gaussenv
+##sep-env-file文件不能存放在/home/omm下
+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 ## 选择自动创建互信
+Setting pssh path
+Successfully set core path.
+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[omm2] 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.
+Checking OS software.
+Successfully check os software.
+Checking OS version.
+Successfully checked OS version.
+Creating cluster's path.
+Successfully created cluster's path.
+Setting SCTP service.
+Successfully set SCTP service.
+Set and check OS parameter.
+Setting OS parameters.
+Successfully set OS parameters.
+Warning: Installation environment contains some warning messages.
+Please get more details by "/soft/openGauss/script/gs_checkos -i A -h db1.opengauss.com,db2.opengauss.com --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.
+Set ARM Optimization.
+No need to set ARM Optimization.
+Fixing server package owner.
+Setting finish flag.
+Successfully set finish flag.
+Preinstallation succeeded.
+
+## OS检查
+[root@db1 script]# /soft/openGauss/script/gs_checkos -i A -h db1.opengauss.com,db2.opengauss.com --detail
+Checking items:
+ A1. [ OS version status ] : Normal
+ [db1.opengauss.com]
+ centos_7.6.1810_64bit
+ [db2.opengauss.com]
+ 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.
+ A10.[ IO scheduler status ] : Normal
+ The value of IO scheduler is correct.
+ A11.[ Network card configuration status ] : Normal
+ The configuration about network card is correct.
+ A12.[ Time consistency status ] : Warning
+ [db2.opengauss.com]
+ The NTPD not detected on machine and local time is "2020-07-28 16:17:01".
+ [db1.opengauss.com]
+ The NTPD not detected on machine and local time is "2020-07-28 16:17:00".
+
+ 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.
+```
+##### **Tips:**
+在测试安装第二个实例时,因为前期手动创建了omm2用户的SSH互信,所以在gs_preinstall运行时,选择"no"不再进行omm2用户的互信创建。结果导致在执行后面的gs_install脚本时报错。
+报错示例如下:
+```
+[omm2@db1 script]$ gs_install -X /soft/openGauss/clusterconfig1.xml
+Parsing the configuration file.
+Check preinstall on every node.
+[GAUSS-51400] : Failed to execute the command: python3 '/gauss1/om/script/local/CheckPreInstall.py' -U omm2 -t preinstall. Result:{'db1.opengauss.com': 'Failure', 'db2.opengauss.com': 'Failure'}.
+Error:
+[FAILURE] db1.opengauss.com:
+[FAILURE] db2.opengauss.com:
+```
+以上报错的原因是:gs_preinstall脚本修改了/etc/hosts文件里面对应的IP地址,导致SSH互信失效。此时需要重新修改/etc/hosts文件内IP地址,并建立omm2用户的互信。
+
+
+
+#### **4. 检查预安装产生的文件**
+
+
+
+```
+[root@db1 ~]# ll /gauss1
+total 4
+drwx------ 2 omm2 omm2 6 Jul 28 16:16 app_0bd0ce80
+drwxr-x--- 2 omm2 dbgrp 6 Jul 28 16:16 corefile
+drwx------ 3 omm2 omm2 17 Jul 28 16:16 data
+-rw------- 1 omm2 omm2 553 Jul 28 16:16 gaussenv
+drwx------ 3 omm2 dbgrp 17 Jul 28 16:15 log
+drwx------ 4 omm2 omm2 182 Jul 28 16:15 om
+drwx------ 2 omm2 omm2 6 Jul 28 16:16 tmp
+
+[root@db1 script]# cat /gauss1/gaussenv
+export MPPDB_ENV_SEPARATE_PATH=/gauss1/gaussenv
+export GPHOME=/gauss1/om
+export PATH=$GPHOME/script/gspylib/pssh/bin:$GPHOME/script:$PATH
+export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
+export PYTHONPATH=$GPHOME/lib
+export PATH=/root/gauss_om/omm2/script:$PATH
+export GAUSSHOME=/gauss1/app
+export PATH=$GAUSSHOME/bin:$PATH
+export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
+export S3_CLIENT_CRT_FILE=$GAUSSHOME/lib/client.crt
+export GAUSS_VERSION=1.0.0
+export PGHOST=/gauss1/tmp
+export GAUSSLOG=/gauss1/log/omm/omm2
+umask 077
+export GAUSS_ENV=1
+```
+
+
+
+##### **Tips:**
+ 从文件内容看,使用--sep-env-file参数定义的文件/gauss1/gaussenv主要包含了omm2用户的相关环境变量,包括MPPDB_ENV_SEPARATE_PATH、GPHOME、GAUSSHOME 等变量,用户在使用omm2用户管理gs1Cluster数据库时必须提前使用`source /gauss1/gaussenv` 命令加载对应的数据库环境变量,避免误操作其他数据库。
+ 使用不同的用户管理不同的数据库时,有时候为了使得操作更加便捷,可以将gaussenv文件内容写入用户的profile中,节省手动source环境变量的时间。
+内容如下(仅供参考):
+```
+[omm2@db1 ~]$ cat /gauss1/gaussenv >> ~/.bash_profile
+[omm2@db1 ~]$ cat ~/.bash_profile
+# .bash_profile
+
+# Get the aliases and functions
+if [ -f ~/.bashrc ]; then
+ . ~/.bashrc
+fi
+
+# User specific environment and startup programs
+
+PATH=$PATH:$HOME/.local/bin:$HOME/bin
+
+export PATH
+export MPPDB_ENV_SEPARATE_PATH=/gauss1/gaussenv
+export GPHOME=/gauss1/om
+export PATH=$GPHOME/script/gspylib/pssh/bin:$GPHOME/script:$PATH
+export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
+export PYTHONPATH=$GPHOME/lib
+export PATH=/root/gauss_om/omm2/script:$PATH
+export GAUSSHOME=/gauss1/app
+export PATH=$GAUSSHOME/bin:$PATH
+export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
+export S3_CLIENT_CRT_FILE=$GAUSSHOME/lib/client.crt
+export GAUSS_VERSION=1.0.0
+export PGHOST=/gauss1/tmp
+export GAUSSLOG=/gauss1/log/omm/omm2
+umask 077
+export GAUSS_ENV=1
+```
+
+
+
+#### **5. 执行安装**
+
+
+
+```
+[root@db1 ~]# echo "export LD_LIBRARY_PATH=/soft/openGauss/script/gspylib/clib:/usr/python3.6.11/lib:\$LD_LIBRARY_PATH" >> /home/omm2/.bash_profile
+[root@db1 ~]# chown omm2:dbgrp -R /soft/
+[root@db1 ~]# su - omm2
+Last login: Tue Jul 28 11:33:21 CST 2020 on pts/0
+[omm2@db1 ~]$ source /gauss1/gaussenv
+[omm2@db1 ~]$ gs_install -X /soft/openGauss/clusterconfig1.xml
+Parsing the configuration file.
+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 /gauss1/app/share/sslcert/om
+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.
+Successful check consistence of memCheck and coresCheck on all nodes.
+Configuring pg_hba on all nodes.
+Configuration is completed.
+Successfully started cluster.
+Successfully installed application.
+end deploy..
+```
+
+
+
+##### **Tips:**
+如果已有环境中数据库使用的是非分离环境变量的方式安装,那么在执行gs_install会报错,内容如下:
+```
+[omm2@db1 ~]$ gs_install -X /soft/openGauss/clusterconfig1.xml
+Parsing the configuration file.
+Check preinstall on every node.
+[GAUSS-51637] : The valid return item number [0] does not match with host number[2]. The return result:
+python3: cant open file '/gauss/om/script/gspylib/pssh/bin/pssh': [Errno 13] Permission denied.
+```
+**参考解决方法:**
+删除/etc/profile文件内有关openGauss的环境变量设置,需删除的内容示例如下:
+```
+export GPHOME=/gauss/om
+export PATH=$GPHOME/script/gspylib/pssh/bin:$GPHOME/script:$PATH
+export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
+export PYTHONPATH=$GPHOME/lib
+export PATH=/root/gauss_om/omm/script:$PATH
+```
+
+
+
+#### **6.安装完毕状态检查**
+
+
+
+```
+[omm2@db1 ~]$ gs_om -t status --detail
+[ Cluster State ]
+cluster_state : Normal
+redistributing : No
+current_az : AZ_ALL
+
+[ Datanode State ]
+node node_ip instance state
+-----------------------------------------------------------------------------------------
+1 db1.opengauss.com 192.168.100.11 6001 /gauss1/data/db1 P Primary Normal
+2 db2.opengauss.com 192.168.100.12 6002 /gauss1/data/slavedb2 S Standby Normal
+
+[omm2@db1 ~]$ gsql -d postgres -p 27000
+gsql ((openGauss 1.0.0 build 0bd0ce80) compiled at 2020-06-30 18:19:27 commit 0 last mr )
+Non-SSL connection (SSL connection is recommended when requiring high-security)
+Type "help" for help.
+
+postgres=# alter role omm2 identified by 'gauss@234' replace 'gauss@123';
+ALTER ROLE
+postgres=# \l
+ List of databases
+ Name | Owner | Encoding | Collate | Ctype | Access privileges
+-----------+-------+-----------+---------+-------+-------------------
+ postgres | omm2 | SQL_ASCII | C | C |
+ template0 | omm2 | SQL_ASCII | C | C | =c/omm2 +
+ | | | | | omm2=CTc/omm2
+ template1 | omm2 | SQL_ASCII | C | C | =c/omm2 +
+ | | | | | omm2=CTc/omm2
+(3 rows)
+```
+
+
+
+
+## **二、卸载并清理环境**
+
+
+
+#### **1. 卸载数据库**
+
+
+
+```
+[root@db1 ~]# su - omm2
+Last login: Tue Jul 28 16:57:10 CST 2020 from db1.opengauss.com on pts/1
+[omm2@db1 ~]$ source /gauss1/gaussenv ## 切换至gauss1的环境变量
+[omm2@db1 ~]$ gs_uninstall --delete-data
+Checking uninstallation.
+Successfully checked uninstallation.
+Stopping the cluster.
+Successfully stopped cluster.
+Successfully deleted instances.
+Uninstalling application.
+Successfully uninstalled application.
+Uninstallation succeeded.
+
+[omm2@db1 ~]$ ll /gauss1/
+total 4
+drwx------ 2 omm2 omm2 6 Jul 28 17:21 app_0bd0ce80
+drwxr-x--- 2 omm2 dbgrp 6 Jul 28 16:16 corefile
+drwx------ 3 omm2 omm2 17 Jul 28 16:16 data
+-rw------- 1 omm2 omm2 587 Jul 28 17:21 gaussenv
+drwx------ 3 omm2 dbgrp 17 Jul 28 16:15 log
+drwx------ 4 omm2 omm2 182 Jul 28 16:15 om
+drwx------ 2 omm2 omm2 6 Jul 28 17:21 tmp
+[omm2@db1 ~]$ ll /gauss1/data/db1/
+total 0 ## 数据已清空
+```
+
+
+
+#### **2. 清理生产环境**
+
+
+
+```
+## 以root用户执行脚本前,先检查并确保root互信可用
+[root@db1 script]# source /gauss1/gaussenv ## 加载omm2用户的env环境
+[root@db1 script]# ./gs_postuninstall -U omm2 -X /soft/openGauss/clusterconfig1.xml --delete-user --delete-group
+Parsing the configuration file.
+Successfully parsed the configuration file.
+Check log file path.
+Successfully checked log file path.
+Checking unpreinstallation.
+Successfully checked unpreinstallation.
+Deleting the instance's directory.
+Successfully deleted the instance's directory.
+Deleting the temporary directory.
+Successfully deleted the temporary directory.
+Deleting remote OS user.
+Successfully deleted remote OS user.
+Warning: There are other users in the group dbgrp on db2.opengauss.com, skip to delete group.
+Deleting software packages and environmental variables of other nodes.
+Successfully deleted software packages and environmental variables of other nodes.
+Deleting logs of other nodes.
+Successfully deleted logs of other nodes.
+Deleting software packages and environmental variables of the local node.
+Successfully deleted software packages and environmental variables of the local nodes.
+Deleting local OS user.
+Successfully deleted local OS user.
+Warning: There are other users in the group dbgrp on db1.opengauss.com, skip to delete group.
+Deleting local node's logs.
+Successfully deleted local node's logs.
+Successfully cleaned environment.
+
+## 查看卸载情况
+[root@db1 script]# id omm2
+id: omm2: no such user ## 用户已经删除
+
+[root@db1 script]# ll /gauss1/ ## 目录还有残留
+total 0
+drwx------ 2 1001 dbgrp 6 Jul 28 17:44 app_0bd0ce80
+drwxr-x--- 2 1001 dbgrp 6 Jul 28 16:16 corefile
+drwx------ 3 1001 1001 17 Jul 28 16:16 data
+drwx------ 3 1001 dbgrp 17 Jul 28 16:15 log
+drwx------ 2 1001 dbgrp 6 Jul 28 18:10 om
+
+[root@db1 script]# rm -fr /gauss1 ## 手动删除残留的目录
+```
diff --git a/content/zh/post/jiajunfeng/Single-inst Deployment of openGauss Database.md b/content/zh/post/jiajunfeng/Single-inst Deployment of openGauss Database.md
deleted file mode 100644
index 3fdde64b..00000000
--- a/content/zh/post/jiajunfeng/Single-inst Deployment of openGauss Database.md
+++ /dev/null
@@ -1,622 +0,0 @@
-+++
-title = "openGauss数据库安装部署(单实例)"
-date = "2020-07-22"
-tags = ["openGauss安装部署"]
-archives = "2020-07"
-author = "贾军锋"
-summary = "openGauss安装部署"
-img = "/zh/post/jiajunfeng/img/DBlogo-20200722.png"
-times = "17:00"
-+++
-
-# openGauss单机部署文档(CentOS7.6+openGauss 1.0.0)
-
-**说明:
**
-openGauss 支持单机部署和单机HA部署;
-openGauss HA部署时,备机数量为1~4台;
-openGauss 脚本安装仅支持单实例部署,如果一台主机部署多个实例,建议手动使用命令安装;
-openGauss Connectors的Linux版本:JDBC、ODBC、libpq.
-
-## 一、环境准备
-
-**硬件需求:**
-CPU >= 8c
-内存 >= 32GB
-硬盘 >= 1.5GB (禁用磁盘的Disk Cache Policy)
-网卡 >= 300MB (建议做网卡bond)
-
-```shell
-## 检查硬件配置
-cat /proc/cpuinfo |grep processor
-cat /etc/redhat-release
-free -m
-## 如果内存小于32GB,会因为内存不足导致数据库无法启动,此时需要修改shared_buffers和max_connections调整openGauss所需的内存
-```
-
-**软件需求:**
-
-| | |
-| ------------- | ------------------------------------------------------------ |
-| Linux操作系统 | openEuler 20.3LTS/CentOS 7.6 |
-| Linux文件系统 | 剩余inode个数>15亿 |
-| 工具 | Huawei JDK 1.8.0、psmisc、bzip2 |
-| Python | openEuler: 支持Python 3.7.x
CentOS 7.6:支持Python 3.6.x |
-| 其他软件包 | libaio-devel >= 0.3.109-13
flex >= 2.5.31
bison >= 2.7.4
ncurses-devel >= 5.9-13.20130511
glibc-devel >= 2.17-111
patch >= 2.7.1-10
lsb_release >= 4.1 |
-
-**示例:**
-
-```shell
-yum install -y lksctp*
-yum install -y java-1.8.0-openjdk* psmisc bzip2 python3 python3-devel
-yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core
-## 当系统环境仅限内网使用时,可以配置系统镜像ISO作为默认YUM源,但是该YUM源(CentOS 7.6)默认不包含python3,需要手动编译安装。
-
-[root@ecs-7777 ~]# rpm -qa java-1.8.0-openjdk psmisc bzip2 libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core lksctp-tools* python3 python3-devel
-psmisc-22.20-16.el7.x86_64
-flex-2.5.37-6.el7.x86_64
-redhat-lsb-core-4.1-27.el7.centos.1.x86_64
-bzip2-1.0.6-13.el7.x86_64
-java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64
-libaio-devel-0.3.109-13.el7.x86_64
-bison-3.0.4-2.el7.x86_64
-ncurses-devel-5.9-14.20130511.el7_4.x86_64
-lksctp-tools-devel-1.0.17-2.el7.x86_64
-patch-2.7.1-12.el7_7.x86_64
-lksctp-tools-1.0.17-2.el7.x86_64
-glibc-devel-2.17-307.el7.1.x86_64
-lksctp-tools-doc-1.0.17-2.el7.x86_64
-
-[root@ecs-7777 ~]# checksctp
-SCTP supported
-```
-
-
-######**Python3源码编译安装**
-
-```shell
-## Python3 源码编译安装耗时约30分钟
-yum install gcc zlib* openssl* -y
-tar -zxvf Python-3.6.11.tgz
-cd Python-3.6.11
-./configure --prefix=/usr/python3.6.11 --enable-optimizations --enable-shared
-make
-make install
-
-ln -s /usr/python3.6.11/bin/python3.6 /usr/bin/python3
-ln -s /usr/python3.6.11/bin/pip3 /usr/bin/pip3
-ln -s /usr/python3.6.11/lib/libpython3.6m.so.1.0 /usr/lib64/
-export LD_LIBRARY_PATH=/usr/python3.6.11/lib:$LD_LIBRARY_PATH
-
-[root@db1 bin]# python3 -V
-Python 3.6.11
-```
-
-
-
-## 二、操作系统配置
-
-**1.编辑Hosts文件**
-
-```shell
-vi /etc/hosts
---------------------
-192.168.0.11 db1.opengauss.com #Gauss OM IP Hosts Mapping
-192.168.0.12 db2.opengauss.com #Gauss OM IP Hosts Mapping
---------------------
-```
-
-**2.关闭防火墙**
-
-```shell
-systemctl status firewalld
-systemctl disable firewalld.service
-systemctl stop firewalld.service
-```
-
-**3.关闭SELinux**
-
-```shell
-vi /etc/selinux/config
----------------------------
-SELINUX=disabled
----------------------------
-
-## SELinux的配置文件需要重启操作系统才可以生效,可以使用setenforce 0 使SELinux临时变更为Permissive状态,降低SELinux的影响。
-```
-
-**4.修改字符集参数**
-
-```shell
-vi ~/.bash_profile
----------------------------
-export LANG=en_US.UTF-8
----------------------------
-
-source ~/.bash_profile
-```
-
-**5.设置时区并统一主机时间**
-
-```shell
-## 检查时区和时间是否正确
-[root@ecs-7777 ~]# ll /etc/localtime
-lrwxrwxrwx. 1 root root 35 Apr 27 22:06 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
-[root@ecs-7777 ~]# date
-Fri Jul 17 15:49:08 CST 2020
-
-## 如果时区不正确,则copy时区模板至/etc/localtime(此处以上海时间为例)
-[root@ecs-7777 ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
-```
-
-**6.关闭SWAP**
-
-```shell
-vi /etc/fstab ## 注释掉swap分区挂载
-swapoff -a ## 关闭swap
-```
-
-**7.[可选]设置网卡的MTU值(建议8192)**
-
-```shell
-ifconfig eth0 mtu 8192
-## 也可在ifcfg-eth0网络配置文件设置"MTU=8192",使之永久生效[需要网络工程师协助修改网络设备配置]
-```
-
-**8.配置SSH服务(允许root登录,关闭Banner)**
-
-检查root登录配置和Banner的配置
-
-```
-cat /etc/ssh/sshd_config |grep -v ^#|grep -E 'PermitRoot|Banner'
-```
-
-如果不满足要求,应修改配置如下:
-
-```shell
-vi /etc/ssh/sshd_config
---------------------------
-#Banner none ## 注释ssh登录的欢迎信息
-PermitRootLogin yes ## 允许root用户远程登录
---------------------------
-
-systemctl restart sshd.service
-```
-
-**9.创建管理用户组(管理用户稍后使用脚本gs_preinstall创建)**
-
-```
-groupadd dbgrp
-```
-
-**10.配置内核参数**
-
-```shell
-# 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_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.sctp.path_max_retrans = 10
-net.sctp.max_init_retransmits = 10
-net.sctp.association_max_retrans = 10
-net.sctp.hb_interval = 30000
-net.ipv4.tcp_retries2 = 12
-vm.overcommit_memory = 0
-net.sctp.sndbuf_policy = 0
-net.sctp.rcvbuf_policy = 0
-net.sctp.sctp_mem = 94500000 915000000 927000000
-net.sctp.sctp_rmem = 8192 250000 16777216
-net.sctp.sctp_wmem = 8192 250000 16777216
-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
-vm.min_free_kbytes = 102400 ## 内存*5%
-net.core.somaxconn = 65535
-net.ipv4.tcp_syncookies = 1
-net.sctp.addip_enable = 0
-net.core.netdev_max_backlog = 65535
-net.ipv4.tcp_max_syn_backlog = 65535
-net.ipv4.tcp_fin_timeout = 60
-kernel.shmall = 1152921504606846720
-kernel.shmmax = 18446744073709551615
-net.ipv4.tcp_sack = 1
-net.ipv4.tcp_timestamps = 1
-vm.extfrag_threshold = 500
-vm.overcommit_ratio = 90
-----------------------------------------
-```
-
-**redhat 6.4&6.5需要打开sctp的checksums,否则可能引起创建表或数据库失败**
-
-```
-[root@ecs-7777 ~]# echo 0 > /sys/module/sctp/parameters/no_checksums
-[root@ecs-7777 ~]# cat /sys/module/sctp/parameters/no_checksums
-N
-```
-
-**11.修改系统资源限制**
-
-```shell
-vi /etc/security/limits.conf
-----------------------------
-* soft stack 3072
-* hard stack 3072
-* soft nofile 1000000 ## 安装时脚本自动设置
-* hard nofile 1000000 ## 安装时脚本自动设置
- ----------------------------
-
-vi /etc/security/limits.d/90-nproc.conf
-----------------------------
-* soft nproc unlimited ## 系统支持的最大进程数
-----------------------------
-
-## 说明:在使用gs_preinstall脚本后,limits资源虽然已经设置,但可能存在暂时不生效的情况,需要重启系统使之生效。
-```
-
-**12.关闭透明页transparent_hugepage**
-
-```shell
-vi /etc/default/grub
-----------------------------
-#修改:
-GRUB_CMDLINE_LINUX="rhgb quiet transparent_hugepage=never"
-----------------------------
-grub2-mkconfig -o /boot/grub2/grub.cfg ## 重新编译grub,关闭透明页
-
-cat /proc/meminfo |grep Huge
-
-## 临时关闭透明页方法
-echo never > /sys/kernel/mm/transparent_hugepage/enabled
-echo never > /sys/kernel/mm/transparent_hugepage/defrag
-```
-
-**13.[可选]网卡参数配置(配置万兆业务网卡[backIp1])**
-
-```shell
-rx = 4096 # 预安装时是否由脚本自动设置
-tx = 4096 # 预安装时是否由脚本自动设置
-mtu = 8192 # 推荐值:8192,同时需要协调对网络端口做出相应调整
-```
-
-
-
-## 三、预安装openGauss软件
-
-**1.配置clusterconfig.xml文件**
-
-```xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-| 实例名称 | 实例数据目录 | 备注 |
-| :------: | :----------------: | :---------------------------: |
-| 主DBnode | /gauss/data/xxx | 其中,xxx为当前主DBnode的名称 |
-| 备DBnode | /gauss/data/slaveX | 其中,xxx为当前备DBnode的名称 |
-
-**备注:**
-
-- dataListenIp1 ---> 监听的IP地址,用于接受其他数据库节点的连接。未设置时,使用对应主机上的backIp1生成。
-- dataHaIp1 ---> 主、备DBnode通讯的IP地址。未设置时,使用对应主机上的backIp生成。value中需要设置主、备DBnode所在主机的IP地址。
-- "/gauss/om"存放互信等工具,避免权限问题,不要把实例数据目录放在此目录下。
-- 安装目录和数据目录需为空或者不存在,否则可能导致安装失败。
-- 确保配置的目录之间不相互耦合。
-- 若需要安装脚本自动创建安装用户时,各配置的目录需保证不与系统创建的默认用户目录耦合关联。
-- 配置openGauss路径和实例路径时,路径中不能包含"|",";","&","$","<",">","`","","","'","{","}","(",")","[","]","~","*","?"特殊字符。
-- 配置数据库节点名称时,请通过hostname命令获取数据库节点的主机名称,替换示例中的node1、node2。
-- 配置文件中所有IP参数(backIP、sshIP、listenIP等)均只支持配置一个IP,如果配置第二个IP参数,则不会读取第二个参数的配置值。
-
-**单节点配置文件示例**
-***# vi clusterconfig.xml***
-
-```xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-**2.环境初始化**
-
-```shell
-mkdir /gauss
-chgrp dbgrp -R /gauss
-chmod 775 -R /gauss
-
-mkdir -p /soft/openGauss
-chmod 775 -R /soft
-mv clusterconfig.xml /soft/openGauss
-mv openGauss-1.0.0-CentOS-64bit.tar.gz /soft/openGauss
-cd /soft/openGauss
-tar -zxvf openGauss-1.0.0-CentOS-64bit.tar.gz
-```
-
-
-
-**交互式安装**
-
- 若是共用的环境,需要加入--sep-env-file=ENVFILE参数分离环境变量,避免与其他用户相互影响。
-
- 在openGauss的安装过程中,需要在openGauss中主机间执行命令,传送文件等操作,故在普通用户安装前需要确保互信是连通的。前置脚本中会先建立root用户间的互信,然后创建普通用户,并建立普通用户间的互信,安装完毕后即可删除root用户的互信。
-
-```shell
-export LD_LIBRARY_PATH=/soft/openGauss/script/gspylib/clib:/usr/python3.6.11/lib:$LD_LIBRARY_PATH
-cd /soft/openGauss/script
-./gs_preinstall -U omm -G dbgrp -X /soft/openGauss/clusterconfig.xml
-```
-
- 当不允许创建root用户互信时,在各主机上使用创建的omm用户执行本地模式前置,然后用户手动创建openGauss用户互信:如果预安装指定-L参数,预安装前需手动将所有节点的主机名和IP映射关系,写入各个主机的/etc/hosts文件,并在每个映射关系后添加注释内容"#Gauss OM IP Hosts Mapping".
-
-```shell
-cd /soft/openGauss/script
-./gs_preinstall -U omm -G dbgrp -L -X /soft/openGauss/clusterconfig.xml ##在每个节点手动执行
-```
-
-**手动创建互信(脚本)**
-
-```shell
-vi /soft/hostfile
------------------------
-192.168.0.11
-192.168.0.12
------------------------
-cd /soft/openGauss/script
-./gs_sshexkey -f /soft/hostfile
-```
-
-
-
-**非交互式安装(可选)**
-
-**手动创建互信(脚本)**
-
-```shell
-vi /soft/hostfile
------------------------
-192.168.0.11
-192.168.0.12
------------------------
-
-cd /soft/openGauss/script
-./gs_sshexkey -f /soft/hostfile
-
-cd /soft/openGauss/script
-./gs_preinstall -U omm -G dbgrp -X /soft/openGauss/clusterconfig.xml --non-interactive
-
-## 错误排查:
- 如果准备安装环境失败请根据openGauss日志目录“$GAUSSLOG/om”下的“gs_preinstall-YYYY-MM-DD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。例如配置文件中“gaussdbLogPath”参数指定的路径为“/var/log/gaussdb”,则“$GAUSSLOG/om”路径为“/var/log/gaussdb/omm/om”,omm用户为运行openGauss的用户。
-```
-
-
-
-## 四、部署安装openGauss软件
-
-**执行安装脚本**
-
-```shell
-chmod -R 775 /soft/
-chown omm:dbgrp /soft -R
-su - omm
-cd /soft/openGauss/script
-./gs_install -X /soft/openGauss/clusterconfig.xml ## 密码复杂度要求:大写+小写+数字+特殊字符(任选3类,至少8位)
-```
-
-**说明:**
-
-- 默认字符集与操作系统设置保持一致,也可以在数据库初始化时使用-E参数指定数据库的字符集为GBK/UTF-8/Latinl,默认字符集为SQL_ASCII
-- openGauss支持字符集的多种写法:gbk/GBK、UTF-8/UTF8/utf8/utf-8、Latinel/latinel
-- 执行gs_install脚本时,如果输入参数–autostart=no, 则工具脚本在配置(config)步骤完成后退出,不会自动启动openGauss,需要用户通过执行gs_om -t start命令手动启动。
-- 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为集群openGauss配置文件中指定的程序安装目录。日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”
-
-**删除root的SSH互信**
-
-```shell
-su - root
-rm -fr ~/.ssh
-```
-
-**备机可读(可选)**
-
-1> 停止主、备数据库
-
-2> 分别修改主、备库postgres.conf文件
-
-```shell
-## 内容如下:
-wal_level=hot_standby
-hot_standby = on
-hot_standby_feedback = on
-```
-
-3> 重启主、备数据库
-
-
-
-## 五、安装验证
-
-```shell
-su - root
-cd /soft/openGauss/script/
-./gs_checkos -i A
-./gs_checkos -i B
-```
-
-
-
-## 六、初始化数据库
-
-**方法一:脚本初始化**
-
-```
-gs_initdb -E UTF-8 --locale=zh_CN.UTF-8 /opt/gaussdb/data/data_n1 --nodename dn1 -w "Bigdata@123"
-```
-
-**方法二:gsql方式**
-
-```
-# gsql -d postgres -p 26000
-postgres=# alter role omm identified by 'Gauss@123' replace 'Gauss_111';
-postgres=# CREATE DATABASE mydb WITH ENCODING 'GBK' template = template0;
-```
-
-**简单查询测试:**
-
-```
-postgres=# select version();
-postgres=# \l
- List of databases
-
- Name | Owner | Encoding | Collate | Ctype | Access privileges
------------+-------+-----------+---------+-------+-------------------
- mydb | omm | UTF8 | C | C |
- postgres | omm | SQL_ASCII | C | C |
- template0 | omm | SQL_ASCII | C | C | =c/omm +
- | | | | | omm=CTc/omm
- template1 | omm | SQL_ASCII | C | C | =c/omm +
- | | | | | omm=CTc/omm
-```
-
-
-
-## 七、卸载数据库
-
-**登录主节点执行**
-
-```shell
-su - omm
-gs_uninstall --delete-data # 卸载集群所有数据库
-gs_uninstall --delete-data -L # 仅卸载本地数据库
-
-# 如果卸载失败请根据“$GAUSSLOG/om/gs_uninstall-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。
-```
-
-
-
-## 八、清理系统环境配置
-
- 在openGauss卸载完成后,如果不需要在环境上重新部署openGauss,可以运行脚本gs_postuninstall对openGauss服务器上环境信息做清理。openGauss环境清理是对环境准备脚本gs_preinstall所做设置的清理。
-1> 确保root用户SSH互信
-2> 执行清理脚本,如下:
-
-```shell
-cd /opt/software/openGauss/script
-./gs_postuninstall -U omm -X /opt/software/openGauss/clusterconfig.xml --delete-user --delete-group
-./gs_postuninstall -U omm -X /opt/software/openGauss/clusterconfig.xml --delete-user --delete-group -L ## 仅清理本地环境
-## 若为环境变量分离的模式安装的集群需删除之前source的环境变量分离的env参数
-```
-
-3> 删除root的SSH互信,并删除ENVFILE环境变量:unset MPPDB_ENV_SEPARATE_PATH
-
-注意:若是共用的环境,需要加入--sep-env-file
-
-
-
-## 附录:【手动创建SSH互信的方法】
-
-**1> 生成本地秘钥Key(每个主机执行一遍)**
-
-```shell
-ssh-keygen -t rsa
-cat .ssh/id_rsa.pub >> .ssh/authorized_keys ##生成本机授权
-```
-
-**2> 收集各节点公钥至本机的known_hosts**
-
-```shell
-ssh-keyscan -t rsa plat1 >> ~/.ssh/known_hosts
-ssh-keyscan -t rsa plat2 >> ~/.ssh/known_hosts
-ssh-keyscan -t rsa plat3 >> ~/.ssh/known_hosts
-```
-
-**3> 将互信文件分发给其他所有主机**
-
-```shell
-scp -r .ssh plat2:~
-scp -r .ssh plat3:~
-```
-
-**4> ssh登录测试**
diff --git a/content/zh/post/jiajunfeng/openGauss Single-inst Deployment (CentOS7.6+openGauss 1.0.0).md b/content/zh/post/jiajunfeng/openGauss Single-inst Deployment (CentOS7.6+openGauss 1.0.0).md
index 00064090..d72e1484 100644
--- a/content/zh/post/jiajunfeng/openGauss Single-inst Deployment (CentOS7.6+openGauss 1.0.0).md
+++ b/content/zh/post/jiajunfeng/openGauss Single-inst Deployment (CentOS7.6+openGauss 1.0.0).md
@@ -1,4 +1,4 @@
-+++
++++
title = "openGauss 单实例安装部署"
date = "2020-07-25"
tags = ["openGauss安装部署"]
@@ -9,36 +9,103 @@ img = "/zh/post/jiajunfeng/img/DBlogo-20200722.png"
times = "19:00"
+++
-# openGauss 单实例安装部署文档(CentOS7.6+openGauss 1.0.0)
-
-**说明:**
-
-- openGauss 支持单机部署和单机HA部署;
-- openGauss HA部署时,备机数量为1~4台;
-- openGauss 脚本安装仅支持单实例部署,如果一台主机部署多个实例,建议手动使用命令安装;
-- openGauss Connectors的Linux版本:JDBC、ODBC、libpq.
-
-
-
-## 一、环境准备
-
-### **1.1 硬件需求**
-
-组件 | 最小配置要求 | 备注 |
CPU | 8c |
|
内存 | 32GB | 如果小于32GB,需要调整数据库内存参数 |
硬盘 | 1.5GB | 禁用磁盘的Disk Cache Policy
|
网卡速率 | 300MB | 建议做网卡bond
|
-
+# **openGauss 单实例安装部署文档(CentOS 7.6+openGauss 1.0.0)**
+
+
+
+##### **说明:**
+1> openGauss 支持单机部署和单机HA部署;
+2> openGauss HA部署时,备机数量为1~4台;
+3> openGauss 脚本安装仅支持单实例部署,如果一台主机部署多个实例,建议手动使用命令安装;
+4> openGauss Connectors的Linux版本:JDBC、ODBC、libpq.
+
+
+
+### **一、环境准备**
+
+
+
+#### 1.1 硬件需求
+
+
+
+
+
+ 组件 |
+ 最小配置要求 |
+ 备注 |
+
+
+ CPU |
+ 8c |
+ |
+
+
+ 内存 |
+ 32GB |
+ 如果小于32GB,需要调整数据库内存参数 |
+
+
+ 硬盘 |
+ 1.5GB |
+ 禁用磁盘的Disk Cache Policy |
+
+
+ 网卡 |
+ 300MB |
+ 建议做网卡bond |
+
+
+
+
+
+##### **检查硬件配置:**
```shell
-## 检查硬件配置
cat /proc/cpuinfo |grep processor
cat /etc/redhat-release
free -m
+
## 如果内存小于32GB,会因为内存不足导致数据库无法启动,此时需要修改shared_buffers和max_connections调整openGauss所需的内存
```
-### **1.2 软件需求**
-
-条目 | 要求 |
Linux操作系统
| openEuler 20.3LTS/CentOS 7.6
|
Linux文件系统
| 剩余inode个数 > 15亿
|
工具
| Huawei JDK 1.8.0、psmisc、bzip2
|
Python
| openEuler: 支持Python 3.7.x CentOS 7.6:支持Python 3.6.x
|
其他依赖软件包
| libaio-devel >= 0.3.109-13 flex >= 2.5.31 bison >= 2.7.4 ncurses-devel >= 5.9-13.20130511 glibc-devel >= 2.17-111 patch >= 2.7.1-10 lsb_release >= 4.1 |
-
-### **1.3 安装示例**
+
+
+#### 1.2 软件需求
+
+
+
+
+
+ 条目 |
+ 说明 |
+
+
+ Linux操作系统 |
+ openEuler 20.3LTS CentOS 7.6 |
+
+
+ Linux文件系统 |
+ 剩余inode个数 > 15亿 |
+
+
+ 工具 |
+ Huawei JDK 1.8.0、psmisc、bzip2 |
+
+
+ Python |
+ openEuler: 支持Python 3.7.x CentOS 7.6:支持Python 3.6.x |
+
+
+ 其他依赖软件包 |
+ libaio-devel >= 0.3.109-13 flex >= 2.5.31 bison >= 2.7.4 ncurses-devel >= 5.9-13.20130511 glibc-devel >= 2.17-111 patch >= 2.7.1-10 lsb_release >= 4.1 |
+
+
+
+
+
+#### 1.3 安装示例
+
+
```shell
## 当系统环境仅限内网使用时,可以配置系统镜像ISO作为默认YUM源,但是该YUM源(CentOS 7.6)默认不包含python3,需要手动编译安装。
@@ -65,7 +132,11 @@ lksctp-tools-doc-1.0.17-2.el7.x86_64
SCTP supported
```
-### **1.4 Python3源码编译安装**
+
+
+#### 1.4 Python3源码编译安装
+
+
```shell
## Python3 源码编译安装耗时约30分钟
@@ -85,11 +156,16 @@ export LD_LIBRARY_PATH=/usr/python3.6.11/lib:$LD_LIBRARY_PATH
Python 3.6.11
```
+
+
+### **二、操作系统配置**
-## 二、操作系统配置
+
-### **1.编辑Hosts文件**
+#### 2.1 编辑Hosts文件
+
+
```shell
vi /etc/hosts
@@ -98,7 +174,11 @@ vi /etc/hosts
--------------------
```
-### **2.关闭防火墙**
+
+
+#### 2.2 关闭防火墙
+
+
```shell
systemctl status firewalld
@@ -106,7 +186,11 @@ systemctl disable firewalld.service
systemctl stop firewalld.service
```
-### **3.关闭SELinux**
+
+
+#### 2.3 关闭SELinux
+
+
```shell
vi /etc/selinux/config
@@ -116,7 +200,11 @@ SELINUX=disabled
## SELinux的配置文件需要重启操作系统才可以生效,可以使用setenforce 0 使SELinux临时变更为Permissive状态,降低SELinux的影响。
```
-### **4.修改字符集参数**
+
+
+#### 2.4 修改字符集参数
+
+
```shell
vi ~/.bash_profile
@@ -127,7 +215,11 @@ export LANG=en_US.UTF-8
source ~/.bash_profile
```
-### **5.设置时区并统一主机时间**
+
+
+#### 2.5 设置时区并统一主机时间
+
+
```shell
## 检查时区和时间是否正确(建议生产环境开启NTP服务同步时间)
@@ -140,14 +232,22 @@ Fri Jul 17 15:49:08 CST 2020
[root@db1 ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
```
-### **6.关闭SWAP**
+
+
+#### 2.6 关闭SWAP
+
+
```shell
vi /etc/fstab ## 注释掉swap分区挂载
swapoff -a ## 关闭swap
```
-### **7.[可选]设置backupIP网卡的MTU值(建议8192)**
+
+
+#### 2.7 [可选]设置backupIP网卡的MTU值(建议8192)
+
+
```shell
vi /etc/sysconfig/network-scripts/ifcfg-ens34
@@ -159,7 +259,11 @@ MTU=8192 ## 可能需要网络工程师协助修改网络设备端口MTU配
ifconfig ens34 mtu 8192
```
-### **8.配置SSH服务(允许root登录,关闭Banner)**
+
+
+#### 2.8 配置SSH服务(允许root登录,关闭Banner)
+
+
```shell
# 检查root登录配置和Banner的配置
@@ -175,13 +279,21 @@ PermitRootLogin yes ## 允许root用户远程登录
systemctl restart sshd.service
```
-### **9.创建管理用户组(管理用户稍后使用脚本gs_preinstall创建)**
+
+
+#### 2.9 创建管理用户组(管理用户稍后使用脚本gs_preinstall创建)
+
+
```shell
groupadd dbgrp
```
-### **10.配置内核参数**
+
+
+#### 2.10 配置内核参数
+
+
```shell
# vi /etc/sysctl.conf
@@ -235,7 +347,11 @@ vm.overcommit_ratio = 90
N
```
-### **11.修改系统资源限制**
+
+
+#### 2.11 修改系统资源限制
+
+
```shell
vi /etc/security/limits.conf
@@ -254,7 +370,11 @@ vi /etc/security/limits.d/90-nproc.conf
## 说明:在使用gs_preinstall脚本后,limits资源虽然已经设置,但可能存在暂时不生效的情况,需要重启系统使之生效。
```
-### **12.关闭透明页transparent_hugepage**
+
+
+#### 2.12 关闭透明页transparent_hugepage
+
+
```shell
vi /etc/default/grub
@@ -273,7 +393,11 @@ echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
```
-### **13.[可选]网卡参数配置(配置万兆业务网卡[backIp1])**
+
+
+#### 2.13 [可选]网卡参数配置(配置万兆业务网卡[backIp1])
+
+
```shell
rx = 4096 # 预安装时是否由脚本自动设置
@@ -281,11 +405,16 @@ tx = 4096 # 预安装时是否由脚本自动设置
mtu = 8192 # 推荐值:8192,同时需要协调对网络端口做出相应调整
```
+
+
+### **三、预安装openGauss软件**
-## 三、预安装openGauss软件
+
-### **1.配置clusterconfig.xml文件**
+#### 3.1 配置clusterconfig.xml文件
+
+
```shell
# vi clusterconfig.xml
@@ -338,17 +467,20 @@ mtu = 8192 # 推荐值:8192,同时需要协调对网络端口做出相应
---------------------------------------------------------
```
-**说明:**
+##### **说明:**
+1> "/gauss/om"存放互信等工具,避免权限问题,不要把实例数据目录放在此目录下。
+2> 安装目录和数据目录必须为空或者不存在,否则可能导致安装失败。
+3> 确保配置的目录之间不相互耦合。
+4> 若需要安装脚本自动创建安装用户时,各配置的目录需保证不与系统创建的默认用户目录耦合关联。
+5> 配置openGauss路径和实例路径时,路径中不能包含"|",";","&","$","<",">","\`","","","'","{","}","(",")","\[","]","~","\*","?"特殊字符。
+6> 配置数据库节点名称时,确保与hostname命令获取数据库节点的主机名称一致。
+7> 配置文件中所有IP参数(backIP、sshIP、listenIP等)均只支持配置一个IP,如果配置第二个IP参数,则不会读取第二个参数的配置值。
+
+
-- "/gauss/om"存放互信等工具,避免权限问题,不要把实例数据目录放在此目录下。
-- 安装目录和数据目录必须为空或者不存在,否则可能导致安装失败。
-- 确保配置的目录之间不相互耦合。
-- 若需要安装脚本自动创建安装用户时,各配置的目录需保证不与系统创建的默认用户目录耦合关联。
-- 配置openGauss路径和实例路径时,路径中不能包含"|",";","&","$","<",">","`","","","'","{","}","(",")","[","]","~","*","?"特殊字符。
-- 配置数据库节点名称时,请通过hostname命令获取数据库节点的主机名称,替换示例中的node1、node2。
-- 配置文件中所有IP参数(backIP、sshIP、listenIP等)均只支持配置一个IP,如果配置第二个IP参数,则不会读取第二个参数的配置值。
+#### 3.2 环境初始化
-### 2.环境初始化
+
```shell
## 创建相关目录
@@ -365,25 +497,23 @@ cd /soft/openGauss
tar -zxvf openGauss-1.0.0-CentOS-64bit.tar.gz
```
-**交互式安装**
+
-注: 若是共用的环境,需要加入--sep-env-file=ENVFILE参数分离环境变量,避免与其他用户相互影响。
+**交互式安装**
+**备注:**
+ 若是共用的环境,需要加入--sep-env-file=ENVFILE参数分离环境变量,避免与其他用户相互影响。安装时,preinstall脚本会自动创建root用户的互信(单实例是本机root互信),当不允许创建root用户互信时,在主机上使用创建的omm用户执行本地模式前置,然后用户手动创建openGauss用户互信:如果预安装指定-L参数,预安装前需手动将节点的主机名和IP映射关系写入/etc/hosts文件,并在映射关系后添加注释内容"*#Gauss OM IP Hosts Mapping*".
```shell
+# 注:
export LD_LIBRARY_PATH=/soft/openGauss/script/gspylib/clib:/usr/python3.6.11/lib:$LD_LIBRARY_PATH
cd /soft/openGauss/script
./gs_preinstall -U omm -G dbgrp -X /soft/openGauss/clusterconfig.xml
+./gs_preinstall -U omm -G dbgrp -L -X /soft/openGauss/clusterconfig.xml ##(可选)本地模式安装时,在每个节点手动执行
```
- 安装时,preinstall脚本会自动创建root用户的互信(单实例是本机root互信),当不允许创建root用户互信时,在主机上使用创建的omm用户执行本地模式前置,然后用户手动创建openGauss用户互信:如果预安装指定-L参数,预安装前需手动将节点的主机名和IP映射关系写入/etc/hosts文件,并在映射关系后添加注释内容"*#Gauss OM IP Hosts Mapping*".
-
-```shell
-cd /soft/openGauss/script
-./gs_preinstall -U omm -G dbgrp -L -X /soft/openGauss/clusterconfig.xml ##在每个节点手动执行
-```
-
-**手动使用脚本创建互信(参考)**
+
+**- - 手动使用脚本创建互信(参考)**
```shell
vi /soft/hostfile
-----------------------
@@ -394,8 +524,9 @@ cd /soft/openGauss/script
./gs_sshexkey -f /soft/hostfile
```
-**非交互式安装(参考)**
+
+**- - 非交互式安装(参考)**
```shell
# 手动使用脚本创建互信
vi /soft/hostfile
@@ -410,13 +541,17 @@ cd /soft/openGauss/script
./gs_preinstall -U omm -G dbgrp -X /soft/openGauss/clusterconfig.xml --non-interactive
```
-**# 错误排查:**
+
- 如果准备安装环境失败请根据openGauss日志目录“`$GAUSSLOG/om`”下的“`gs_preinstall-YYYY-MM-DD_HHMMSS.log`”和“`gs_local-YYYY-MM-DD_HHMMSS.log`”中的日志信息排查错误。例如配置文件中“`$gaussdbLogPath`”参数指定的路径为“`/var/log/gaussdb`”,则“`$GAUSSLOG/om`”路径为“`/var/log/gaussdb/omm/om`”,omm用户为运行openGauss的用户。
+**错误排查:**
+ 如果准备安装环境失败请根据openGauss日志目录“`$GAUSSLOG/om`”下的“`gs_preinstall-YYYY-MM-DD_HHMMSS.log`”和“`gs_local-YYYY-MM-DD_HHMMSS.log`”中的日志信息排查错误。例如配置文件中“`$gaussdbLogPath`”参数指定的路径为“`/var/log/gaussdb`”,则“`$GAUSSLOG/om`”路径为“`/var/log/gaussdb/omm/om`”,omm用户为运行openGauss的用户。
+
+
+### **四、部署安装openGauss软件**
-## 四、部署安装openGauss软件
+
```shell
## 执行安装脚本
@@ -427,16 +562,18 @@ cd /soft/openGauss/script
./gs_install -X /soft/openGauss/clusterconfig.xml ## 密码复杂度要求:大写+小写+数字+特殊字符(任选3类,至少8位)
```
-**说明:**
-
-- 默认字符集与操作系统设置保持一致,也可以在数据库初始化时使用-E参数指定数据库的字符集为GBK/UTF-8/Latinl,默认字符集为SQL_ASCII
-- openGauss支持字符集的多种写法:gbk/GBK、UTF-8/UTF8/utf8/utf-8、Latinel/latinel
-- 执行gs_install脚本时,如果输入参数–autostart=no, 则工具脚本在配置(config)步骤完成后退出,不会自动启动openGauss,需要用户通过执行gs_om -t start命令手动启动。
-- 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为集群openGauss配置文件中指定的程序安装目录。日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”
+**说明:**
+1> 默认字符集与操作系统设置保持一致,也可以在数据库初始化时使用-E参数指定数据库的字符集为GBK/UTF-8/Latin1,默认字符集为SQL_ASCII;
+2> openGauss支持字符集的多种写法:gbk/GBK、UTF-8/UTF8/utf8/utf-8、Latine1/latine1;
+3> 执行gs_install脚本时,如果输入参数–autostart=no, 则工具脚本在配置(config)步骤完成后退出,不会自动启动openGauss,需要用户通过执行gs_om -t start命令手动启动;
+4> 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为集群openGauss配置文件中指定的程序安装目录。日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”.
+
+
+### **五、安装验证**
-## 五、安装验证
+
```shell
su - root
@@ -445,12 +582,14 @@ cd /soft/openGauss/script/
./gs_checkos -i B
```
+
+
+### **六、初始化数据库**
-## 六、初始化数据库
-
-**方法一:脚本初始化 (*经测试,该脚本运行异常,执行初始化后又自动将文件删除,最终初始化无效*)**
+
+##### **方法一:脚本初始化 (*经测试,该脚本运行异常,执行初始化后又自动将文件删除,最终初始化无效*)**
```shell
## 命令示例:
gs_initdb -E UTF-8 --locale=zh_CN.UTF-8 /opt/gaussdb/data/data_n1 --nodename dn1 -w "Bigdata@123"
@@ -482,16 +621,18 @@ creating performance views ... ok
loading system objects' descriptions ... gs_initdb: removing data directory "/gauss/data/db1/tmp" ## 自动删除了数据目录
```
-**方法二:gsql方式**
+
+##### **方法二:gsql方式**
```shell
# gsql -d postgres -p 26000
postgres=# alter role omm identified by 'Gauss@123' replace 'Gauss_111';
postgres=# CREATE DATABASE mydb WITH ENCODING 'GBK' template = template0;
```
-**简单查询测试:**
+
+##### **简单查询测试:**
```shell
postgres=# select version();
postgres=# \l
@@ -507,9 +648,12 @@ postgres=# \l
| | | | | omm=CTc/omm
```
+
+
+### **七、卸载数据库**
-## 七、卸载数据库
+
```shell
## 登录主节点执行
@@ -520,23 +664,21 @@ gs_uninstall --delete-data -L # 仅卸载本地数据库
# 如果卸载失败请根据“$GAUSSLOG/om/gs_uninstall-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。
```
+
+
+### **八、清理系统环境配置**
-## 八、清理系统环境配置
-
- 在openGauss卸载完成后,如果不需要在环境上重新部署openGauss,可以运行脚本gs_postuninstall对openGauss服务器上环境信息做清理。openGauss环境清理是对环境准备脚本gs_preinstall所做设置的清理。
-
-1> 确保root用户SSH互信
-
-2> 执行清理脚本,如下:
+
+ 在openGauss卸载完成后,如果不需要在环境上重新部署openGauss,可以运行脚本gs_postuninstall对openGauss服务器上环境信息做清理。openGauss环境清理是对环境准备脚本gs_preinstall所做设置的清理。
+1> 确保root用户SSH互信
+2> 执行清理脚本,如下:
```shell
cd /opt/software/openGauss/script
./gs_postuninstall -U omm -X /opt/software/openGauss/clusterconfig.xml --delete-user --delete-group
./gs_postuninstall -U omm -X /opt/software/openGauss/clusterconfig.xml --delete-user --delete-group -L ## 仅清理本地环境
## 若为环境变量分离的模式安装的集群需删除之前source的环境变量分离的env参数
```
-
-3> 删除root的SSH互信,并删除ENVFILE环境变量:unset MPPDB_ENV_SEPARATE_PATH
-
+3> 删除root的SSH互信,并删除ENVFILE环境变量:`unset MPPDB_ENV_SEPARATE_PATH`
注意:若是共用的环境,需要加入--sep-env-file
\ No newline at end of file
diff --git a/content/zh/post/jiajunfeng/openGauss Single-inst HA Deployment (CentOS7.6+openGauss 1.0.0).md b/content/zh/post/jiajunfeng/openGauss Single-inst HA Deployment (CentOS7.6+openGauss 1.0.0).md
index 8aa9407d..251a9de3 100644
--- a/content/zh/post/jiajunfeng/openGauss Single-inst HA Deployment (CentOS7.6+openGauss 1.0.0).md
+++ b/content/zh/post/jiajunfeng/openGauss Single-inst HA Deployment (CentOS7.6+openGauss 1.0.0).md
@@ -9,38 +9,126 @@ img = "/zh/post/jiajunfeng/img/DBlogo-20200722.png"
times = "19:00"
+++
-# openGauss 单实例 HA 安装部署文档(CentOS7.6+openGauss 1.0.0)
-
-**说明:**
-
-- openGauss 支持单机部署和单机HA部署;
-- openGauss HA部署时,备机数量为1~4台;
-- openGauss 脚本安装仅支持单实例部署,如果一台主机部署多个实例,建议手动使用命令安装;
-- openGauss Connectors的Linux版本:JDBC、ODBC、libpq.
-
-
-
-## 一、环境准备
-
-IP地址规划
|
主机名
| db1.opengauss.com
| db2.opengauss.com
|
外网IP地址
| 192.168.124.11
| 192.168.124.12
|
内网IP地址
| 192.168.100.11
| 192.168.100.12
|
-
-**1.1 硬件需求**
-
-组件 | 最小配置要求 | 备注 |
CPU | 8c |
|
内存 | 32GB | 如果小于32GB,需要调整数据库内存参数
|
硬盘 | 1.5GB | 禁用磁盘的Disk Cache Policy
|
网卡速率 | 300MB | 建议做网卡bond
|
-
+# **openGauss 单实例 HA 安装部署文档(CentOS 7.6+openGauss 1.0.0)**
+
+
+
+##### **说明:**
+1> openGauss 支持单机部署和单机HA部署;
+2> openGauss HA部署时,备机数量为1~4台;
+3> openGauss 脚本安装仅支持单实例部署,如果一台主机部署多个实例,建议手动使用命令安装;
+4> openGauss Connectors的Linux版本:JDBC、ODBC、libpq.
+
+
+
+### **一、环境准备**
+
+
+
+
+
+ IP地址规划 |
+
+
+ 主机名 |
+ db1.opengauss.com |
+ db2.opengauss.com |
+
+
+ 外网IP地址 |
+ 192.168.124.11 |
+ 192.168.124.12 |
+
+
+ 后端IP地址 |
+ 192.168.100.11 |
+ 192.168.100.12 |
+
+
+
+
+
+
+#### 1.1 硬件需求
+
+
+
+
+
+ 组件 |
+ 最小配置要求 |
+ 备注 |
+
+
+ CPU |
+ 8c |
+ |
+
+
+ 内存 |
+ 32GB |
+ 如果小于32GB,需要调整数据库内存参数 |
+
+
+ 硬盘 |
+ 1.5GB |
+ 禁用磁盘的Disk Cache Policy |
+
+
+ 网卡 |
+ 300MB |
+ 建议做网卡bond |
+
+
+
+
+
+##### **检查硬件配置:**
```shell
-## 检查硬件配置
cat /proc/cpuinfo |grep processor
cat /etc/redhat-release
free -m
## 如果内存小于32GB,会因为内存不足导致数据库无法启动,此时需要修改shared_buffers和max_connections调整openGauss所需的内存
```
-**1.2 软件需求**
-
-条目 | 要求 |
Linux操作系统
| openEuler 20.3LTS/CentOS 7.6
|
Linux文件系统
| 剩余inode个数>15亿
|
工具
| Huawei JDK 1.8.0、psmisc、bzip2
|
Python
| openEuler: 支持Python 3.7.x CentOS 7.6:支持Python 3.6.x
|
其他依赖软件包
| libaio-devel >= 0.3.109-13 flex >= 2.5.31 bison >= 2.7.4 ncurses-devel >= 5.9-13.20130511 glibc-devel >= 2.17-111 patch >= 2.7.1-10 lsb_release >= 4.1 |
-
-**1.3 安装示例**
+
+
+#### 1.2 软件需求
+
+
+
+
+
+ 条目 |
+ 说明 |
+
+
+ Linux操作系统 |
+ openEuler 20.3LTS CentOS 7.6 |
+
+
+ Linux文件系统 |
+ 剩余inode个数 > 15亿 |
+
+
+ 工具 |
+ Huawei JDK 1.8.0、psmisc、bzip2 |
+
+
+ Python |
+ openEuler: 支持Python 3.7.x CentOS 7.6:支持Python 3.6.x |
+
+
+ 其他依赖软件包 |
+ libaio-devel >= 0.3.109-13 flex >= 2.5.31 bison >= 2.7.4 ncurses-devel >= 5.9-13.20130511 glibc-devel >= 2.17-111 patch >= 2.7.1-10 lsb_release >= 4.1 |
+
+
+
+
+
+#### 1.3 安装示例
+
+
```shell
## 当系统环境仅限内网使用时,可以配置系统镜像ISO作为默认YUM源,但是该YUM源(CentOS 7.6)默认不包含python3,需要手动编译安装。
@@ -67,7 +155,11 @@ lksctp-tools-doc-1.0.17-2.el7.x86_64
SCTP supported
```
-**1.4 Python3源码编译安装**
+
+
+#### 1.4 Python3源码编译安装
+
+
```shell
## Python3 源码编译安装耗时约30分钟
@@ -87,11 +179,15 @@ export LD_LIBRARY_PATH=/usr/python3.6.11/lib:$LD_LIBRARY_PATH
Python 3.6.11
```
+
+
+### ** 二、操作系统配置**
+
-# 二、操作系统配置
+#### 2.1 编辑Hosts文件
-**1.编辑Hosts文件**
+
```shell
vi /etc/hosts
@@ -101,7 +197,11 @@ vi /etc/hosts
--------------------
```
-**2.关闭防火墙**
+
+
+#### 2.2 关闭防火墙
+
+
```shell
systemctl status firewalld
@@ -109,7 +209,11 @@ systemctl disable firewalld.service
systemctl stop firewalld.service
```
-**3.关闭SELinux**
+
+
+#### 2.3 关闭SELinux
+
+
```shell
vi /etc/selinux/config
@@ -119,7 +223,11 @@ SELINUX=disabled
## SELinux的配置文件需要重启操作系统才可以生效,可以使用setenforce 0 使SELinux临时变更为Permissive状态,降低SELinux的影响。
```
-**4.修改字符集参数**
+
+
+#### 2.4 修改字符集参数
+
+
```shell
vi ~/.bash_profile
@@ -130,7 +238,11 @@ export LANG=en_US.UTF-8
source ~/.bash_profile
```
-**5.设置时区并统一主机时间**
+
+
+#### 2.5 设置时区并统一主机时间
+
+
```shell
## 检查时区和时间是否正确(建议生产环境开启NTP服务同步时间)
@@ -143,14 +255,22 @@ Fri Jul 17 15:49:08 CST 2020
[root@db1 ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
```
-**6.关闭SWAP**
+
+
+#### 2.6 关闭SWAP
+
+
```shell
vi /etc/fstab ## 注释掉swap分区挂载
swapoff -a ## 关闭swap
```
-**7.[可选]设置backupIP网卡的MTU值(建议8192)**
+
+
+#### 2.7 [可选]设置backupIP网卡的MTU值(建议8192)
+
+
```shell
vi /etc/sysconfig/network-scripts/ifcfg-ens34
@@ -162,7 +282,11 @@ MTU=8192 ## 可能需要网络工程师协助修改网络设备端口MTU配
ifconfig ens34 mtu 8192
```
-**8.配置SSH服务(允许root登录,关闭Banner)**
+
+
+#### 2.8 配置SSH服务(允许root登录,关闭Banner)
+
+
```shell
# 检查root登录配置和Banner的配置
@@ -178,13 +302,21 @@ PermitRootLogin yes ## 允许root用户远程登录
systemctl restart sshd.service
```
-**9.创建管理用户组(管理用户稍后使用脚本gs_preinstall创建)**
+
+
+#### 2.9 创建管理用户组(管理用户稍后使用脚本gs_preinstall创建)
+
+
```shell
groupadd dbgrp
```
-**10.配置内核参数**
+
+
+#### 2.10 配置内核参数
+
+
```shell
# vi /etc/sysctl.conf
@@ -238,7 +370,11 @@ vm.overcommit_ratio = 90
N
```
-**11.修改系统资源限制**
+
+
+#### 2.11 修改系统资源限制
+
+
```shell
vi /etc/security/limits.conf
@@ -257,7 +393,11 @@ vi /etc/security/limits.d/90-nproc.conf
## 说明:在使用gs_preinstall脚本后,limits资源虽然已经设置,但可能存在暂时不生效的情况,需要重启系统使之生效。
```
-**12.关闭透明页transparent_hugepage**
+
+
+#### 2.12 关闭透明页transparent_hugepage
+
+
```shell
vi /etc/default/grub
@@ -276,7 +416,11 @@ echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
```
-**13.[可选]网卡参数配置(配置万兆业务网卡[backIp1])**
+
+
+#### 2.13 [可选]网卡参数配置(配置万兆业务网卡[backIp1])
+
+
```shell
rx = 4096 # 预安装时是否由脚本自动设置
@@ -284,11 +428,16 @@ tx = 4096 # 预安装时是否由脚本自动设置
mtu = 8192 # 推荐值:8192,同时需要协调对网络端口做出相应调整
```
+
+
+### **三、预安装openGauss软件**
-# 三、预安装openGauss软件
+
-#### **1.Single-inst HA 配置clusterconfig.xml文件(仅在主节点配置即可)**
+#### 3.1 配置clusterconfig.xml文件(仅在主节点配置即可)
+
+
```shell
# vi clusterconfig.xml
@@ -346,32 +495,54 @@ mtu = 8192 # 推荐值:8192,同时需要协调对网络端口做出相应
------------------------------------------------
```
-
-实例名称
| 实例数据目录
| 备注
|
主DBnode
| /gauss/data/xxx
| 其中,xxx为当前主DBnode的名称
|
备DBnode
| /gauss/data/slaveX
| 其中,xxx为当前备DBnode的名称
|
+
+
+
+
+ 实例角色 |
+ 数据目录 |
+ 备注 |
+
+
+ 主DBNode |
+ /gauss/data/xxx |
+ 其中,xxx为当前主DBnode的名称 |
+
+
+ 备DBnode |
+ /gauss/data/slaveX |
+ 其中,xxx为当前备DBnode的名称 |
+
+
**备注:**
+
+1> dataListenIp1 ---> 监听的IP地址,用于接受其他数据库节点的连接。未设置时,使用对应主机上的backIp1生成。
+2> dataHaIp1 ---> 主、备DBnode通讯的IP地址。未设置时,使用对应主机上的backIp生成。value中需要设置主、备DBnode所在主机的IP地址。
+3> "/gauss/om"存放互信等工具,避免权限问题,不要把实例数据目录放在此目录下。
+4> 安装目录和数据目录需为空或者不存在,否则可能导致安装失败。
+5> 确保配置的目录之间不相互耦合。
+6> 若需要安装脚本自动创建安装用户时,各配置的目录需保证不与系统创建的默认用户目录耦合关联。
+7> 配置openGauss路径和实例路径时,路径中不能包含"|",";","&","$","<",">","\`","","","'","{","}","(",")","\[","]","~","\*","?"特殊字符。
+8> 配置数据库节点名称时,"name"和"nodeNames"的值应该与hostname命令获取数据库节点的主机名称保持一致。
+9> 配置文件中所有IP参数(backIP、sshIP、listenIP等)均只支持配置一个IP,如果配置第二个IP参数,则不会读取第二个参数的配置值。
-- dataListenIp1 ---> 监听的IP地址,用于接受其他数据库节点的连接。未设置时,使用对应主机上的backIp1生成。
-- dataHaIp1 ---> 主、备DBnode通讯的IP地址。未设置时,使用对应主机上的backIp生成。value中需要设置主、备DBnode所在主机的IP地址。
-- "/gauss/om"存放互信等工具,避免权限问题,不要把实例数据目录放在此目录下。
-- 安装目录和数据目录需为空或者不存在,否则可能导致安装失败。
-- 确保配置的目录之间不相互耦合。
-- 若需要安装脚本自动创建安装用户时,各配置的目录需保证不与系统创建的默认用户目录耦合关联。
-- 配置openGauss路径和实例路径时,路径中不能包含"|",";","&","$","<",">","`","","","'","{","}","(",")","[","]","~","*","?"特殊字符。
-- 配置数据库节点名称时,"name"和"nodeNames"的值应该与hostname命令获取数据库节点的主机名称保持一致。
-- 配置文件中所有IP参数(backIP、sshIP、listenIP等)均只支持配置一个IP,如果配置第二个IP参数,则不会读取第二个参数的配置值。
+
-#### 2.环境初始化
+#### ** 3.2 环境初始化**
-**2.1 在主、备节点创建数据目录**
+
+#### 3.2.1 在主、备节点创建数据目录:
```shell
mkdir /gauss
chgrp dbgrp -R /gauss
chmod 775 -R /gauss
```
-**2.2 解压安装包文件**
+
+
+#### 3.2.2 解压安装包文件
```shell
mkdir -p /soft/openGauss
@@ -382,12 +553,12 @@ cd /soft/openGauss
tar -zxvf openGauss-1.0.0-CentOS-64bit.tar.gz
```
-**2.3 交互式安装**
-
- 若是共用的环境,需要加入--sep-env-file=ENVFILE参数分离环境变量,避免与其他用户相互影响。
+
- 在openGauss的安装过程中,需要在openGauss中主机间执行命令,传送文件等操作,故在普通用户安装前需要确保互信是连通的。前置脚本中会先建立root用户间的互信,然后创建普通用户,并建立普通用户间的互信,安装完毕后即可删除root用户的互信。
+#### 3.2.3 交互式安装
+**注意:** 若是共用的环境,需要加入--sep-env-file=ENVFILE参数分离环境变量,避免与其他用户相互影响。
+ 在openGauss的安装过程中,需要在openGauss中主机间执行命令,传送文件等操作,故在普通用户安装前需要确保互信是连通的。前置脚本中会先建立root用户间的互信,然后创建普通用户,并建立普通用户间的互信,安装完毕后即可删除root用户的互信。
```shell
export LD_LIBRARY_PATH=/soft/openGauss/script/gspylib/clib:/usr/python3.6.11/lib:$LD_LIBRARY_PATH
cd /soft/openGauss/script
@@ -496,7 +667,9 @@ Successfully set finish flag.
Preinstallation succeeded.
```
-**2.4 执行脚本对主、备节点进行检查**
+
+
+#### 3.2.4 执行脚本对主、备节点进行检查
```shell
[root@db1 script]# /soft/openGauss/script/gs_checkos -i A -h db1.opengauss.com,db2.opengauss.com --detail
@@ -544,9 +717,12 @@ Total numbers:14. Abnormal numbers:0. Warning numbers:1.
[root@db2 ~]# reboot
```
- 当不允许创建root用户互信时,在各主机上使用创建的omm用户执行本地模式前置,然后用户手动创建openGauss用户互信:如果预安装指定-L参数,预安装前需手动将所有节点的主机名和IP映射关系,写入各个主机的/etc/hosts文件,并在每个映射关系后添加注释内容"*#Gauss OM IP Hosts Mapping*".
+##### **注意:**
+ 当不允许创建root用户互信时,在各主机上使用创建的omm用户执行本地模式前置,然后用户手动创建openGauss用户互信:如果预安装指定-L参数,预安装前需手动将所有节点的主机名和IP映射关系,写入各个主机的/etc/hosts文件,并在每个映射关系后添加注释内容"*#Gauss OM IP Hosts Mapping*".
-**2.5 (可选)使用脚本手动创建互信,并执行本地预安装脚本**
+
+
+#### 3.2.5 (可选)使用脚本手动创建互信,并执行本地预安装脚本
```shell
vi /soft/hostfile
@@ -562,7 +738,9 @@ cd /soft/openGauss/script
./gs_preinstall -U omm -G dbgrp -L -X /soft/openGauss/clusterconfig.xml ##在每个节点手动执行
```
-**2.6 (可选参考)非交互式安装**
+
+
+#### 3.2.6 (可选参考)非交互式安装
```shell
## 手动创建互信(脚本)
@@ -580,14 +758,17 @@ cd /soft/openGauss/script
```
**错误排查:**
+如果准备安装环境失败请根据openGauss日志目录“`$GAUSSLOG/om`”下的“`gs_preinstall-YYYY-MM-DD_HHMMSS.log`”和“`gs_local-YYYY-MM-DD_HHMMSS.log`”中的日志信息排查错误。例如配置文件中“`$gaussdbLogPath`”参数指定的路径为“`/var/log/gaussdb`”,则“`$GAUSSLOG/om`”路径为“`/var/log/gaussdb/omm/om`”,omm用户为运行openGauss的用户。
- 如果准备安装环境失败请根据openGauss日志目录“`$GAUSSLOG/om`”下的“`gs_preinstall-YYYY-MM-DD_HHMMSS.log`”和“`gs_local-YYYY-MM-DD_HHMMSS.log`”中的日志信息排查错误。例如配置文件中“`$gaussdbLogPath`”参数指定的路径为“`/var/log/gaussdb`”,则“`$GAUSSLOG/om`”路径为“`/var/log/gaussdb/omm/om`”,omm用户为运行openGauss的用户。
+
+### **四、部署安装openGauss软件**
+
-## 四、部署安装openGauss软件
+#### **4.1 执行安装脚本(仅在主节点执行即可)**
-#### 4.1 执行安装脚本(仅在主节点执行即可)
+
```shell
## 执行完毕preinstall脚本后,建议重启操作系统,否则请手动设置max user process参数
@@ -634,17 +815,20 @@ Successfully installed application.
end deploy..
```
-**说明:**
+##### **说明:**
+1> 默认字符集与操作系统设置保持一致,也可以在数据库初始化时使用-E参数指定数据库的字符集为GBK/UTF-8/Latin1,默认字符集为SQL_ASCII
+2> openGauss支持字符集的多种写法:gbk/GBK、UTF-8/UTF8/utf8/utf-8、Latine1/latine1
+3> 执行gs_install脚本时,如果输入参数–autostart=no, 则工具脚本在配置(config)步骤完成后退出,不会自动启动openGauss,需要用户通过执行gs_om -t start命令手动启动
+4> 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为集群openGauss配置文件中指定的程序安装目录。日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”
+5> 主、备数据库Single-inst HA安装完毕后,节点间互通则使用omm用户,从安全角度考虑,可以删除root用户的SSH互信
-- 默认字符集与操作系统设置保持一致,也可以在数据库初始化时使用-E参数指定数据库的字符集为GBK/UTF-8/Latinl,默认字符集为SQL_ASCII
-- openGauss支持字符集的多种写法:gbk/GBK、UTF-8/UTF8/utf8/utf-8、Latinel/latinel
-- 执行gs_install脚本时,如果输入参数–autostart=no, 则工具脚本在配置(config)步骤完成后退出,不会自动启动openGauss,需要用户通过执行gs_om -t start命令手动启动
-- 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为集群openGauss配置文件中指定的程序安装目录。日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”
-- 主、备数据库Single-inst HA安装完毕后,节点间互通则使用omm用户,从安全角度考虑,可以删除root用户的SSH互信
+
-#### 4.2 备机可读(可选)
+#### **4.2 备机可读(可选)**
-**1> 关闭cluster集群(仅在主节点执行即可)**
+
+
+#### 1> 关闭cluster集群(仅在主节点执行即可)
```shell
[omm@db1 ~]$ gs_om -t stop
@@ -655,7 +839,9 @@ Successfully stopped cluster.
End stop cluster.
```
-**2> 分别修改主、备库postgres.conf文件**
+
+
+#### 2> 分别修改主、备库postgres.conf文件
```shell
cd /gauss/data/db1/ ## 备库路径在/gauss/data/slavedb2/
@@ -668,7 +854,9 @@ hot_standby_feedback = on ## 默认值 off
-----------------------------------
```
-**3> 启动cluster集群(仅在主节点执行即可)**
+
+
+#### 3> 启动cluster集群(仅在主节点执行即可)
```shell
[omm@db1 db1]$ gs_om -t start
@@ -678,9 +866,13 @@ Starting cluster.
Successfully started.
```
+
+
+
+### **五、安装验证**
-## 五、安装验证
+
```shell
su - root
@@ -720,9 +912,12 @@ NOTICE: MTU value and some warning items can NOT be set. Please do it manually.
Total numbers:7. Abnormal numbers:0. Warning numbers:0.
```
+
+
+### **六、集群的基本管理操作**
-## 六、集群的基本管理操作
+
**6.1 启动集群**
@@ -734,6 +929,8 @@ Starting cluster.
Successfully started.
```
+
+
**6.2 停止集群**
```shell
@@ -745,6 +942,8 @@ Successfully stopped cluster.
End stop cluster.
```
+
+
**6.3 集群状态检查**
```shell
@@ -763,6 +962,8 @@ node node_ip instance state
2 db2.opengauss.com 192.168.100.12 6002 /gauss/data/slavedb2 S Standby Normal
```
+
+
**6.4 集群的主/备切换测试**
```shell
@@ -810,9 +1011,11 @@ Generating dynamic configuration file for all nodes.
Successfully generated dynamic configuration file.
```
+
+### **七、配置数据库区域和字符集**
-## 七、配置数据库区域和字符集
+
**示例一:脚本初始化数据库(*脚本可能存在异常,测试时不生效*)**
@@ -848,6 +1051,8 @@ creating performance views ... ok
loading system objects' descriptions ... gs_initdb: removing data directory "/gauss/data/db1/tmp" ## 最终自动清空了数据目录,不生效
```
+
+
**示例二:gsql方式新建库**
```shell
@@ -870,35 +1075,48 @@ postgres=# \l
| | | | | omm=CTc/omm
```
+
+
+### **附录1:【手动创建SSH互信的方法】**
-## 附录1:【手动创建SSH互信的方法】
+
-**1> 生成本地秘钥Key(每个主机执行一遍)**
+#### 1> 生成本地秘钥Key(每个主机执行一遍)
```shell
ssh-keygen -t rsa
cat .ssh/id_rsa.pub >> .ssh/authorized_keys ##生成本机授权
```
-**2> 收集各节点公钥至本机的known_hosts**
+
+
+#### 2> 收集各节点公钥至本机的known_hosts
```shell
ssh-keyscan -t rsa db1 >> ~/.ssh/known_hosts
ssh-keyscan -t rsa db2 >> ~/.ssh/known_hosts
```
-**3> 将互信文件分发给其他所有主机**
+
+
+#### 3> 将互信文件分发给其他所有主机
```shell
scp -r .ssh db2:~
```
-**4> ssh登录测试**
+
+
+#### 4> ssh登录测试
+
+
+
+### **附录2:【卸载数据库】**
-## 附录2:【卸载数据库】
+
```shell
su - omm
--
Gitee
From f21c4c669c1aa676e2b3fa17e0c7f8a0e9fe876b Mon Sep 17 00:00:00 2001
From: jia_junfeng1 <287523394@qq.com>
Date: Wed, 12 Aug 2020 11:22:06 +0800
Subject: [PATCH 2/2] add doc:openGauss compilation with Installing Python3
offline and Compiling binarylibs manually
---
...fline and Compiling binarylibs manually.md | 402 ++++++++++++++++++
1 file changed, 402 insertions(+)
create mode 100644 content/zh/post/jiajunfeng/openGauss compilation with Installing Python3 offline and Compiling binarylibs manually.md
diff --git a/content/zh/post/jiajunfeng/openGauss compilation with Installing Python3 offline and Compiling binarylibs manually.md b/content/zh/post/jiajunfeng/openGauss compilation with Installing Python3 offline and Compiling binarylibs manually.md
new file mode 100644
index 00000000..e3b65be0
--- /dev/null
+++ b/content/zh/post/jiajunfeng/openGauss compilation with Installing Python3 offline and Compiling binarylibs manually.md
@@ -0,0 +1,402 @@
++++
+title = "openGauss源码编译(离线安装Python3 && 手动编译第三方软件源码)"
+date = "2020-08-12"
+tags = ["openGauss安装部署"]
+archives = "2020-08"
+author = "贾军锋"
+summary = "openGauss源码编译(离线安装Python3 && 手动编译第三方软件源码)"
+img = "/zh/post/jiajunfeng/img/DBlogo-20200722.png"
+times = "10:00"
++++
+# **openGauss源码编译**
+
+**(离线安装Python3 && 手动编译第三方软件源码)**
+
+
+**模拟场景:**
+
+
+* 安全要求:客户现场服务器无法连外网,无法使用外部YUM源;
+* 安全要求:第三方开源软件需要使用最新的源码包,修复已知的软件漏洞;
+* 功能需求:客户要求特定版本的软件包,以满足特定功能需求。
+
+
+**测试环境:**
+CPU: 16c
+内存:32GB
+OS: CentOS 7.6
+openGauss版本:1.0.0
+
+
+**源码包下载地址:**
+https://gitee.com/opengauss/openGauss-third_party ## 第三方依赖包
+https://gitee.com/opengauss/openGauss-server ## openGauss-server
+https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.0.0/openGauss-third_party_binarylibs.tar.gz ## 已编译好的binarylibs (可选)
+
+
+**本次下载的软件包:**
+opengauss-openGauss-third_party-master.zip
+opengauss-openGauss-server-master.zip
+本次计划使用openGauss-third_party代码仓库自行编译binarylibs,以便使用最新的第三方代码仓库。
+
+
+
+**一、安装依赖包**
+
+
+1. 本地YUM安装必要的依赖包
+
+
+```shell
+yum install -y autoconf gcc gcc-c++ libaio-devel ncurses-devel pam-devel libffi-devel libtool unzip python
+yum install -y java-1.8.0-openjdk* psmisc bzip2
+yum install -y flex bison glibc-devel patch redhat-lsb-core lksctp*
+yum install wget yum-utils net-tools -y
+yum install perl-parent \
+perl-HTTP-Tiny \
+perl-podlators \
+perl-Pod-Perldoc \
+perl-Pod-Escapes \
+perl-Text-ParseWords \
+perl-Encode \
+perl-Pod-Usage \
+perl-libs \
+perl-macros \
+perl-Time-HiRes \
+perl-constant \
+perl-Socket \
+perl-Time-Local \
+perl-Carp \
+perl-Storable \
+perl-PathTools \
+perl-Scalar-List-Utils \
+perl-Exporter \
+perl-threads-shared \
+perl-threads \
+perl-Filter \
+perl-File-Temp \
+perl-File-Path \
+perl-Pod-Simple \
+perl-Getopt-Long \
+perl-srpm-macros \
+perl -y
+yum install dwz zip redhat-rpm-config libtirpc -y
+yum install rsync -y ## 编译snappy时需要调用rsync同步写入数据
+```
+
+
+2. RPM安装Python3.6.8
+
+```shell
+rpm -ivh python-srpm-macros-3-32.el7.noarch.rpm
+rpm -ivh python-rpm-macros-3-32.el7.noarch.rpm
+rpm -ivh python3-rpm-macros-3-32.el7.noarch.rpm
+
+## 以下4个包(python3-pip/python3/python3-libs/python3-setuptools)存在互相依赖性,必须同时安装
+rpm -ivh python3-pip-9.0.3-7.el7_7.noarch.rpm python3-3.6.8-13.el7.x86_64.rpm python3-libs-3.6.8-13.el7.x86_64.rpm python3-setuptools-39.2.0-10.el7.noarch.rpm
+
+rpm -ivh python3-rpm-generators-6-2.el7.noarch.rpm
+rpm -ivh python3-devel-3.6.8-13.el7.x86_64.rpm
+
+[root@db3 ~]# rpm -qa|grep python3
+python3-rpm-macros-3-32.el7.noarch
+python3-setuptools-39.2.0-10.el7.noarch
+python3-pip-9.0.3-7.el7_7.noarch
+python3-devel-3.6.8-13.el7.x86_64
+python3-libs-3.6.8-13.el7.x86_64
+python3-3.6.8-13.el7.x86_64
+python3-rpm-generators-6-2.el7.noarch
+```
+
+**Tips:**
+ 若源码编译安装python3,则在编译安装openGauss-third_party时提示缺少python3-devel软件包,该问题暂时没有解决。故此处使用RPM方式离线安装Python3.6.8
+
+
+3. 解压openGauss-third_party,并拷贝gcc 8.2.0源码至buildtools/gcc
+
+gcc 8.2.0下载地址:ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-8.2.0/
+```shell
+[root@db3 ~]# cd /soft/
+[root@db3 soft]# ll
+total 748396
+-rw-r--r-- 1 root root 113811063 Aug 10 10:31 gcc-8.2.0.tar.gz
+-rw-r--r-- 1 root root 147678385 Aug 10 10:31 opengauss-openGauss-server-master.zip
+-rw-r--r-- 1 root root 504861386 Aug 10 10:31 opengauss-openGauss-third_party-master.zip
+[root@db3 soft]# unzip opengauss-openGauss-third_party-master.zip
+[root@db3 soft]# cp gcc-8.2.0.tar.gz /soft/openGauss-third_party/buildtools/gcc/
+```
+
+
+
+**二、 开源软件编译构建,生成binarylibs**
+
+
+1. 修改默认python版本为python3
+
+```shell
+[root@db3 soft]# python3 -V
+Python 3.6.8
+[root@db3 soft]# python -V
+Python 2.7.5
+[root@db3 gcc]# mv /usr/bin/python /usr/bin/python_bak
+[root@db3 gcc]# ln -s /usr/bin/python3 /usr/bin/python
+[root@db3 soft]# python -V
+Python 3.6.8
+```
+
+**Tips:**
+ 由于YUM命令需要调用python2.7.5的软件包,为了使得在更改默认python版本后,yum依旧可用,请修改/usr/bin/yum,修改调用的python路径为/usr/bin/python2.
+
+
+2. 执行编译
+
+```shell
+[root@db3 ~]# cd /soft/openGauss-third_party/build
+[root@db3 build]# sh build_all.sh
+[BUILD] buildtools .................... OK [3221.56s]
+[BUILD] dependency .................... FAILED [3031.07s] --编译报错,解决参考方法见下文
+
+[root@db3 ~]# cd /soft/openGauss-third_party/build
+[root@db3 build]# tail -fn 200 buildtools_build.log
+[BUILD] gmp ........................... OK [ 48.73s]
+[BUILD] mpfr .......................... OK [ 107.56s]
+[BUILD] mpc ........................... OK [ 26.66s]
+[BUILD] isl ........................... OK [ 113.22s]
+[BUILD] gcc ........................... OK [2504.84s]
+[BUILD] cmake ......................... OK [ 397.48s]
+total time:3221.54
+```
+
+
+-- 编译完毕gcc后,请在环境变量中指定新gcc的动态库路径,否则后期编译会报错(例如:arrows)
+
+```shell
+export LD_LIBRARY_PATH=/soft/binarylibs/buildtools/centos7.6_x86_64/gcc8.2/gcc/lib:/soft/binarylibs/buildtools/centos7.6_x86_64/gcc8.2/gmp/lib:/soft/binarylibs/buildtools/centos7.6_x86_64/gcc8.2/isl/lib:/soft/binarylibs/buildtools/centos7.6_x86_64/gcc8.2/mpc/lib:/soft/binarylibs/buildtools/centos7.6_x86_64/gcc8.2/mpfr/lib:$LD_LIBRARY_PATH
+```
+
+
+-- 创建必要目录,否则snappy/arrow编译会报错
+
+```shell
+mkdir -p /soft/openGauss-third_party/dependency/snappy/install_comm/lib/lib64
+mkdir -p /soft/openGauss-third_party/dependency/arrow/install_comm/lib/lib64
+```
+
+
+-- 查看dependency的编译情况
+
+```shell
+[root@db3 build]# tail -fn 200 dependency_build.log
+[BUILD] boost ......................... OK [ 95.75s]
+[BUILD] cJSON ......................... OK [ 0.58s]
+[BUILD] zlib .......................... OK [ 3.22s]
+[BUILD] openssl ....................... OK [ 169.54s]
+[BUILD] libevent ...................... OK [ 25.12s]
+[BUILD] jemalloc ...................... OK [ 88.80s]
+[BUILD] kerberos ...................... OK [ 80.25s]
+[BUILD] libcurl ....................... OK [ 60.67s]
+[BUILD] libedit ....................... OK [ 13.82s]
+[BUILD] lz4 ........................... OK [ 11.09s]
+[BUILD] llvm .......................... OK [1825.41s]
+[BUILD] ncurses ....................... OK [ 62.81s]
+[BUILD] protobuf ...................... OK [ 330.58s]
+[BUILD] libxml2 ....................... OK [ 42.38s]
+[BUILD] libcgroup ..................... OK [ 15.33s]
+[BUILD] libthrift ..................... OK [ 100.10s]
+[BUILD] double-conversion ............. OK [ 4.20s]
+[BUILD] brotli ........................ OK [ 8.91s]
+[BUILD] snappy ........................ OK [ 11.58s]
+## snappy编译完毕后,立即拷贝snappy的lib库文件(本次默认路径:/soft/openGauss-third_party/dependency/snappy/install_comm/lib/lib64/lib64)至/soft/openGauss-third_party/dependency/snappy/install_comm/lib,否则arrow编译安装报错。
+[BUILD] zstd .......................... OK [ 20.55s]
+[BUILD] glog .......................... OK [ 26.35s]
+[BUILD] flatbuffers ................... OK [ 26.85s]
+[BUILD] rapidjson ..................... OK [ 0.25s]
+[BUILD] arrow ......................... FAILED [ 3.56s]
+```
+
+
+3. 断点开始重新编译dependency
+
+ build_all.sh脚本主要编译3个items:buildtools、dependency、platform。由于每个item编译耗时较长,重新全部依次编译每个模块使得效率非常低。从编译脚本内容和引用部分可以看到,如果想跳过已经编译成功的软件包,需要修改脚本如下:
+ 1> build_all.sh :控制编译哪类模块(buildtools、dependency、platform);
+ 2> build_buildtools.sh:控制编译buildtools模块的哪些软件包(路径:openGauss-third_party/buildtools/build/);
+ 3> build_dependency.sh:控制编译dependency模块的哪些软件包(路径:openGauss-third_party/dependency/build);
+ 4> build_platform.sh:控制编译platform模块的哪些软件包(路径:openGauss-third_party/platform/build)。
+
+
+**Tips:**
+ 建议不要在每一个软件包目录下手动执行build.sh进行逐个编译,这样不但工作量很大,而且在实测中发现手动执行会有很多报错。
+ 本次编译buildtools模块的软件正常,dependency模块部分存在错误。所以,拟保留buildtools模块的软件不再进行重复的编译,dependency模块的前18个正常的软件不再做重复编译。即,从dependency模块的snappy软件包开始重新进行编译。
+修改脚本代码如下:
+
+```shell
+-- 剔除对buildtools模块相关软件的重复编译
+[root@db3 ~]# cd /soft/openGauss-third_party/build
+[root@db3 build]# cp build_all.sh build_all.sh.bak
+[root@db3 build]# vi build_all.sh
+---------------------------------
+##注释掉
+# build_item buildtools
+---------------------------------
+
+-- 剔除对dependency模块前18个软件的重复编译
+[root@db3 ~]# cd /soft/openGauss-third_party/dependency/build
+[root@db3 build]# vi build_dependency.sh
+---------------------------------
+##注释掉
+# build_first ## 注释调用前15个软件包的编译函数
+# build_item libthrift ## 注释 libthrift 软件包的编译
+# build_item double-conversion ## 注释 double-conversion 软件包的编译
+# build_item brotli ## 注释 brotli 软件包的编译
+---------------------------------
+```
+
+
+-- 重新执行build_all.sh脚本编译
+
+```shell
+[root@db3 ~]# tail -fn 200 /soft/openGauss-third_party/build/dependency_build.log
+[BUILD] snappy ........................ OK [ 13.78s]
+ ## snappy编译完毕后,立即手动执行以下操作:
+ [root@db3 ~]# cd /soft/openGauss-third_party/dependency/snappy/install_comm/lib
+ [root@db3 lib]# cp -r lib64/lib64/* .
+[BUILD] zstd .......................... OK [ 26.91s]
+[BUILD] glog .......................... OK [ 29.45s]
+[BUILD] flatbuffers ................... OK [ 54.75s]
+[BUILD] rapidjson ..................... OK [ 0.44s]
+[BUILD] arrow ......................... OK [ 79.57s]
+[BUILD] orc ........................... OK [ 55.36s]
+[BUILD] c-ares ........................ OK [ 79.10s]
+[BUILD] grpc .......................... OK [ 104.49s]
+[BUILD] pcre .......................... OK [ 14.39s]
+[BUILD] libiconv ...................... OK [ 45.46s]
+[BUILD] nghttp2 ....................... OK [ 22.08s]
+[BUILD] esdk_obs_api .................. OK [ 128.99s]
+[BUILD] numactl ....................... OK [ 6.62s]
+[BUILD] memcheck ...................... OK [ 0.80s]
+[BUILD] six ........................... OK [ 1.34s]
+[BUILD] pycparser ..................... OK [ 1.44s]
+[BUILD] cffi .......................... OK [ 5.96s]
+[BUILD] bcrypt ........................ OK [ 2.94s]
+[BUILD] idna .......................... OK [ 1.36s]
+[BUILD] ipaddress ..................... OK [ 1.05s]
+[BUILD] netifaces ..................... OK [ 4.39s]
+[BUILD] pynacl ........................ OK [ 193.55s]
+[BUILD] asn1crypto .................... OK [ 1.36s]
+[BUILD] cryptography .................. OK [ 33.96s]
+[BUILD] pyOpenSSL ..................... OK [ 1.09s]
+[BUILD] paramiko ...................... OK [ 1.37s]
+[BUILD] psutil ........................ OK [ 3.27s]
+[BUILD] pyasn1 ........................ OK [ 1.39s]
+total time:887.78
+```
+
+
+4. 自动编译platform组件(承接上一步,脚本自动执行编译安装)
+
+```shell
+[root@db3 build]# sh build_all.sh
+[BUILD] dependency .................... OK [ 887.81s]
+[BUILD] platform ...................... OK [ 10.60s]
+total time:898.43
+
+[root@db3 build]# cat platform_build.log
+[BUILD] securec ....................... OK [ 6.34s]
+total time:10.57
+```
+
+
+
+**三、开源软件一键式编译**
+
+
+1. 拷贝libparquet的lib至正确的目录中
+
+
+```shell
+[root@db3 ~]# cp -r /soft/binarylibs/dependency/centos7.6_x86_64/libparquet/comm/lib/lib64/lib64/* /soft/binarylibs/dependency/centos7.6_x86_64/libparquet/comm/lib
+```
+
+
+2. 解压并执行编译
+
+```shell
+[root@db3 ~]# cd /soft
+[root@db3 soft]# unzip opengauss-openGauss-server-master.zip
+[root@db3 soft]# mv openGauss-server /gaussdb
+[root@db3 soft]# cd /gaussdb
+[root@db3 gaussdb]# sh build.sh -m release -3rd /soft/binarylibs
+ROOT_DIR : /gaussdb
+Everything is ready.
+begin to make distclean
+Begin configure, Please wait a few minutes...
+End configure
+Begin make compile database, Please wait a few minutes...
+make compile sucessfully!
+```
+
+
+-- (可选)也可以仅生成package
+
+
+```shell
+[root@db3 gaussdb]# sh build.sh -3rd /soft/binarylibs -pkg
+ROOT_DIR : /gaussdb
+Everything is ready.
+begin to make distclean
+Begin configure, Please wait a few minutes...
+End configure
+Begin make compile database, Please wait a few minutes...
+make compile sucessfully!
+[make single db] 20-08-11 19:26:02: script dir : /gaussdb/package
+binarylib dir : /soft/binarylibs/
+ssl.sh is a shell file, do not separate symbol
+certs.py is a script, do not separate symbol
+......(略)
+OBS.ini is a ini file, do not separate symbol
+get_PlatForm_str.sh is a shell file, do not separate symbol
+Start package gaussdb.
+/gaussdb/dest
+success!
+packaging libpq...
+success!
+End package gaussdb.
+clean enviroment
+now, all packages has finished!
+
+[root@db3 ~]# cd /gaussdb/package/
+[root@db3 package]# ll
+total 416768
+-rw-r--r-- 1 root root 153503 Aug 11 19:37 make_package.log
+-rw-r--r-- 1 root root 4829056 Aug 11 19:37 openGauss-1.0.0-CentOS-64bit-Libpq.tar.gz
+-rwxr-xr-x 1 root root 350337112 Aug 11 19:30 openGauss-1.0.0-CentOS-64bit-symbol.tar.gz
+-rw-r--r-- 1 root root 71404948 Aug 11 19:37 openGauss-1.0.0-CentOS-64bit.tar.gz
+-rwxr-xr-x 1 root root 24785 Aug 11 18:09 package.sh
+-rwxr-xr-x 1 root root 4744 Aug 11 18:09 separate_debug_information.sh
+-rw-r--r-- 1 root root 24 Aug 11 19:30 version.cfg
+```
+
+
+**日志路径:**
+
+编译后软件安装路径为:`/soft/openGauss-server/dest`
+编译后的二进制放置路径为:`/soft/openGauss-server/dest/bin`
+编译日志为:`make_compile.log`
+
+
+**错误处理:**
+
+错误:“`g++: fatal error: Killed signal terminated program cclplus`” 报错
+报错原因:脚本中的编译过程都添加了-sj参数,并发数太大导致错误。
+解决办法:编译过程中降低make 并发数,或者直接使用make命令。如果使用一键式脚本则需要降低脚本make的并发数。
+
+
+
+
+
+
+
+
+
+
+
--
Gitee