华为高斯数据库(OpenGauss)一主一备安装实践

1.下载操作系统和数据库,并安装操作系统,操作系统记得选SERVER 版本,然后勾选上需要的系统软件

openEuler 20.03 LTS 下载地址

https://repo.openeuler.org/openEuler-20.03-LTS/ISO/x86_64/openEuler-20.03-LTS-everything-x86_64-dvd.iso

openGauss_3.0.0 企业版 下载地址

https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/x86_openEuler/openGauss-3.0.0-openEuler-64bit-all.tar.gz

2. 修改/etc/selinux/config文件中的“SELINUX”值为“disabled”

    vim /etc/selinux/config

    修改“SELINUX”的值“disabled”,执行:wq保存并退出修改。

3.检查防火墙状态,如果是开启状态,关闭防火墙并禁止开机启动

   [root@openGauss1 openGauss]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2022-07-20 16:12:57 CST; 21s ago
     Docs: man:firewalld(1)
 Main PID: 62058 (firewalld)
    Tasks: 2
   Memory: 24.2M
   CGroup: /system.slice/firewalld.service
           └─62058 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid

Jul 20 16:12:57 openGauss1 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jul 20 16:12:57 openGauss1 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@openGauss1 openGauss]# systemctl stop firewalld
[root@openGauss1 openGauss]# systemctl disable firewalld
 

4.设置字符集参数

vim /etc/profile

在文件的末尾加入

export LANG=UTF-8

5.设置时区和时间

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #有可能报错同个文件,直接忽略

多个节点的话,如果主机时间不一致使用如下命令同步主机时间
date -s "Sat Sep 27 16:00:07 CST 2020"

6.关闭swap内存交换

swapoff -a

7.修改/etc/systemd/logind.conf文件中的“RemoveIPC”值为“no”。

    vim /etc/systemd/logind.conf

      修改“RemoveIPC”的值“no”,执行:wq保存并退出修改。

8.重新配置加载,并查看修改是否已经生效

[root@openGauss1 openGauss]# systemctl daemon-reload
[root@openGauss1 openGauss]# systemctl restart systemd-logind
[root@openGauss1 openGauss]# loginctl show-session | grep RemoveIPC
RemoveIPC=no
[root@openGauss1 openGauss]# systemctl show systemd-logind | grep RemoveIPC
RemoveIPC=no
[root@openGauss1 openGauss]#

9.检查操作系统依赖包

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

redhat-lsb-core

建议版本:4.1

readline-devel

建议版本:7.0-13

libnsl(openEuler+x86环境中)

建议版本 :2.28-36

expect*(openEuler+x86环境中) 官方文档没有提到,但是不安装后续会报错[GAUSS-51405] : You need to install software:expect

用下面的命令一个包一个包的检查

[root@openGauss1 Packages]# rpm -qa |grep readline-devel

发现不存在就安装相应的package,U盘安装忽略mount这一步,直接到相应的盘符下寻找package

[root@openGauss1 Packages]# mount /dev/cdrom  /mnt

[root@openGauss1 Packages]# pwd
/mnt/Packages
[root@openGauss1 Packages]# ls |grep readline-devel
readline-devel-7.0-13.oe1.x86_64.rpm
[root@openGauss1 Packages]# rpm -i readline-devel-7.0-13.oe1.x86_64.rpm
warning: readline-devel-7.0-13.oe1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID b25e7f66: NOKEY
[root@openGauss1 Packages]# rpm -qa |grep readline
readline-7.0-13.oe1.x86_64
readline-devel-7.0-13.oe1.x86_64
 

10.修改hostname,使得hostname 命令得到的主机名称和 /etc/hosts的主机名称一致,重启系统以防有做的修改未生效

hostnamectl -sethostname openGauss1

[root@openGauss1 script]#   vi /etc/hosts

127.0.0.1   openGauss1 openGauss1.localdomain localhost4 localhost4.localdomain4
::1         openGauss1 openGauss1.localdomain localhost6 localhost6.localdomain6

 

11.重复上面的1-10步骤重建备机节点 openGauss2

12. root用户登录主机openGauss1,执行如下命令

 mkdir -p /opt/software/openGauss
 chmod 755 -R /opt/software

13.将下载好的数据库软件openGauss-3.0.0-openEuler-64bit-all.tar.gz 使用winscp或者U盘 

    copy到主机节点openGauss1 /opt/software/openGauss,然后执行如下命令

cd /opt/software/openGauss
tar -zxvf openGauss-x.x.x-openEuler-64bit-all.tar.gz
tar -zxvf openGauss-x.x.x-openEuler-64bit-om.tar.gz

14.进入到工具脚本存放目录下

  cd /opt/software/openGauss/script

15.如果是openEuler的操作系统为确保适配python版本

vi gspylib/common/CheckPythonVersion.py

将if not pythonVersion = = (3, 7):修改为if not pythonVersion > = (3, 7):,键入“ESC”键进入指令模式,执行:wq保存并退出修改。


16.修改performance.sh

 vim /etc/profile.d/performance.sh

用#注释sysctl -w vm.min_free_kbytes=112640 &> /dev/null,键入“ESC”键进入指令模式,执行**:wq**保存并退出修改。

17.创建cluster_config.xml,并修改相应的参数

[root@openGauss1 conf]# pwd
/opt/software/openGauss/script/gspylib/etc/conf
[root@openGauss1 conf]# cp cluster_config_template.xml  /opt/software/openGauss/cluster_config.xml

[root@openGauss1 conf]# vi /opt/software/openGauss/cluster_config.xml

修改后的文件内容如下

#192.168.50.32,openGauss1 分别为主节点1的IP和主机名称

#192.168.50.126,openGauss2 分别为备库节点2的IP和主机名称



 
   
   
   
   
   
   
   
   
 

 
   
     
     
     
     
     
     
     
     
     
     
   

   
     
     
     
     
     
   

 

 

18.使用gs_preinstall准备好安装环境,需要输入密码和设置密码的地方直接输入就可以

[root@openGauss1 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
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
Please enter password for root
Password:
[GAUSS-51400] : Failed to execute the command: rm -rf '/tmp/step_preinstall_file.dat'. Result:{'openGauss1': 'Failure', 'openGauss2': 'Failure'}.
Error:
[FAILURE] openGauss1:
[FAILURE] openGauss2:

[GAUSS-51632] : Failed to do gs_sshexkey.Error: [GAUSS-50306] : The password of 192.168.50.32 is incorrect.
Please enter password for current user[root].
[root@openGauss1 script]#  ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
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
Please enter password for root
Password:
Successfully created SSH trust for the root permission user.
Setting host ip env
Successfully set host ip env.
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[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Generate cluster user password files successfully.

Successfully created [omm] user on all nodes.
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.
Creating SSH trust for [omm] user.
Please enter password for current user[omm].
Password:
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Distributing trust keys file to all node successfully.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [omm] user.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h openGauss1,openGauss2 --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.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
 

19. 安装数据库

[root@openGauss1 openGauss]# su - omm
Last login: Wed Jul 20 15:27:23 CST 2022


Welcome to 4.19.90-2003.4.0.0036.oe1.x86_64

System information as of time:  Wed Jul 20 08:44:42 UTC 2022

System load:    0.00
Processes:      217
Memory used:    9.0%
Swap used:      0.0%
Usage On:       11%
IP address:     192.168.50.32
Users online:   1

[omm@openGauss1 software]$ 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.
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 /opt/huawei/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
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..

20. 连接数据库

[omm@openGauss2 local]$ gsql -d postgres -p 15400
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=# quit
openGauss-# exit
openGauss-# exit
openGauss-# ^C
openGauss=# ^C
openGauss=# ^C
openGauss=# help
You are using gsql, the command-line interface to gaussdb.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with gsql commands
       \g or terminate with semicolon to execute query
       \q to quit
openGauss=# \q
 


你可能感兴趣的:(数据库)