Gbase8s数据库保姆级安装部署(RHAC和SSC) 三

一、RHAC集群的安装部署

(一)RHAC集群的介绍和环境检查

1.RHAC和HAC集群的比较

        RHAC集群是gbase8s数据库双机同步的一种方式,其和HAC集群在安装部署上的步骤大部分是相同的(环境准备、软件安装、实例初始化、数据同步),而且其和HAC集群的同步方式也是一样的,只有在主机和备机加入集群的步骤存在着细微的差异,主要体现在参数上。

       除此之外,RHAC和HAC的差异主要表现为应用场景、数据同步的时效性和其节点数量:

  • 应用场景:
    • HAC:主要针对的同城灾备,距离相对较近,对网络的要求相对较高
    • RHAC:主要针对的异地灾备,距离相对较远,对网络要求较低
  • 同步时效性
    • HAC:其同步可以分为三个级别,完全同步、半同步(指日志发送到备机但是没有应用而向主机发送收到指令)、异步
    • RHAC:其同步级别只能为异步,可以指定间隔时间(间隔多长时间进行同步)
  • 节点数量:
    • HAC:节点数量为2
    • RHAC:节点数量可以高于2

2.操作系统的版本

  • 节点1
--节点1
[root@node01 ~]# uname -a
Linux node01 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
--节点2
[root@node02 ~]# uname -a
Linux node02 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

3.数据库的相关信息

RHAC集群安装之前,需要主机和备机已经安装了数据库软件,其中主机还要已经初始化成功实例,数据库的信息(包括准备安装的备机)如下:

服务器名称IP数据库版本实例名称端口数据库安装路径数据存放路径
node01192.168.6.63.5.1node39099/opt/GBASE/gbase/home/gbasedbt/node_dbs
node02192.168.6.73.5.1node49099/opt/GBASE/gbase/home/gbasedbt/node_dbs

4.数据库状态和信息查看

  • 192.168.6.6上查看node3数据库
--从这可以看出node3实例正在启动,数据库正常
[gbasedbt@node01 ~]$ onstat -g dis
Your evaluation license will expire on 2025-03-31 00:00:00
On-Line -- Up 00:02:41 -- 1123008 Kbytes
There are 2 servers found
Server        : node3
Server Number : 234
Server Type   : IDS
Server Status : Up
Server Version: GBase Database Server Version 12.10.FC4G1TL
Shared Memory : 0x44000000
GBASEDBTDIR   : /opt/GBASE/gbase
ONCONFIG      : /opt/GBASE/gbase/etc/onconfig.node3
SQLHOSTS      : /opt/GBASE/gbase/etc/sqlhosts.node3
Host          : node01

Server        : node1
Server Number : 28
Server Type   : IDS
Server Status : Down
Server Version: GBase Database Server Version 12.10.FC4G1TL
Shared Memory : 0x44000000
GBASEDBTDIR   : /opt/GBASE/gbase
ONCONFIG      : /opt/GBASE/gbase/etc/onconfig.node1
SQLHOSTS      : /opt/GBASE/gbase/etc/sqlhosts.node1
Host          : node01
  • 192.168.6.6上查看node4数据库
--从这可以看出,没有node4的数据库实例
[gbasedbt@node02 ~]$ onstat -g dis
Your evaluation license will expire on 2025-03-31 00:00:00
shared memory not initialized for GBASEDBTSERVER 'node2'
There are 1 servers found
Server        : node2
Server Number : 28
Server Type   : IDS
Server Status : Down
Server Version: GBase Database Server Version 12.10.FC4G1TL
Shared Memory : 0x44000000
GBASEDBTDIR   : /opt/GBASE/gbase
ONCONFIG      : /opt/GBASE/gbase/etc/onconfig.node2
SQLHOSTS      : /opt/GBASE/gbase/etc/sqlhosts.node2
Host          : node02

(二)部署的准备工作

1.关闭防火墙或者开放端口

  • 192.168.6.6上执行
--防火墙,主机和备机都要执行
systemctl stop firewalld && echo '防火墙关闭成功' || echo '防火墙关闭失败'
systemctl disable firewalld && echo '防火墙开机自起关闭' || echo '防火墙开机关闭失败'
--防火墙如果不关闭,也可以开启相应端口,主机和备机都要执行
firewall-cmd --add-port=9000-9900/tcp --permanent
firewall-cmd --add-port=9000-9900/udp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
--SELINUX位置的调整,主机和备机都要执行
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
  • 192.168.6.7上执行
--防火墙,主机和备机都要执行
systemctl stop firewalld && echo '防火墙关闭成功' || echo '防火墙关闭失败'
systemctl disable firewalld && echo '防火墙开机自起关闭' || echo '防火墙开机关闭失败'
--防火墙如果不关闭,也可以开启相应端口,主机和备机都要执行
firewall-cmd --add-port=9000-9900/tcp --permanent
firewall-cmd --add-port=9000-9900/udp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
--SELINUX位置的调整,主机和备机都要执行
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

2.数据库主备双机互信

  • 192.168.6.6上执行
--使用root用户执行以下命令
echo '+ +' >>/etc/hosts.equiv
echo '192.168.6.7' >>/etc/hosts.equiv
echo '192.168.6.6 root' >>/root/.rhosts
echo '192.168.6.7 root' >>/root/.rhosts
echo '192.168.6.6 gbasedbt' >>/root/.rhosts
echo '192.168.6.7 gbasedbt' >>/root/.rhosts
--gbasedbt用户
echo '192.168.6.6 gbasedbt' >>/home/gbasedbt/.rhosts 
echo '192.168.6.7 gbasedbt' >>/home/gbasedbt/.rhosts
  • 192.168.6.7上执行
--服务器192.168.6.7上
--使用root用户执行以下命令
echo '+ +' >>/etc/hosts.equiv
echo '192.168.6.6' >>/etc/hosts.equiv
echo '192.168.6.6 root' >>/root/.rhosts
echo '192.168.6.7 root' >>/root/.rhosts
echo '192.168.6.6 gbasedbt' >>/root/.rhosts
echo '192.168.6.7 gbasedbt' >>/root/.rhosts
--gbasedbt用户
echo '192.168.6.6 gbasedbt' >>/home/gbasedbt/.rhosts 
echo '192.168.6.7 gbasedbt' >>/home/gbasedbt/.rhosts

3.环境变量

  • 192.168.6.6上查看环境变量
--一般环境变量文件的命名方式为profile.实例名称
[gbasedbt@node01 ~]$ cat /home/gbasedbt/profile.node3
export GBASEDBTSERVER=node3
export GBASEDBTDIR=/opt/GBASE/gbase
export GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.node3
export ONCONFIG=onconfig.node3
export PATH=/opt/GBASE/gbase/bin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
export GL_DATE="%Y-%m-%d"
export GL_DATETIME="%Y-%m-%d %H:%M:%S"
  • 192.168.6.6上将环境变量文件传输到192.168.6.7并按照其实例名命名为porfile.node4
scp /home/gbasedbt/profile.node3 192.168.6.7:/home/gbasedbt/profile.node4
  • 192.168.6.7上更改环境变量文件/home/gbasedbt/profile.node4
[gbasedbt@node02 ~]$ cat /home/gbasedbt/profile.node4
export GBASEDBTSERVER=node3
export GBASEDBTDIR=/opt/GBASE/gbase
export GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.node3
export ONCONFIG=onconfig.node3
export PATH=/opt/GBASE/gbase/bin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
export GL_DATE="%Y-%m-%d"
export GL_DATETIME="%Y-%m-%d %H:%M:%S"

[gbasedbt@node02 ~]$ sed -i 's/node3/node4/g' /home/gbasedbt/profile.node4

[gbasedbt@node02 ~]$ cat /home/gbasedbt/profile.node4
export GBASEDBTSERVER=node4
export GBASEDBTDIR=/opt/GBASE/gbase
export GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.node4
export ONCONFIG=onconfig.node4
export PATH=/opt/GBASE/gbase/bin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
export GL_DATE="%Y-%m-%d"
export GL_DATETIME="%Y-%m-%d %H:%M:%S"

  • 192.168.6.7上加入生效node4环境变量的信息
echo 'source /home/gbasedbt/profile.node4' >> /home/gbasedbt/.bash_profile

4.sqlhosts连接文件的设置

  • 192.168.6.6查看实例node3的sqlhosts连接配置文件
[gbasedbt@node01 ~]$ onstat -g dis |grep sqlhosts|grep node3|awk '{print $NF}'
Your evaluation license will expire on 2025-03-31 00:00:00
/opt/GBASE/gbase/etc/sqlhosts.node3
  • 192.168.6.6加入备机192.168.6.7的连接信息
[gbasedbt@node01 ~]$ cat /opt/GBASE/gbase/etc/sqlhosts.node3
node3 onsoctcp 192.168.6.6 9099

[gbasedbt@node01 ~]$ echo 'node4 onsoctcp 192.168.6.7 9099'>>/opt/GBASE/gbase/etc/sqlhosts.node3

[gbasedbt@node01 ~]$ cat /opt/GBASE/gbase/etc/sqlhosts.node3
node3 onsoctcp 192.168.6.6 9099
node4 onsoctcp 192.168.6.7 9099
  • 192.168.6.6将sqlhosts.node3文件传输到备机上并命名为sqlhosts.node4
[gbasedbt@node01 ~]$ scp /opt/GBASE/gbase/etc/sqlhosts.node3 192.168.6.7:/opt/GBASE/gbase/etc/sqlhosts.node4

5.数据库参数文件onconfig的配置

  • 192.168.6.6查看onconfig文件的位置
[gbasedbt@node01 ~]$ onstat -g dis |grep onconfig|grep node3|awk '{print $NF}'
Your evaluation license will expire on 2025-03-31 00:00:00
/opt/GBASE/gbase/etc/onconfig.node3
  • 192.168.6.6更改参数文件内容
--192.168.6.6上进行改动参数文件
[gbasedbt@node01 ~]$ sed -i 's/DRAUTO.*/DRAUTO                   2/g' /opt/GBASE/gbase/etc/onconfig.node3
[gbasedbt@node01 ~]$ sed -i 's/LOG_INDEX_BUILDS.*/LOG_INDEX_BUILDS   1/g' /opt/GBASE/gbase/etc/onconfig.node3
  • 将192.168.6.6的onconfig文件传输到192.168.6.7上
[gbasedbt@node01 ~]$ scp /opt/GBASE/gbase/etc/onconfig.node3 192.168.6.7:/opt/GBASE/gbase/etc/onconfig.node4
  • 192.168.6.7更改传输过来的文件内容
[gbasedbt@node02 etc]$ sed -i 's/^DBSERVERNAME.*/DBSERVERNAME node4/g' /opt/GBASE/gbase/etc/onconfig.node4

6.同步数据文件

  • 192.168.6.6查看数据文件文件夹和所有的数据文件
[gbasedbt@node01 ~]$ onstat -d|grep /home|awk '{print "touch " $NF}'
Your evaluation license will expire on 2025-03-31 00:00:00
touch /home/gbasedbt/node_dbs/rootdbs
touch /home/gbasedbt/node_dbs/llogdbs
touch /home/gbasedbt/node_dbs/plogdbs
touch /home/gbasedbt/node_dbs/sbspace1
touch /home/gbasedbt/node_dbs/tmpdbs1
touch /home/gbasedbt/node_dbs/datadbs1_1
  • 备机192.168.6.6执行创建文件夹和创建文件
[gbasedbt@node02 etc]$ mkdir /home/gbasedbt/node_dbs/
[gbasedbt@node02 etc]$ touch /home/gbasedbt/node_dbs/rootdbs
[gbasedbt@node02 etc]$ touch /home/gbasedbt/node_dbs/llogdbs
[gbasedbt@node02 etc]$ touch /home/gbasedbt/node_dbs/plogdbs
[gbasedbt@node02 etc]$ touch /home/gbasedbt/node_dbs/sbspace1
[gbasedbt@node02 etc]$ touch /home/gbasedbt/node_dbs/tmpdbs1
[gbasedbt@node02 etc]$ touch /home/gbasedbt/node_dbs/datadbs1_1
  • 更改权限
[gbasedbt@node02 etc]$ chown -R gbasedbt:gbasedbt /home/gbasedbt/node_dbs
[gbasedbt@node02 etc]$ chmod 755 /home/gbasedbt/node_dbs
[gbasedbt@node02 etc]$ chmod 660 /home/gbasedbt/node_dbs/*

(三)集群的部署

1.主机重启后注册并制定备机为RHAC集群的备机

  • 主机重启数据库使更改参数生效
[gbasedbt@node01 ~]$ onmode -ky
Your evaluation license will expire on 2025-03-31 00:00:00
[gbasedbt@node01 ~]$ oninit -vy
Your evaluation license will expire on 2025-03-31 00:00:00
Reading configuration file '/opt/GBASE/gbase/etc/onconfig.node3'...succeeded
  • 主机注册并制定RSS备机
[gbasedbt@node01 ~]$ onmode -d add RSS node4
Your evaluation license will expire on 2025-03-31 00:00:00

2.主机192.168.6.6数据同步到备机

  • 192.168.6.6上执行,ssh到192.168.6.7上,source环境变量
[gbasedbt@node01 ~]$ ontape -s -L 0 -t STDIO | ssh 192.168.6.7 "source /home/gbasedbt/profile.node4 && ontape -p -t STDIO "
Your evaluation license will expire on 2025-03-31 00:00:00
gbasedbt@192.168.6.7's password:
Your evaluation license will expire on 2025-03-31 00:00:00
Your evaluation license will expire on 2025-03-31 00:00:00
[gbasedbt@node01 ~]$

3.备机加入集群

  • 192.168.6.7通过命令加入集群
[gbasedbt@node02 etc]$ onmode -d RSS node3
Your evaluation license will expire on 2025-03-31 00:00:00
  • 192.168.6.7通过日志确定何时加入成功,onstat -m出现以下内容时初始化成功
[gbasedbt@node02 etc]$ onstat -m
Your evaluation license will expire on 2025-03-31 00:00:00
Read-Only (RSS) -- Up 00:00:47 -- 1635008 Kbytes

Message Log File: /opt/GBASE/gbase/tmp/online_node3.log
04/01/24 22:44:02  DR: new type = RSS
04/01/24 22:44:02  RSS Server node3 - state is now connected
04/01/24 22:44:03  Logical Recovery Started.
04/01/24 22:44:03  96 recovery worker threads will be started.
04/01/24 22:44:03  Dynamically allocated new virtual shared memory segment (size 128000KB)
04/01/24 22:44:03  Memory sizes:resident:50768 KB, virtual:1200240 KB, no SHMTOTAL limit
04/01/24 22:44:03  Dynamically allocated new virtual shared memory segment (size 128000KB)
04/01/24 22:44:03  Memory sizes:resident:50768 KB, virtual:1328240 KB, no SHMTOTAL limit
04/01/24 22:44:03  Dynamically allocated new virtual shared memory segment (size 128000KB)
04/01/24 22:44:03  Memory sizes:resident:50768 KB, virtual:1456240 KB, no SHMTOTAL limit
04/01/24 22:44:03  Dynamically allocated new virtual shared memory segment (size 128000KB)
04/01/24 22:44:03  Memory sizes:resident:50768 KB, virtual:1584240 KB, no SHMTOTAL limit
04/01/24 22:44:04  Start Logical Recovery - Start Log 7, End Log ?
04/01/24 22:44:04  Starting Log Position - 7 0x1218018
04/01/24 22:44:04  Clearing the physical and logical logs has started
04/01/24 22:44:05  Cleared 575 MB of the physical and logical logs in 1 seconds
04/01/24 22:44:05  B-tree scanners disabled.
04/01/24 22:44:06  DR: RSS secondary server operational
04/01/24 22:44:07  Started processing open transactions on secondary during startup
04/01/24 22:44:07  Finished processing open transactions on secondary during startup.

4.数据库状态查看

  • 192.168.6.6
[gbasedbt@node01 ~]$ onstat -g dri
Your evaluation license will expire on 2025-03-31 00:00:00
On-Line -- Up 00:13:46 -- 1123008 Kbytes

Data Replication at 0x4c13d028:
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
  standard       off                                       -1 / -1         NA

  DRINTERVAL   0
  DRTIMEOUT    30
  DRAUTO       2
  DRLOSTFOUND  /opt/GBASE/gbase/etc/dr.lostfound
  DRIDXAUTO    0
  ENCRYPT_HDR  0
  Backlog      0
  • 192.168.6.7
[gbasedbt@node02 etc]$ onstat -g  dri
Your evaluation license will expire on 2025-03-31 00:00:00
Read-Only (RSS) -- Up 00:03:56 -- 1635008 Kbytes

Data Replication at 0x4c13d028:
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
  RSS Secondary  on           node3                        -1 / -1         N

  DRINTERVAL   0
  DRTIMEOUT    30
  DRAUTO       2
  DRLOSTFOUND  /opt/GBASE/gbase/etc/dr.lostfound
  DRIDXAUTO    0
  ENCRYPT_HDR  0
  Backlog      0

5.集群复制查看

  • 192.168.6.6查看如下,显示的集群备机
[gbasedbt@node01 ~]$ onstat -g cluster
Your evaluation license will expire on 2025-03-31 00:00:00
On-Line -- Up 00:14:15 -- 1123008 Kbytes

Primary Server:node3
Current Log Page:7,4638
Index page logging status: Enabled
Index page logging was enabled at: 2024/04/01 22:34:08


Server ACKed Log    Applied Log  Supports     Status
       (log, page)  (log, page)  Updates
node2  0,0          0,0          No           ASYNC(RSS),Disconnected,Defined
node4  7,4638       7,4638       No           ASYNC(RSS),Connected,Active
  • 192.168.6.7
[gbasedbt@node02 etc]$ onstat -g cluster
Your evaluation license will expire on 2025-03-31 00:00:00
Read-Only (RSS) -- Up 00:06:05 -- 1635008 Kbytes

Primary Server:node3
Index page logging status: Enabled
Index page logging was enabled at: 2024/04/01 22:34:08


Server ACKed Log    Supports     Status
       (log, page)  Updates
node4  7,4638       No           ASYNC(RSS),Connected,Active

6.数据测试

  • 192.168.6.6
[gbasedbt@node01 ~]$ dbaccess sysmaster -
Your evaluation license will expire on 2025-03-31 00:00:00

Database selected.

> create database test with log;

Database closed.


Database created.

> create table test(id int);

Table created.

> insert into test values(1);

1 row(s) inserted.

  • 192.168.6.7
[gbasedbt@node02 etc]$ dbaccess test -
Your evaluation license will expire on 2025-03-31 00:00:00

Database selected.

> select * from test;


         id

          1

1 row(s) retrieved.

二、SSC共享内存集群的安装部署

(一)SSC集群

1.SSC集群本次部署说明

        SSC集群是共享存储集群,多个数据库实例公用一个存储,由于没有相应的环境,故本次部署测试是在一台虚拟机上部署用两个实例公用一个数据文件进行模拟进行。

2.SSC集群本次部署信息说明

本次共享集群部署是在一台服务器上进行,所以只有一个IP地址,也只需安装一个软件但是是有两个实例,具体部署信息如下:

ip实例名称端口安装路径数据文件路径
192.168.6.6ssc19088/home/gbasedbt/gbase/home/gbasedbt/gbase/ssc1_dbs
192.168.6.6ssc29099/home/gbasedbt/gbase/home/gbasedbt/gbase/ssc1_dbs

3.SSC集群安装部署步骤

  • 192.168.6.6安装软件
  • 192.168.6.6进行实例初始化
  • 192.168.6.6调整环境变量文件,并复制重命名
  • 192.168.6.6调整连接控制文件,并复制重命名
  • 192.168.6.6调整参数控制文件,并复制重命名
  • 192.168.6.6重启节点1的数据库,使更改的参数生效
  • 192.168.6.6指定ssc1为主节点
  • 192.168.6.6启动节点2

(二)集群的部署

1.说明

本次默认192.168.6.6上已经安装了数据库软件(测试版本为3.5.1),且已经初始化实例,状态如下:

--192.168.6.6上查看节点状态,实例ssc1已经启动
[gbasedbt@node01 ~]$ onstat -g dis
Your evaluation license will expire on 2025-04-02 00:00:00
On-Line -- Up 00:00:35 -- 1650580 Kbytes
There are 1 servers found
Server        : ssc1
Server Number : 154
Server Type   : IDS
Server Status : Up
Server Version: GBase Database Server Version 12.10.FC4G1TL
Shared Memory : 0x44000000
GBASEDBTDIR   : /home/gbasedbt/gbase
ONCONFIG      : /home/gbasedbt/gbase/etc/onconfig.ssc1
SQLHOSTS      : /home/gbasedbt/gbase/etc/sqlhosts.ssc1
Host          : node01

2.调整环境变量文件并复制重命名

--调整后实例ssc1的环境变量文件内容如下
[gbasedbt@node01 ~]$ cat profile.ssc1
export GBASEDBTSERVER=ssc1
export GBASEDBTDIR=/home/gbasedbt/gbase
export GBASEDBTSQLHOSTS=/home/gbasedbt/gbase/etc/sqlhosts.ssc1
export ONCONFIG=onconfig.ssc1
export PATH=/home/gbasedbt/gbase/bin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
export GL_DATE="%Y-%m-%d"
export GL_DATETIME="%Y-%m-%d %H:%M:%S"

--进行复制重命名为实例ssc2的环境变量文件
[gbasedbt@node01 ~]$ cp /home/gbasedbt/profile.ssc1 /home/gbasedbt/profile.ssc2

--将实例ssc2的环境变量文件进行改动,改动三处,实例名称、连接控制文件名称和参数控制文件
[gbasedbt@node01 ~]$ cat profile.ssc2
export GBASEDBTSERVER=ssc2
export GBASEDBTDIR=/home/gbasedbt/gbase
export GBASEDBTSQLHOSTS=/home/gbasedbt/gbase/etc/sqlhosts.ssc2
export ONCONFIG=onconfig.ssc2
export PATH=/home/gbasedbt/gbase/bin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
export GL_DATE="%Y-%m-%d"
export GL_DATETIME="%Y-%m-%d %H:%M:%S"

3.调整连接控制文件并复制给ssc2

--调整后的连接参数文件如下,主要为增加实例ssc2的连接信息,主要差异为实例名称和端口
[gbasedbt@node01 ~]$ cat /home/gbasedbt/gbase/etc/sqlhosts.ssc1
ssc1 onsoctcp 192.168.6.6 9088
ssc2 onsoctcp 192.168.6.6 9099

--复制连接控制文件并重命名
[gbasedbt@node01 ~]$ cp /home/gbasedbt/gbase/etc/sqlhosts.ssc1 /home/gbasedbt/gbase/etc/sqlhosts.ssc2

--实例ssc2的连接控制文件不用调整,内容如下
[gbasedbt@node01 ~]$ cat /home/gbasedbt/gbase/etc/sqlhosts.ssc2
ssc1 onsoctcp 192.168.6.6 9088
ssc2 onsoctcp 192.168.6.6 9099

4.调整参数控制文件并复制给实例ssc2

  • 实例ssc1的参数文件主要调整有三个
    • SDS_ENABLE:用于启动和禁止SD的辅助功能,当设置为1时,主机down机后会自动接管数据库服务,所以主机设置为0,第二个节点设置为1
    • SDS_TEMPDBS:用于指定SD服务器在启动时动态创建的临时数据库空间的信息,需要配置临时数据库空间的相关信息,如数据库空间名称、路径、页面大小、偏移量和大小等。需要注意的是,对于每个SDS_TEMPDBS配置参数值,页面大小(pagesize)值必须是相同的。
    • SDS_PAGING:用来配置共享存储每个节点的独有缓冲区路径,需要配置两个文件路径
--实例ssc1关于三个参数的相关设置如下
[gbasedbt@node01 ~]$ cat /home/gbasedbt/gbase/etc/onconfig.ssc1|grep ^SDS|grep -v SDS_TIMEOUT|grep -v SDS_LOGCHECK|grep -v SDS_ALTERNATE|grep -v SDS_FLOW_CONTROL
SDS_ENABLE      0
SDS_TEMPDBS             sdstmpdbs1,/home/gbasedbt/gbase/ssc1/sdstmpdbs01,2,0,102400
SDS_PAGING              /home/gbasedbt/gbase/ssc1/pagefile01,/home/gbasedbt/gbase/ssc1/pagefile02
  • 将实例ssc1的实力复制并改名
[gbasedbt@node01 ~]$ cp /home/gbasedbt/gbase/etc/onconfig.ssc1 /home/gbasedbt/gbase/etc/onconfig.ssc2
  • 将实例ssc2的onconfig文件进行改动,改动参数如下:
--改动内容为:实例名称、实例编号、日志文件名称和共享存储的几个参数
--内容太长,将改动的参数进行罗列出来,需要改动内容如下(确保SERVERNUM和实例ssc1不一致)
MSGPATH /home/gbasedbt/gbase/tmp/online_ssc2.log
DBSERVERNAME ssc2
SERVERNUM 155
SDS_ENABLE            1
SDS_TEMPDBS           sdstmpdbs1,/home/gbasedbt/gbase/ssc2/sdstmpdbs01,2,0,102400
SDS_PAGING        /home/gbasedbt/gbase/ssc2/pagefile01,/home/gbasedbt/gbase/ssc2/pagefile02

  • 将实例ssc1和ssc2的onconfig文件进行对比
[gbasedbt@node01 ~]$ diff /home/gbasedbt/gbase/etc/onconfig.ssc2 /home/gbasedbt/gbase/etc/onconfig.ssc1
126c126
< MSGPATH /home/gbasedbt/gbase/tmp/online_ssc2.log
---
> MSGPATH /home/gbasedbt/gbase/tmp/online_ssc1.log
205,206c205,206
< SERVERNUM 155
< DBSERVERNAME ssc2
---
> SERVERNUM 154
> DBSERVERNAME ssc1
1300c1300
< SDS_ENABLE            1
---
> SDS_ENABLE      0
1302,1303c1302,1303
< SDS_TEMPDBS           sdstmpdbs1,/home/gbasedbt/gbase/ssc2/sdstmpdbs01,2,0,102400
< SDS_PAGING            /home/gbasedbt/gbase/ssc2/pagefile01,/home/gbasedbt/gbase/ssc2/pagefile02
---
> SDS_TEMPDBS           sdstmpdbs1,/home/gbasedbt/gbase/ssc1/sdstmpdbs01,2,0,102400
> SDS_PAGING            /home/gbasedbt/gbase/ssc1/pagefile01,/home/gbasedbt/gbase/ssc1/pagefile02

5.针对上述的参数文件创建相关的文件夹和相关文件

--实例ssc1,SDS的上述三个参数需要一个文件夹和三个文件
[root@node01 gbase]# mkdir /home/gbasedbt/gbase/ssc1
[root@node01 gbase]# touch /home/gbasedbt/gbase/ssc1/sdstmpdbs01
[root@node01 gbase]# touch /home/gbasedbt/gbase/ssc1/pagefile01
[root@node01 gbase]# touch /home/gbasedbt/gbase/ssc1/pagefile02
[root@node01 gbase]# chown -R gbasedbt:gbasedbt /home/gbasedbt/gbase/ssc1
[root@node01 gbase]# chmod 755 /home/gbasedbt/gbase/ssc1
[root@node01 gbase]# chmod 660 /home/gbasedbt/gbase/ssc1/*
--实例ssc2
cp /home/gbasedbt/gbase/ssc1 /home/gbasedbt/gbase/ssc2

6.搭建SSC共享集群

  • 重启ssc1实例
source /home/gbasedbt/profile.ssc1
onmode -ky
oninit -vy
  • 将ssc1设为共享存储的所有者数据库
--生效实例ssc1环境变量,指定ssc1
source /home/gbasedbt/profile.ssc1
onmode -d set SDS primary ssc1
--生效实例ssc2环境变量,启动ssc2
source /home/gbasedbt/profile.ssc2
oninit -vy

7.查看集群状态

--生效ssc1环境变量,查看
[gbasedbt@node01 ~]$ source /home/gbasedbt/profile.ssc1
[gbasedbt@node01 ~]$ onstat -g dri
Your evaluation license will expire on 2025-04-02 00:00:00
On-Line -- Up 02:39:03 -- 1650580 Kbytes

Data Replication at 0x4cf32028:
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
  standard       off                                       -1 / -1         NA

  DRINTERVAL   0
  DRTIMEOUT    30
  DRAUTO       0
  DRLOSTFOUND  /home/gbasedbt/gbase/etc/dr.lostfound
  DRIDXAUTO    0
  ENCRYPT_HDR  0
  Backlog      0
--生效ssc1环境变量,查看
[gbasedbt@node01 ~]$ source /home/gbasedbt/profile.ssc2
[gbasedbt@node01 ~]$ onstat -g dri
Your evaluation license will expire on 2025-04-02 00:00:00
Read-Only (SDS) -- Up 02:34:17 -- 2188180 Kbytes

Data Replication at 0x4cf2e028:
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
  SDS Secondary  on           ssc1                          5 / 738        N

  DRINTERVAL   0
  DRTIMEOUT    30
  DRAUTO       0
  DRLOSTFOUND  /home/gbasedbt/gbase/etc/dr.lostfound
  DRIDXAUTO    0
  ENCRYPT_HDR  0
  Backlog      0

--生效ssc1环境变量,查看复制状态
[gbasedbt@node01 ~]$ source /home/gbasedbt/profile.ssc1
[gbasedbt@node01 ~]$ onstat -g cluster
Your evaluation license will expire on 2025-04-02 00:00:00
On-Line -- Up 02:39:55 -- 1650580 Kbytes

Primary Server:ssc1
Current Log Page:5,780
Index page logging status: Disabled


Server ACKed Log    Applied Log  Supports     Status
       (log, page)  (log, page)  Updates
ssc2   5,780        5,780        No           SYNC(SDS),Connected,Active

--生效ssc2环境变量,查看复制状态
[gbasedbt@node01 ~]$ source /home/gbasedbt/profile.ssc2
[gbasedbt@node01 ~]$ onstat -g cluster
Your evaluation license will expire on 2025-04-02 00:00:00
Read-Only (SDS) -- Up 02:35:05 -- 2188180 Kbytes

Primary Server:ssc1
Index page logging status: Disabled


Server ACKed Log    Supports     Status
       (log, page)  Updates
ssc2   5,780        No           SYNC(SDS),Connected,Active

  • 23
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值