GBASE8s数据库安装部署保姆级安装部署二

一、双机HAC集群的安装部署

1.双机部署前的准备

gbase8s数据库的双机部署是通过数据库自带的插件做的日志同步,当前环境如下:

  • 本次安装测试的两台服务器IP为192.168.6.6和192.168.6.7,实例名称为node1和node2

  • 其中一台数据库软件安装成功,实例已经初始化,另外一台服务器可以只安装软件,不初始化实例

  • 保证两个服务器数据库安装位置一致,即主机数据库软件安装在/opt/GBASE/gbase,则备机数据库也安装在/opt/GBASE/gbase下

2.两台服务器的数据库检查

  • 192.168.6.6

--检查数据库状态
[gbasedbt@node01 ~]$ onstat -g dis
Your evaluation license will expire on 2025-03-31 00:00:00
--数据库运行状态为online在线状态
On-Line -- Up 00:02:30 -- 1123008 Kbytes
There are 1 servers found
Server        : node1
Server Number : 28
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.node1
SQLHOSTS      : /opt/GBASE/gbase/etc/sqlhosts.node1
Host          : node01

--数据库的数据文件存放位置
[gbasedbt@node01 ~]$ onstat -d
Your evaluation license will expire on 2025-03-29 00:00:00
On-Line -- Up 00:40:55 -- 1650580 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
48b70028         1        0x70001    1        1        2048     N  BA    gbasedbt rootdbs
4d485508         2        0x60001    2        1        2048     N  BA    gbasedbt llogdbs
4d485738         3        0x70001    3        1        2048     N  BA    gbasedbt plogdbs
4d485968         4        0x68001    4        1        2048     N SBA    gbasedbt sbspace1
4d485b98         5        0x42001    5        1        16384    N TBA    gbasedbt tmpdbs1
4d485dc8         6        0x60001    6        1        16384    N  BA    gbasedbt datadbs1
 6 active, 2047 maximum
--右边为数据空间的文件位置
[gbasedbt@node01 ~]$ onstat -d
Your evaluation license will expire on 2025-03-31 00:00:00
On-Line -- Up 00:03:13 -- 1123008 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
47dba028         1        0x70001    1        1        2048     N  BA    gbasedbt rootdbs
4c672508         2        0x60001    2        1        2048     N  BA    gbasedbt llogdbs
4c672738         3        0x70001    3        1        2048     N  BA    gbasedbt plogdbs
4c672968         4        0x68001    4        1        2048     N SBA    gbasedbt sbspace1
4c672b98         5        0x42001    5        1        16384    N TBA    gbasedbt tmpdbs1
4c672dc8         6        0x60001    6        1        16384    N  BA    gbasedbt datadbs1
 6 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
47dba258         1      1      0          102400     86071                 PO-B-D /opt/GBASE/gbase/node1_dbs/rootdbs
4c673028         2      2      0          153600     3547                  PO-B-D /opt/GBASE/gbase/node1_dbs/llogdbs
4c674028         3      3      0          153600     4447                  PO-B-D /opt/GBASE/gbase/node1_dbs/plogdbs
4c675028         4      4      0          153600     143186     143186     POSB-D /opt/GBASE/gbase/node1_dbs/sbspace1
                                 Metadata 10361      7709       10361
4c676028         5      5      0          19200      19147                 PO-B-- /opt/GBASE/gbase/node1_dbs/tmpdbs1
4c677028         6      6      0          64000      63413                 PO-BED /opt/GBASE/gbase/node1_dbs/datadbs1_1
 6 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.


Expanded chunk capacity mode: always

  • 192.168.6.7

--192.168.6.7只做了软件的安装,没有做实例初始化,且安装位置和192.168.6.6一致
[root@node02 install]# ls -l /opt/GBASE/gbase/
总用量 280
drwxrwxr-x.  2 gbasedbt gbasedbt     38 3月  31 01:24 aaodir
drwxr-xr-x.  5 gbasedbt gbasedbt   4096 3月  31 01:25 bin
drwxrwxr-x.  2 gbasedbt gbasedbt     40 3月  31 01:24 dbssodir
drwxr-xr-x.  8 gbasedbt gbasedbt     86 3月  31 01:24 demo
drwxr-xr-x.  3 gbasedbt gbasedbt     21 3月  31 01:24 doc
drwxrwxr-x.  4 gbasedbt gbasedbt   4096 3月  31 01:25 etc
drwxr-xr-x. 13 gbasedbt gbasedbt    221 3月  31 01:25 extend
-rwxr-xr-x.  1 root     root      28395 3月  31 01:24 GBase_GLS_Install_03_31_2024_01_24_22.log
-rwxr-xr-x.  1 root     root     113773 3月  31 01:24 GBase_Install_03_31_2024_01_24_33.log
-rwxr-xr-x.  1 root     root      13844 3月  31 01:26 GBase_Software_Bundle_Install_03_31_2024_01_24_12.log
drwxr-xr-x.  7 gbasedbt gbasedbt     62 3月  31 01:24 gls
drwxr-xr-x.  5 gbasedbt gbasedbt     44 3月  31 01:24 incl
drwxr-xr-x.  3 gbasedbt gbasedbt   4096 3月  31 01:25 isa
drwxr-xr-x.  2 gbasedbt gbasedbt    244 3月  31 01:24 lib
drwxr-xr-x.  3 gbasedbt gbasedbt     58 3月  31 01:24 msg
drwxr-xr-x.  3 gbasedbt gbasedbt     19 3月  31 01:24 release
-rwxrw-r--.  1 root     root     106735 3月  31 01:25 RUNasroot.installserver
drwxr-xr-x.  2 gbasedbt gbasedbt   4096 3月  31 01:24 sbin
drwxr-xr-x.  4 gbasedbt gbasedbt     29 3月  31 01:24 SDK
drwxrwx---.  2 gbasedbt gbasedbt      6 3月  31 01:25 ssl
drwxrwx---.  2 gbasedbt gbasedbt     29 3月  31 01:25 tmp
drwxrwxr-x.  4 gbasedbt gbasedbt     51 3月  31 01:24 uninstall

3.集群操作系统参数工作准备

  • 本此涉及的内容主要是保证集群正常部署,操作系统的参数调优,本次没有涉及

  • 确保192.168.6.6和192.168.6.7都已经安装了gbase8s数据库软件,安装位置一致,且主机正在运行,备机没有运行

  • 关闭防火墙,或者开放9088端口

--防火墙,主机和备机都要执行
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.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上
--使用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
  • 配置两边的环境变量:由于192.168.6.6已经存在了环境变量,可以将环境变量传输到192.168.6.7,并做一些实例名称和文件名称的更改(主要为三个,实例名称、sqlhosts文件和onconfig文件)
--服务器192.168.6.6
[gbasedbt@node01 ~]$ cat profile.node1
export GBASEDBTSERVER=node1
export GBASEDBTDIR=/opt/GBASE/gbase
export GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.node1
export ONCONFIG=onconfig.node1
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@node01 ~]$ scp -r profile.node1 192.168.6.7:$PWD
--服务器192.168.6.7查看环境变量文件并对其进行改动,只改动实例名称,两个文件的结尾
[gbasedbt@node02 ~]$ mv profile.node1 profile.node2
[gbasedbt@node02 ~]$ vi profile.node2
[gbasedbt@node02 ~]$ cat profile.node2
export GBASEDBTSERVER=node2
export GBASEDBTDIR=/opt/GBASE/gbase
export GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.node2
export ONCONFIG=onconfig.node2
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"
--在/home/gbasedbt/.bash_profile下追加生效环境变量信息
echo 'source /home/gbasedbt/profile.node2' >>/home/gbasedbt/.bash_profile
  • 调整连接的参数文件sqlhosts文件,单机正常安装下,node1的sqlhosts文件只有当前服务器的IP、端口、实例和连接方式,需要添加备机的连接信息并传输到备机。保证传输过去后属组和用户还是gbasedbt
--192.168.6.6查看连接文件,并添加192.168.6.7的信息
[gbasedbt@node01 ~]$ cat $GBASEDBTDIR/etc/sqlhosts.node1
node1 onsoctcp 192.168.6.6 9088
[gbasedbt@node01 ~]$ echo 'node2 onsoctcp 192.168.6.7 9088' >>$GBASEDBTDIR/etc/sqlhosts.node1
[gbasedbt@node01 ~]$ cat $GBASEDBTDIR/etc/sqlhosts.node1
node1 onsoctcp 192.168.6.6 9088
node2 onsoctcp 192.168.6.7 9088

--将文件传输到192.168.6.7上,并将文件名改为sqlhosts.node2(与环境变量中连接文件名称一致)
[gbasedbt@node01 ~]$ scp $GBASEDBTDIR/etc/sqlhosts.node1 192.168.6.7:/opt/GBASE/gbase/etc/sqlhosts.node2
gbasedbt@192.168.6.7's password:
sqlhosts.node1                                                                                100%   64    14.0KB/s   00:00
--192.168.6.7查看文件的属组和用户
[gbasedbt@node02 ~]$ ll /opt/GBASE/gbase/etc/sqlhosts.node2
-rw-rw-r--. 1 gbasedbt gbasedbt 64 3月  31 01:40 /opt/GBASE/gbase/etc/sqlhosts.node2
--在192.168.6.7上进行查看文件内容
[gbasedbt@node02 ~]$ cat /opt/GBASE/gbase/etc/sqlhosts.node2
node1 onsoctcp 192.168.6.6 9088
node2 onsoctcp 192.168.6.7 9088

  • 调整参数文件:本参数文件是单机部署时初始化出来的,安装部署集群需要改动一些参数(本次改动的参数,主要是针对集群的部署,其他参数后续测试)。将安装后的参数改动一处传输到备机上改名即可,保证传输过去后属组和用户还是gbasedbt
--192.168.6.6上进行改动参数文件
--此参数是集群的切换方式,主要为4中,0为不自动切换,1为保留服务器主机或者备机类型,2是自动切换,主机down后备机会自动升为主机
sed -i 's/DRAUTO.*/DRAUTO                   2/g' onconfig.node2
--是否将索引的操作记录日志,在回滚过程中是否标记索引无效
sed -i 's/LOG_INDEX_BUILDS.*/LOG_INDEX_BUILDS              1/g' onconfig.node2
--将192.168.6.6的onconfig文件传输到192.168.6.7上并改名(名称和192.168.6.7上的环境变量文件一致)
[gbasedbt@node01 etc]$ scp /opt/GBASE/gbase/etc/onconfig.node1 192.168.6.7:/opt/GBASE/gbase/etc/onconfig.node2
--192.168.6.7查看文件的属组和用户
[gbasedbt@node02 ~]$ ll /opt/GBASE/gbase/etc/onconfig.node2
-rw-r--r--. 1 gbasedbt gbasedbt 80615 3月  31 01:54 /opt/GBASE/gbase/etc/onconfig.node2
--查看文件中关于两个参数的内容
[gbasedbt@node02 ~]$ cat /opt/GBASE/gbase/etc/onconfig.node2 |grep '^DRAUTO'
DRAUTO                   2
[gbasedbt@node02 ~]$ cat /opt/GBASE/gbase/etc/onconfig.node2 |grep '^LOG_INDEX_BUILDS'
LOG_INDEX_BUILDS                   1
--在一般情况下,192.168.6.7参数文件内容需要更改的参数为DBSERVERNAME,将值改为node2
[gbasedbt@node02 ~]$ cat /opt/GBASE/gbase/etc/onconfig.node2|grep '^DBSERVERNAME'
DBSERVERNAME node1
[gbasedbt@node02 ~]$ sed -i 's/^DBSERVERNAME.*/DBSERVERNAME node2/g' /opt/GBASE/gbase/etc/onconfig.node2
[gbasedbt@node02 ~]$ cat /opt/GBASE/gbase/etc/onconfig.node2|grep '^DBSERVERNAME'
DBSERVERNAME node2
  • 同步数据空间文件:由于单机安装中已经提到GBASE8s的软件和数据文件是分开的,虽然可以通过同步的方式将数据同步到192.168.6.7上,但是数据文件需要事先touch成功

--192.168.6.6,查看数据空间的文件夹
--通过命令可以看出最右边一列所有文件都在/opt/GBASE/gbase/node1_dbs/下,所以需要在192.168.6.7上创建/opt/GBASE/gbase/node1_dbs文件夹
[gbasedbt@node01 etc]$ onstat -d
Your evaluation license will expire on 2025-03-31 00:00:00
On-Line -- Up 00:34:24 -- 1123008 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
47dba028         1        0x70001    1        1        2048     N  BA    gbasedbt rootdbs
4c672508         2        0x60001    2        1        2048     N  BA    gbasedbt llogdbs
4c672738         3        0x70001    3        1        2048     N  BA    gbasedbt plogdbs
4c672968         4        0x68001    4        1        2048     N SBA    gbasedbt sbspace1
4c672b98         5        0x42001    5        1        16384    N TBA    gbasedbt tmpdbs1
4c672dc8         6        0x60001    6        1        16384    N  BA    gbasedbt datadbs1
 6 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
47dba258         1      1      0          102400     86071                 PO-B-D /opt/GBASE/gbase/node1_dbs/rootdbs
4c673028         2      2      0          153600     3547                  PO-B-D /opt/GBASE/gbase/node1_dbs/llogdbs
4c674028         3      3      0          153600     4447                  PO-B-D /opt/GBASE/gbase/node1_dbs/plogdbs
4c675028         4      4      0          153600     143186     143186     POSB-D /opt/GBASE/gbase/node1_dbs/sbspace1
                                 Metadata 10361      7709       10361
4c676028         5      5      0          19200      19147                 PO-B-- /opt/GBASE/gbase/node1_dbs/tmpdbs1
4c677028         6      6      0          64000      63413                 PO-BED /opt/GBASE/gbase/node1_dbs/datadbs1_1
 6 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.


Expanded chunk capacity mode: always

--192.168.6.7创建文件夹
mkdir /opt/GBASE/gbase/node1_dbs
chown -R gbasedbt:gbasedbt /opt/GBASE/gbase/node1_dbs
chmod 755 /opt/GBASE/gbase/node1_dbs


--192.168.6.6上查看数据文件并在192.168.6.6创建
--使用以下命令可以筛选出数据文件夹下的所有文件并拼接成touch格式,复制在192.168.6.7上执行
[gbasedbt@node01 gbase]$ ls -l /opt/GBASE/gbase/node1_dbs/|awk 'NR>1'|awk '{print "touch /opt/GBASE/gbase/node1_dbs/" $NF}'
touch /opt/GBASE/gbase/node1_dbs/datadbs1_1
touch /opt/GBASE/gbase/node1_dbs/llogdbs
touch /opt/GBASE/gbase/node1_dbs/plogdbs
touch /opt/GBASE/gbase/node1_dbs/rootdbs
touch /opt/GBASE/gbase/node1_dbs/sbspace1
touch /opt/GBASE/gbase/node1_dbs/tmpdbs1

--192.168.6.7执行并修改权限为660
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/node1_dbs/datadbs1_1
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/node1_dbs/llogdbs
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/node1_dbs/plogdbs
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/node1_dbs/rootdbs
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/node1_dbs/sbspace1
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/node1_dbs/tmpdbs1
[gbasedbt@node02 node1_dbs]$ chmod 660 /opt/GBASE/gbase/node1_dbs/*

4.开始做数据同步搭建集群

  • 指定备机确定主机关系

--192.168.6.6上执行onmode -d primary命令,node2为备机节点的实例名称
[gbasedbt@node01 ~]$ onmode -d primary node2
Your evaluation license will expire on 2025-03-31 00:00:00
--执行成功后,可以查看192.168.6.6上数据库的状态,可以看到数据库状态已经变为prim
[gbasedbt@node01 ~]$ onstat -
Your evaluation license will expire on 2025-03-31 00:00:00
--状态变为prim
On-Line (Prim) -- Up 00:04:28 -- 1123008 Kbytes

  • 192.168.6.6继续执行命令将数据同步到192.168.6.7上

--192.168.6.6通过gbase8s上独有的0级备份将数据同步到192.168.6.7上,并还原达到主备数据的一致:ssh IP地址 "source 192.168.6.7上的环境变量文件地址"
[gbasedbt@node01 ~]$ ontape -s -L 0 -t STDIO | ssh 192.168.6.7 "source /home/gbasedbt/profile.node2 && 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
--执行上述命令时可以到192.168.6.7上查看数据库状态,在刚开始可能查看不到数据库状态,但是其状态会随着时间变化成三个状态,最终变为FAST RECOVERY的快速恢复阶段
[gbasedbt@node02 node1_dbs]$ onstat -r 1 -
Your evaluation license will expire on 2025-03-31 00:00:00
--下列为快速恢复阶段
Fast Recovery -- Up 00:00:13 -- 1123008 Kbytes

--等待192.168.6.6上命令执行完毕,在192.168.6.7上执行命令,使其作为备机的身份加入到集群中
[gbasedbt@node02 node1_dbs]$ onmode -d secondary node1
Your evaluation license will expire on 2025-03-31 00:00:00
  • 上述命令执行完毕后,正常情况下集群的命令已经完毕,接下来将会检查集群状态

--备机检查集群进度,可以通过onstat -m的日志观察
[gbasedbt@node02 node1_dbs]$ onstat -m -r 1
Your evaluation license will expire on 2025-03-31 00:00:00
Fast Recovery (Sec) -- Up 00:00:38 -- 1635008 Kbytes

03/31/24 02:20:37  Starting Log Position - 8 0x121d018
03/31/24 02:20:37  Clearing the physical and logical logs has started
--一般情况下出现这个大小的内容将会表示集群搭建成功
03/31/24 02:20:37  Cleared 575 MB of the physical and logical logs in 0 seconds
03/31/24 02:20:40  Started processing open transactions on secondary during startup
03/31/24 02:20:40  Finished processing open transactions on secondary during startup.
03/31/24 02:20:40  Logical Log 8 Complete, timestamp: 0x644cf.
03/31/24 02:20:42  B-tree scanners disabled.


--搭建成功后检查集群状态。此次为192.168.6.7上执行
[gbasedbt@node02 node1_dbs]$ onstat -g dri
Your evaluation license will expire on 2025-03-31 00:00:00
--read only只读状态,表示为备机
Read-Only (Sec) -- Up 00:00:46 -- 1635008 Kbytes
--Type为HDR类型集群,state为on表示集群正常,paired server为主机节点名称,Last DRCKPT为最后传输的日志和检查点信息
Data Replication at 0x4c13d028:
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
  HDR Secondary  on           node1                         9 / 1          N
--以下为集群的各个信息
  DRINTERVAL   0
  DRTIMEOUT    30
  DRAUTO       2
  DRLOSTFOUND  /opt/GBASE/gbase/etc/dr.lostfound
  DRIDXAUTO    0
  ENCRYPT_HDR  0
  Backlog      0
  Last Send    2024/03/31 02:20:46
  Last Receive 2024/03/31 02:20:46
  Last Ping    2024/03/31 02:20:35
  Last log page applied(log id,page): 0,0


--192.168.6.6检查集群状态
[gbasedbt@node01 ~]$ onstat -g dri
Your evaluation license will expire on 2025-03-31 00:00:00
--prim为主机
On-Line (Prim) -- Up 00:18:30 -- 1123008 Kbytes

Data Replication at 0x4c13d028:
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
  primary        on           node2                         9 / 3          NA

  DRINTERVAL   0
  DRTIMEOUT    30
  DRAUTO       2
  DRLOSTFOUND  /opt/GBASE/gbase/etc/dr.lostfound
  DRIDXAUTO    0
  ENCRYPT_HDR  0
  Backlog      0
  Last Send    2024/03/31 02:33:44
  Last Receive 2024/03/31 02:33:44
  Last Ping    2024/03/31 02:33:36
  Last log page applied(log id,page): 9,4
  
  --192.168.6.6检查集群流复制状态
  [gbasedbt@node01 ~]$ onstat -g cluster
Your evaluation license will expire on 2025-03-31 00:00:00
On-Line (Prim) -- Up 00:18:57 -- 1123008 Kbytes

Primary Server:node1
Current Log Page:9,4
Index page logging status: Enabled
Index page logging was enabled at: 2024/03/31 02:15:25


Server ACKed Log    Applied Log  Supports     Status
       (log, page)  (log, page)  Updates
node2  9,4          9,4          No           ASYNC(HDR),Connected,On

5.集群复制测试

--192.168.6.6执行创建数据库命令,主机执行创建test库test表 ,插入数据1,在gbasedbt数据库下执行
[gbasedbt@node01 install]$ dbaccess sysmaster -
Your evaluation license will expire on 2025-03-31 00:00:00

Database selected.

> create database test in datadbs1 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执行进入test库,查看test表数据,以下可以看出可以执行,且可以查看,数据库复制正常
[gbasedbt@node02 ~]$ 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.

二、修改问题

1.针对主备灾备演练可能会出现备机升主短时间down机的问题

在灾备演练中发现此问题(此次说明如何解决和可能解决的方式),灾备演练之后演示

--192.168.6.6下
--检查安装目录下/etc目录下是否存在upgraded文件,且检查是否是gbasedbt用户的属组和用户,如果没有则需要touch upgraded,如果有属主和用户不对,需要修改
[gbasedbt@node01 install]$ ls -l /opt/GBASE/gbase/etc/upgraded
-rw------- 1 root gbasedbt 0 3月  31 01:28 /opt/GBASE/gbase/etc/upgraded
--退出到root用户,修改属主和用户
[gbasedbt@node01 install]$ exit
登出
[root@node01 install]# chown -R gbasedbt:gbasedbt /opt/GBASE/gbase/etc/upgraded


--192.168.6.7下执行同样的命令
[gbasedbt@node02 ~]$ ls -l /opt/GBASE/gbase/etc/upgraded
ls: 无法访问/opt/GBASE/gbase/etc/upgraded: 没有那个文件或目录
[gbasedbt@node02 ~]$ touch /opt/GBASE/gbase/etc/upgraded
[gbasedbt@node02 ~]$ ls -l /opt/GBASE/gbase/etc/upgraded
-rw-rw-r--. 1 gbasedbt gbasedbt 0 3月  31 02:54 /opt/GBASE/gbase/etc/upgraded

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值