Categories
程式開發

GaussDB T 1.0.2 一主一備集群部署實戰


本文由 dbaplus 社群授權轉載。

GaussDB T 1.0.2版本已經發布了,此版本為GA版本,相比1.0.1版本穩定性和功能方面做了加強,華為後續也將要推出RAC版本。本文主要介紹當前GA版本下的主備集群方式安裝。

主備(一主一備)部署方案無CN,其中DN主機所在的節點為主節點,對外提供業務。

GaussDB T 1.0.2 一主一備集群部署實戰 1

集群中各組件功能:

  • CM:集群管理模塊(ClusterManager)。管理和監控分佈式系統中各個功能單元和物理資源的運行狀況,確保整個系統的穩定運行。
  • DN:數據節點(Datanode)。負責存儲業務數據,執行數據查詢任務以及返回執行結果。
  • ETCD:高可用分佈式鍵值(key-value)數據庫。負責存儲集群各個節點和實例集群狀態,便於集群CM管理各個實例。
  • Storage:服務器的本地存儲資源,持久化存儲數據。

一、環境準備

  • 操作系統:CentOS Linux release 7.5.1804 (Core)
  • 數據庫軟件:GaussDB_T_1.0.2-CLUSTER-CentOS-64bit.tar.gz

GaussDB T 1.0.2 一主一備集群部署實戰 2

二、安裝步驟

1、root遠程登錄權限修改(兩個節點均需操作)

sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/ PasswordAuthentication yes/g' /etc/ssh/sshd_config

修改完重啟sshd服務:

/bin/systemctl restart sshd.service

2、關閉防火牆和SELinux(兩個節點均需操作)

systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

3、配置corefile(兩個節點均需操作)

echo 'ulimit -c unlimited'>>/etc/profile
echo 'kernel.core_pattern =/opt/gdb/corefile/core-%e-%p-%t'>>/etc/sysctl.conf

使配置生效:

source /etc/profile
sysctl -p

4、檢查ntp和lsof(兩個節點均需操作)

rpm -qa|grep ntp

若沒有,使用yum安裝ntp:

yum install ntp
which lsof

若沒有,使用yum安裝lsof:

yum install lsof

5、創建數據庫安裝用戶組和用戶(兩個節點均需操作)

groupadd dbgrp
useradd -g dbgrp -d /home/omm -m -s /bin/bash omm

設置密碼:

passwd omm

6、創建存放軟件包的目錄/opt/software/gaussdb並上傳安裝包

mkdir -p /opt/software/gaussdb

[[email protected] gaussdb]# tar -zxvf GaussDB_T_1.0.2-CENTOS7.5-X86.tar.gz
[[email protected] gaussdb]# tar -zxvf GaussDB_T_1.0.2-CLUSTER-CentOS-64bit.tar.gz

[[email protected] gaussdb]# chmod 755 /opt/software/
[[email protected] gaussdb]# chmod -R 755 /opt/software/gaussdb/

7、從/opt/software/gaussdb/template獲取預置的配置文件,根據實際部署需求修改配置

[[email protected] ~]# vi /opt/software/gaussdb/clusterconfig.xml



 
  
  
  
  
  
  
  
  
  
  


  
  
  
  
  
  


 

  
  
   
   
     
   
   
   
   
   
    
   
   
   
   
   
   
   
   
   
   
   
   
  
  
  
  
   
   
     
   
   
   
   
    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
  
 

8、安裝python3.7(如果環境已安裝請忽略)

安裝依賴包:

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
yum install -y gcc

下載python3安裝包:

cd /root
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar -xvJf  Python-3.7.0.tar.xz

編譯安裝:

mkdir /usr/local/python3 #创建编译安装目录
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install

創建軟連接:

ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3

驗證下安裝:

python3 -V
pip3 –V

9、執行gs_preinstall準備環境

[[email protected] gaussdb]# cd /opt/software/gaussdb/script/
[[email protected] script]# ./gs_preinstall -U omm -G dbgrp –X /opt/software/gaussdb/clusterconfig.xml

GaussDB T 1.0.2 一主一備集群部署實戰 3

GaussDB T 1.0.2 一主一備集群部署實戰 4

10、檢測集群時間一致性

[[email protected] script]# ./gs_checkos -i B -h gauss1,gauss2 -X /opt/software/gaussdb/clusterconfig.xml

GaussDB T 1.0.2 一主一備集群部署實戰 5

11、執行安裝腳本

[[email protected] script]# su - omm
[[email protected] ~]$ gs_install -X /opt/software/gaussdb/clusterconfig.xml

GaussDB T 1.0.2 一主一備集群部署實戰 6

12、檢查集群狀態

GaussDB T 1.0.2 一主一備集群部署實戰 7

安裝完成!

三、安裝過程中報錯處理

1、執行./gs_preinstall報GAUSS-50204

[[email protected] script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.xml
[GAUSS-50204] : Failed to read cmServerRelation. The first item of cmServerRelation must be nodename.

解決:修改clusterconfig.xml文件中cmServerRelation值為gauss2,gauss1與nodeNames值對應。

2、執行./gs_preinstall報GAUSS-53011

[[email protected] script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.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: 
Creating SSH trust for the root permission user.
Successfully created SSH trust for the root permission user.
All host RAM is consistent
Distributing package.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking system resource.
[FAILURE] gauss1:
[GAUSS-53011] : Failed to check gatewayIP [192.168.238.10]. Please check gatewayIP config is vaild in your environment.
[FAILURE] gauss2:
[GAUSS-53011] : Failed to check gatewayIP [192.168.238.10]. Please check gatewayIP config is vaild in your environment.

解決:修改clusterconfig.xml文件中GatewayIP為虛擬機網關地址192.168.238.2。

3、檢測集群時間一致性有警告

[[email protected] script]# ./gs_checkos -i A12 -h gauss1,gauss2 -X /opt/software/gaussdb/clusterconfig.xml --detail
Root permission user has not SSH trust, create it when do checkos in remote node.
Creating SSH trust for the root permission user.
Please enter password for root.
Password: 
Successfully creating SSH trust for the root permission user.
Checking items
    A12.[ Time consistency status ]                             : Warning    
        [gauss1]
        The current system time = (2020-03-06 16:37:43")
        [gauss2]
        The current system time = (2020-03-06 16:37:45")

Total numbers:1. Abnormal numbers:0. Warning numbers:1.

Clean SSH trust for the root permission user.
Successfully clean SSH trust for the root permission user.

解決:重新同步系統時間。

[[email protected] ~]# cd /opt/software/gaussdb/script
[[email protected] script]# ./gs_checkos -i C1 -h gauss1,gauss2 -X /opt/software/gaussdb/clusterconfig.xml

Root permission user has not SSH trust, create it when do checkos in remote node.
Creating SSH trust for the root permission user.
Please enter password for root.
Password: 
Successfully creating SSH trust for the root permission user.

    C1. [ Set NTP Service ]                                     : Normal
NOTICE: MTU value and some warning items can NOT be set. Please do it manually.
Total numbers:1. Abnormal numbers:0. Warning numbers:0.

Clean SSH trust for the root permission user.
Successfully clean SSH trust for the root permission user.

四、集群卸載

1、omm用戶執行gs_uninstall –delete-data -X

/opt/software/gaussdb/clusterconfig.xml

[[email protected] ~]$ gs_uninstall --delete-data -X /opt/software/gaussdb/clusterconfig.xml
The data will be deleted and cannot be recovered. Are you sure you want to uninstall the cluster(yes/no)?yes
Check preinstall on every node.
Successfully checked preinstall on every node.
Stop cluster.
Check logfile path.
Clean crontab.
Clean crontab successfully.
Kill process for components.
Kill process for components successfully.
Uninstall components
Uninstall components successfully.
Modifying user's environmental variable.
Successfully modified user's environmental variable.
Clean tmp files and logs.
Successfully clean cluster's tmp and logs.
Successful uninstallation

2、清理主機的環境

[[email protected] script]# ./gs_postuninstall -U omm -X /opt/software/gaussdb/clusterconfig.xml
The environment will be cleaned up and cannot be recovered.Are you sure you want to clean up the environment(yes/no)?yes
Parsing the configuration file.
Successfully parsed the configuration file.
Checking unpreinstallation.
Success checking unpreinstallation.
Deleting the instance paths.
Deleting the instance paths successfully.
Clean log and dependency.
Clean up the user environment variables
Clean up the user environment variable successfully
Clean up the remote system tool environment variables
Clean up the remote system tool environment variable successfully
Clean up the local system tool environment variables
Clean up the local system tool environment variable successfully
Clean log and dependency successfully.
Postuninstall successfully.
Please close the terminal and login again, ensure that the environment variable takes effect.

作者介紹

劉濱,中移信息數據庫運維專家。擁有Oracle OCP、OCM認證,曾多年在銀行金融保險行業一線運維,目前正在積極參與國產數據庫的研究以及在移動場景下的推廣等工作。

原文鏈接

https://mp.weixin.qq.com/s?__biz=MzI4NTA1MDEwNg==&mid=2650786311&idx=2&sn=4402b6dea5a887805a1e1022f0cb7d99&chksm=f3f97f92c48ef6842996101c0ae60f04074535dc35690878275f3f3514a5734c7c7d3aa657f7&scene=27#wechat_redirect