命令行工具部署达梦数据库 DMDPC(BP 多副本架构)

news2024/11/15 11:00:21

解达梦数据库DPC集群的主要使用场景:

DMDPC 关注和解决的是大数据、计算与存储分离、高可用、支持全部的 SQL 标准、拥有完整的事务处理能力和集群规模能够动态伸缩的业务场景:

  1. 大量的复杂查询操作要求优化器能够生成优良的执行计划,并且执行引擎能够充分利用多机器、多核的硬件资源
  2. 某些行业对数据一致性和多副本备份容灾有较高要求,同时希望维护成本足够低和故障恢复时间足够短;
  3. 用户的业务规模有峰值,要求所需的机器资源能够灵活地添加和删除。

DPC架构:

一个完整的 DMDPC 架构由计划生成节点 SP、数据存储节点 BP 和元数据服务器节点 MP 三部分组成。

  • SP 对外提供分布式数据库服务,用户可以登录到任意一个 SP 节点,获得完整的数据库服务,SP 节点不存储数据,配置成单机即可。
  • BP 负责存储数据,执行 SP 的调度指令并将执行结果返回给 SP。
  • MP 负责存储元数据并向 SP、BP 提供元数据服务。
    MP 和 BP 节点既可以配置成单机,也可以配置成多副本系统。其中每一个多副本系统中只有一个作为主节点,其余节点均作为备份节点。

1 集群规划

DMDPC 集群规划部署 1 个 SP,2 个 BP 和 1 个 MP。
MP 采用单机模式,BP 采用多副本模式,每个 BP 配置 2 个副本。
集群规划示意:
在这里插入图片描述

2 初始化数据库实例

根据集群规划,初始化 8 个实例,分别为 SP、MP 和 6 个 BP 角色。

初始化SP节点

[root@192-168-145-130 ~]# mkdir -p /dmdata/dpc_data/sp1
[root@192-168-145-130 ~]# chown -R dmdba:dinstall /dmdata/dpc_data/sp1
[root@192-168-145-130 ~]# chmod -R 777 /dmdata/dpc_data/sp1
[root@192-168-145-130 ~]#
[dmdba@192-168-145-130 bin]$ ./dminit path=/dmdata/dpc_data/sp1 instance_name=SP1 port_num=5236 ap_port_num=6000 dpc_mode=SP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-01-15
write to dir [/dmdata/dpc_data/sp1/DAMENG].
create dm database success. 2024-04-28 14:24:26
[dmdba@10-8-148-8 bin]$

初始化MP节点

[root@192-168-145-130 ~]# mkdir -p /dmdata/dpc_data/mp
[root@192-168-145-130 ~]# chown -R dmdba:dinstall /dmdata/dpc_data/mp
[root@192-168-145-130 ~]# chmod -R 777 /dmdata/dpc_data/mp
[root@192-168-145-130 ~]# su - dmdba
上一次登录: 日 428 14:23:29 CST 2024 pts/0 上
[dmdba@10-8-148-8 ~]$ cd /dm8/bin
[dmdba@10-8-148-8 bin]$ ./dminit path=/dmdata/dpc_data/mp  instance_name=MP  port_num=5237 ap_port_num=7008 dpc_mode=MP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-01-15
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/mp/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/mp/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/mp/DAMENG].
create dm database success. 2024-04-28 14:27:34
[dmdba@192-168-145-130 bin]$
[dmdba@192-168-145-130 bin]$ netstat -tunlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::54360                :::*                    LISTEN      1561/dmwatcher
tcp6       0      0 :::55360                :::*                    LISTEN      1568/dmserver
tcp6       0      0 :::9090                 :::*                    LISTEN      -
tcp6       0      0 :::52360                :::*                    LISTEN      1568/dmserver
tcp6       0      0 :::4236                 :::*                    LISTEN      76037/dmap
tcp6       0      0 :::9100                 :::*                    LISTEN      -
tcp6       0      0 :::9103                 :::*                    LISTEN      -
tcp6       0      0 :::111                  :::*                    LISTEN      -
tcp6       0      0 :::53360                :::*                    LISTEN      1568/dmserver
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -
udp        0      0 0.0.0.0:111             0.0.0.0:*                           -
udp        0      0 127.0.0.1:323           0.0.0.0:*                           -
udp6       0      0 :::111                  :::*                                -
udp6       0      0 ::1:323                 :::*                                -
udp6       0      0 :::53811                :::*                                -
udp6       0      0 :::25826                :::*                                -
[dmdba@192-168-145-130 bin]$

初始化RAFT_1组中的BP实例

BP11:

[root@192-168-145-131 ~]# mkdir -p /dmdata/dpc_data/bp11
[root@192-168-145-131 ~]# chown -R dmdba:dinstall /dmdata/dpc_data/bp11
[root@192-168-145-131 ~]# chmod -R 777 /dmdata/dpc_data/bp11
[root@192-168-145-131 bin]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      859/rpcbind
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1510/sshd: /usr/sbi
tcp        0      0 0.0.0.0:30236           0.0.0.0:*               LISTEN      3023/docker-proxy
tcp6       0      0 :::9090                 :::*                    LISTEN      1/systemd
tcp6       0      0 :::15236                :::*                    LISTEN      1533/dmserver
tcp6       0      0 :::9100                 :::*                    LISTEN      983/node_exporter
tcp6       0      0 :::9103                 :::*                    LISTEN      1005/collectd_expor
tcp6       0      0 :::111                  :::*                    LISTEN      859/rpcbind
tcp6       0      0 :::5236                 :::*                    LISTEN      1534/dmserver
tcp6       0      0 :::22                   :::*                    LISTEN      1510/sshd: /usr/sbi
tcp6       0      0 :::30236                :::*                    LISTEN      3029/docker-proxy
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1210/dhclient
udp        0      0 0.0.0.0:111             0.0.0.0:*                           859/rpcbind
udp        0      0 127.0.0.1:323           0.0.0.0:*                           922/chronyd
udp6       0      0 :::111                  :::*                                859/rpcbind
udp6       0      0 ::1:323                 :::*                                922/chronyd
udp6       0      0 :::25826                :::*                                1005/collectd_expor
udp6       0      0 :::44794                :::*                                1007/collectd

[dmdba@192-168-145-131 /]$ cd /dm8/bin
[dmdba@192-168-145-131 bin]$ ./dminit path=/dmdata/dpc_data/bp11 instance_name=BP11 port_num=5238 ap_port_num=6002 dpc_mode=BP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2024-12-26
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/bp11/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/bp11/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/bp11/DAMENG].
create dm database success. 2024-04-28 14:44:28

BP12:

[root@192-168-145-131 bin]$ mkdir -p /dmdata/dpc_data/bp12
[root@192-168-145-131 bin]$ chown -R dmdba:dinstall /dmdata/dpc_data/bp12
[root@192-168-145-131 bin]$ chmod -R 777 /dmdata/dpc_data/bp12
[dmdba@192-168-145-131 bin]$ cd /dm8/bin
[dmdba@192-168-145-131 bin]$ ./dminit path=/dmdata/dpc_data/bp12 instance_name=BP12 port_num=5239 ap_port_num=6003 dpc_mode=BP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2024-12-26
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/bp12/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/bp12/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/bp12/DAMENG].
create dm database success. 2024-04-28 14:47:17
[dmdba@192-168-145-131 bin]$

BP13:

[root@192-168-145-131 bin]$ mkdir -p /dmdata/dpc_data/bp13
[root@192-168-145-131 bin]$ chown -R dmdba:dinstall /dmdata/dpc_data/bp13
[root@192-168-145-131 bin]$ chmod -R 777 /dmdata/dpc_data/bp13
[dmdba@192-168-145-131 bin]$ ./dminit path=/dmdata/dpc_data/bp13 instance_name=BP13 port_num=5240 ap_port_num=6004 dpc_mode=BP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2024-12-26
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/bp13/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/bp13/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/bp13/DAMENG].
create dm database success. 2024-04-28 14:49:26
[dmdba@10-8-148-6 bin]$

初始化RAFT_2组中的BP实例

BP21:

[root@dw01:~]$ netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1366/sshd: /usr/sbi
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      847/rpcbind
tcp6       0      0 :::22                   :::*                    LISTEN      1366/sshd: /usr/sbi
tcp6       0      0 :::9090                 :::*                    LISTEN      1/systemd
tcp6       0      0 :::4236                 :::*                    LISTEN      462004/dmap
tcp6       0      0 :::9100                 :::*                    LISTEN      961/node_exporter
tcp6       0      0 :::9103                 :::*                    LISTEN      974/collectd_export
tcp6       0      0 :::111                  :::*                    LISTEN      847/rpcbind
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1283/dhclient
udp        0      0 0.0.0.0:111             0.0.0.0:*                           847/rpcbind
udp        0      0 127.0.0.1:323           0.0.0.0:*                           917/chronyd
udp6       0      0 :::52604                :::*                                977/collectd
udp6       0      0 :::111                  :::*                                847/rpcbind
udp6       0      0 ::1:323                 :::*                                917/chronyd
udp6       0      0 :::25826                :::*                                974/collectd_export
[root@dw01:~]$ mkdir -p /dmdata/dpc_data/bp21
[root@dw01:~]$ chown -R dmdba:dinstall /dmdata/dpc_data/bp21
[root@dw01:~]$ chmod -R 777 /dmdata/dpc_data/bp21
[root@dw01:~]$
[dmdba@dw01:~]$ cd /dm8_20240322/bin/
[dmdba@dw01:/dm8_20240322/bin]$ ./dminit path=/dmdata/dpc_data/bp21 instance_name=BP21 port_num=5241 ap_port_num=6005 dpc_mode=BP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-03-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/bp21/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/bp21/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/bp21/DAMENG].
create dm database success. 2024-04-28 14:56:41
[dmdba@dw01:/dm8_20240322/bin]$

BP22:

[root@dw01:~]$ mkdir -p /dmdata/dpc_data/bp22
[root@dw01:~]$ chown -R dmdba:dinstall /dmdata/dpc_data/bp22
[root@dw01:~]$ chmod -R 777 /dmdata/dpc_data/bp22

[dmdba@dw01:~]$ cd /dm8_20240322/bin/
[dmdba@dw01:/dm8_20240322/bin]$ ./dminit path=/dmdata/dpc_data/bp22 instance_name=BP22 port_num=5242 ap_port_num=6006 dpc_mode=BP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-03-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/bp22/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/bp22/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/bp22/DAMENG].
create dm database success. 2024-04-28 14:59:08

BP23:

[root@dw01:~]$ mkdir -p /dmdata/dpc_data/bp23
[root@dw01:~]$ chown -R dmdba:dinstall /dmdata/dpc_data/bp23
[root@dw01:~]$ chmod -R 777 /dmdata/dpc_data/bp23
[root@dw01:~]$ su - dmdba
[dmdba@dw01:~]$ cd /dm8_20240322/bin/
[dmdba@dw01:/dm8_20240322/bin]$ ./dminit path=/dmdata/dpc_data/bp23 instance_name=BP23 port_num=5243 ap_port_num=6007 dpc_mode=BP
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-03-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dmdata/dpc_data/bp23/DAMENG/DAMENG01.log


 log file path: /dmdata/dpc_data/bp23/DAMENG/DAMENG02.log

write to dir [/dmdata/dpc_data/bp23/DAMENG].
create dm database success. 2024-04-28 15:00:24
[dmdba@dw01:/dm8_20240322/bin]$

3 为 SP、BP 和 MP 配置 MP.INI 文件

为 SP、BP 和 MP 实例配置 MP.INI 文件。

MP.INI 文件内容如下:

[dmdba@10-8-148-8 bin]$ cd /dmdata/dpc_data/mp/DAMENG/

[dmdba@10-8-148-8 DAMENG]$ vi mp.ini
[dmdba@10-8-148-8 DAMENG]$ cat mp.ini
mp_host = 10.8.148.8
mp_port =8000   #与MP、BP和SP上的ap_port_num不冲突的端口号
[dmdba@10-8-148-8 DAMENG]$

将 MP.INI 文件内容分别写入 SP(SP1)、两个 RAFT 组内的所有 BP(BP11、BP12、BP13、BP21、BP22、BP23)和 MP 中。

4 启动 MP

注意相关端口是否被占用,涉及相关的服务器,防火墙是否关闭或者是否将相关端口加入到白名单。
如果端口没被占用,持续报端口的错误,
ps -ef|grep dmdba
kill掉相关的进程,再重新启动

[dmdba@10-8-148-8 bin]$ ./dmserver /dmdata/dpc_data/mp/DAMENG/dm.ini dpc_mode=MP
file dm.key not found, use default license!
version info: develop
DM Database Server 64 V8 03134284132-20240115-215128-20081 startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2025-01-15
begin redo pwr log collect, last ckpt lsn: 3 ...
redo pwr log collect finished
main rfil[/dmdata/dpc_data/mp/DAMENG/DAMENG01.log]'s grp collect 0 valid pwr record, discard 1 invalid pwr record
EP[0]'s cur_lsn[43482], file_lsn[43482]
begin redo log recover, last ckpt lsn: 3 ...
redo log recover finished
ndct db load finished, code:0
[EDCT]edct_sys_mp_set_last_modify_tick force (4294967295->1857152437) in [edct_tables_load]
pseg_set_gtv_trxid_low next_trxid in mem:[14014]
pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 to_release_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 to_release_pages, 0 mgr pages, 0 mgr recs!
next_trxid in mem:[16016]
next_trxid = 18018.
pseg recv finished
nsvr_startup end.
uthr_pipe_create, create pipe[read:14, write:15]
uthr_pipe_create, create pipe[read:16, write:17]
uthr_pipe_create, create pipe[read:18, write:19]
uthr_pipe_create, create pipe[read:20, write:21]
uthr_pipe_create, create pipe[read:22, write:23]
uthr_pipe_create, create pipe[read:24, write:25]
uthr_pipe_create, create pipe[read:26, write:27]
uthr_pipe_create, create pipe[read:28, write:29]
uthr_pipe_create, create pipe[read:30, write:31]
uthr_pipe_create, create pipe[read:32, write:33]
uthr_pipe_create, create pipe[read:34, write:35]
uthr_pipe_create, create pipe[read:36, write:37]
uthr_pipe_create, create pipe[read:38, write:39]
uthr_pipe_create, create pipe[read:40, write:41]
uthr_pipe_create, create pipe[read:42, write:43]
uthr_pipe_create, create pipe[read:44, write:45]
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info finished, code:0.
nsvr_process_before_open begin.
nsvr_process_before_open success.
comm_create_lsnr_sockets_low failed to create socket or listen port:6008, errno:107.
[dmdba@10-8-148-8 bin]$ netstat -tunlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::54360                :::*                    LISTEN      1561/dmwatcher
tcp6       0      0 :::55360                :::*                    LISTEN      1568/dmserver
tcp6       0      0 :::9090                 :::*                    LISTEN      -
tcp6       0      0 :::52360                :::*                    LISTEN      1568/dmserver
tcp6       0      0 :::4236                 :::*                    LISTEN      76037/dmap
tcp6       0      0 :::9100                 :::*                    LISTEN      -
tcp6       0      0 :::9103                 :::*                    LISTEN      -
tcp6       0      0 :::111                  :::*                    LISTEN      -
tcp6       0      0 :::53360                :::*                    LISTEN      1568/dmserver
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -
udp        0      0 0.0.0.0:111             0.0.0.0:*                           -
udp        0      0 127.0.0.1:323           0.0.0.0:*                           -
udp6       0      0 :::111                  :::*                                -
udp6       0      0 ::1:323                 :::*                                -
udp6       0      0 :::53811                :::*                                -
udp6       0      0 :::25826                :::*                                -
[dmdba@10-8-148-8 bin]$ netstat -tuln | grep 8000
[dmdba@10-8-148-8 bin]$ comm_create_lsnr_sockets_low failed to create socket or listen port:8000, errno:107.^C
[dmdba@10-8-148-8 bin]$ ps -ef|grep dmdba
dmdba       1561       1  0 2月18 ?       00:36:27 /data/dm8_rww/bin/dmwatcher path=/data/dm8_rww/data/DAMENG/dmwatcher.ini -noconsole
dmdba       1568       1  0 2月18 ?       01:33:05 /data/dm8_rww/bin/dmserver path=/data/dm8_rww/data/DAMENG/dm.ini -noconsole mount
dmdba      64104       1  0 3月06 ?       00:00:01 /usr/lib/systemd/systemd --user
dmdba      64105   64104  0 3月06 ?       00:00:00 (sd-pam)
dmdba      76037       1  0 3月06 ?       00:03:17 /dm8/bin/dmap
root      211133  211077  0 14:20 pts/0    00:00:00 su - dmdba
dmdba     211134  211133  0 14:20 pts/0    00:00:00 -bash
dmdba     211420  211134  0 14:37 pts/0    00:00:00 ps -ef
dmdba     211421  211134  0 14:37 pts/0    00:00:00 grep dmdba

[dmdba@10-8-148-8 bin]$  ps -ef|grep dmdba
root      211133  211077  0 14:20 pts/0    00:00:00 su - dmdba
dmdba     211134  211133  0 14:20 pts/0    00:00:00 -bash
dmdba     211454  211134  0 14:39 pts/0    00:00:00 ps -ef
dmdba     211455  211134  0 14:39 pts/0    00:00:00 grep dmdba
[dmdba@10-8-148-8 bin]$ cd /dm8/bin

[dmdba@localhost bin]$ ./dmserver /dmdata/dpc_data/mp/DAMENG/dm.ini dpc_mode=MP
file dm.key not found, use default license!
version info: develop
DM Database Server 64 V8 03134284132-20231226-213242-20081 startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2024-12-26
begin redo pwr log collect, last ckpt lsn: 3 ...
redo pwr log collect finished
main rfil[/dmdata/dpc_data/mp/DAMENG/DAMENG01.log]'s grp collect 0 valid pwr record, discard 3 invalid pwr record
EP[0]'s cur_lsn[43858], file_lsn[43858]
begin redo log recover, last ckpt lsn: 3 ...
redo log recover finished
ndct db load finished, code:0
[EDCT]edct_sys_mp_set_last_modify_tick force (4294967295->3750878) in [edct_tables_load]
pseg_set_gtv_trxid_low next_trxid in mem:[26026]
pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 to_release_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 to_release_pages, 0 mgr pages, 0 mgr recs!
next_trxid in mem:[28028]
next_trxid = 30030.
pseg recv finished
nsvr_startup end.
uthr_pipe_create, create pipe[read:12, write:13]
uthr_pipe_create, create pipe[read:14, write:15]
uthr_pipe_create, create pipe[read:16, write:17]
uthr_pipe_create, create pipe[read:18, write:19]
uthr_pipe_create, create pipe[read:20, write:21]
uthr_pipe_create, create pipe[read:22, write:23]
uthr_pipe_create, create pipe[read:24, write:25]
uthr_pipe_create, create pipe[read:26, write:27]
uthr_pipe_create, create pipe[read:28, write:29]
uthr_pipe_create, create pipe[read:30, write:31]
uthr_pipe_create, create pipe[read:32, write:33]
uthr_pipe_create, create pipe[read:34, write:35]
uthr_pipe_create, create pipe[read:36, write:37]
uthr_pipe_create, create pipe[read:38, write:39]
uthr_pipe_create, create pipe[read:40, write:41]
uthr_pipe_create, create pipe[read:42, write:43]
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info finished, code:0.
nsvr_process_before_open begin.
nsvr_process_before_open success.
SYSTEM IS READY.
Enable xa trx service after collect trx from all bp compilied!
Enable min_tid service after confirm trx from all bp compilied!

5 将 MP、SP 和 BP 加入集群

增加 1 个 MP、1 个 SP 和 6 个 BP 节点。只有在注册当前登录 MP 节点后,才可以注册其余节点。后续增加 MP、SP 节点和 BP 节点无先后之分。

//搭建DMDPC过程中加入MP、SP和BP,必须登录MP进行操作
[dmdba@localhost bin]$ ./disql SYSDBA/SYSDBA@LOCALHOST:5237

服务器[LOCALHOST:5237]:处于普通打开状态
登录使用时间 : 62.989(ms)
disql V8
SQL> 


//增加MP节点
//注册当前MP实例,MP的RAFT组名可以指定为'MP_RAFT'
SP_CREATE_DPC_INSTANCE(NULL,'MP','MP',7008,5237, '192.168.145.130', '192.168.145.130','NORMAL',1,'MP instance');

//增加BP节点
//注册RAFT组,名为RAFT_1
SQL> SP_CREATE_DPC_RAFT('BP', 'RAFT_1');
DMSQL 过程已成功完成
已用时间: 9.292(毫秒). 执行号:502.
//在RAFT_1组内注册BP实例BP11、BP12、BP13
//所有实例均以STANDBY模式、INVALID状态注册进MP,实例启动后,在RAFT组内选举出有效主库后,会自动更新MP中的模式、状态信息。

SQL> SP_CREATE_DPC_INSTANCE('RAFT_1', 'BP11', 'BP', 6002, 5238, '192.168.145.131', '192.168.145.131','STANDBY', 0, 'BP instance');
DMSQL 过程已成功完成
已用时间: 2.339(毫秒). 执行号:503.
SQL> SP_CREATE_DPC_INSTANCE('RAFT_1', 'BP12', 'BP', 6003, 5239, '192.168.145.131', '192.168.145.131','STANDBY', 0, 'BP instance');
DMSQL 过程已成功完成
已用时间: 1.801(毫秒). 执行号:504.
SQL> SP_CREATE_DPC_INSTANCE('RAFT_1', 'BP13', 'BP', 6004, 5240, '192.168.145.131', '192.168.145.131','STANDBY', 0, 'BP instance');
DMSQL 过程已成功完成
已用时间: 2.159(毫秒). 执行号:505.
SQL> 


//注册RAFT组,名为RAFT_2
SQL> SP_CREATE_DPC_RAFT('BP', 'RAFT_2');
//在RAFT_2内注册BP实例BP21、BP22、BP23
SQL> SP_CREATE_DPC_INSTANCE('RAFT_2', 'BP21', 'BP', 6005, 5241, '192.168.145.131', '192.168.145.131','STANDBY', 0, 'BP instance');
DMSQL 过程已成功完成
已用时间: 1.827(毫秒). 执行号:508.
SQL> SP_CREATE_DPC_INSTANCE('RAFT_2', 'BP22', 'BP', 6006, 5242, '192.168.145.131', '192.168.145.131','STANDBY', 0, 'BP instance');
DMSQL 过程已成功完成
已用时间: 1.960(毫秒). 执行号:509.
SQL> SP_CREATE_DPC_INSTANCE('RAFT_2', 'BP23', 'BP', 6007, 5243, '192.168.145.131', '192.168.145.131','STANDBY', 0, 'BP instance');
DMSQL 过程已成功完成
已用时间: 2.212(毫秒). 执行号:510.
SQL> 


//注册一个BP组,名为BG_1
SQL> SP_CREATE_DPC_BP_GROUP('BG_1', 'bp group1');
DMSQL 过程已成功完成
已用时间: 9.339(毫秒). 执行号:511.
//在BP组内添加RAFT组
SQL> SP_BP_GROUP_ADD_RAFT('BG_1', 'RAFT_1');
DMSQL 过程已成功完成
已用时间: 32.191(毫秒). 执行号:512.
SQL> SP_BP_GROUP_ADD_RAFT('BG_1', 'RAFT_2');
DMSQL 过程已成功完成
已用时间: 2.059(毫秒). 执行号:513.
SQL> 


//增加SP节点
//增加SP,也要注册RAFT组,参数1为空串
SQL> SP_CREATE_DPC_RAFT('SP', 'RAFT_SP1');
DMSQL 过程已成功完成
已用时间: 2.347(毫秒). 执行号:514.
//在RAFT_SP1内注册SP实例SP1
SQL> SP_CREATE_DPC_INSTANCE('RAFT_SP1', 'SP1', 'SP', 6000, 5236, '192.168.145.130', '192.168.145.130','NORMAL', 2, 'SP instance');
DMSQL 过程已成功完成
已用时间: 1.913(毫秒). 执行号:515.


//注册三个容错域:FDOM_1 FDOM_2 FDOM_3
SQL> SP_CREATE_FAULT_DOMAIN ('FDOM_1', 'shanghai_1');
DMSQL 过程已成功完成
已用时间: 2.827(毫秒). 执行号:516.
SQL> SP_CREATE_FAULT_DOMAIN ('FDOM_2', 'shanghai_2');
DMSQL 过程已成功完成
已用时间: 1.865(毫秒). 执行号:517.
SQL> SP_CREATE_FAULT_DOMAIN ('FDOM_3', 'shanghai_3');
DMSQL 过程已成功完成
已用时间: 1.727(毫秒). 执行号:518.
SQL> 


//往容错域中添加实例
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_1', 'MP');
DMSQL 过程已成功完成
已用时间: 31.256(毫秒). 执行号:519.
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_1', 'BP11');
DMSQL 过程已成功完成
已用时间: 2.147(毫秒). 执行号:520.
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_1', 'BP21');
DMSQL 过程已成功完成
已用时间: 1.909(毫秒). 执行号:521.
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_2', 'BP12');
DMSQL 过程已成功完成
已用时间: 1.979(毫秒). 执行号:522.
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_2', 'BP22');
DMSQL 过程已成功完成
已用时间: 2.068(毫秒). 执行号:523.
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_3', 'BP13');
DMSQL 过程已成功完成
已用时间: 1.939(毫秒). 执行号:524.
SQL> SP_FAULT_DOMAIN_MV_INST('FDOM_3', 'BP23');
DMSQL 过程已成功完成
已用时间: 2.772(毫秒). 执行号:525.

6 检查注册是否成功

查询系统表,检查上一步骤的注册是否成功。能查到相关信息表示注册成功。

SQL> select * from DPC_BP_GROUP;

行号     ID          NAME DESCRIPTION RAFT_NUM    RAFT_INFO  INFO1      
---------- ----------- ---- ----------- ----------- ---------- -----------
           INFO2                INFO3     
           -------------------- ----------
1          0           BG_1 bp group1   2           0x01000200 0
           NULL                 NULL


已用时间: 5.657(毫秒). 执行号:526.
SQL> select * from DPC_BP_RAFT;

行号     RAFT_ID     GROUP_ID    DPC_MODE NAME     IS_VALID    INFO1      
---------- ----------- ----------- -------- -------- ----------- -----------
           INFO2                INFO3     
           -------------------- ----------
1          0           -1          MP       MP_RAFT  1           NULL
           NULL                 NULL

2          1           -1          BP       RAFT_1   1           NULL
           NULL                 NULL

3          2           -1          BP       RAFT_2   1           NULL
           NULL                 NULL


行号     RAFT_ID     GROUP_ID    DPC_MODE NAME     IS_VALID    INFO1      
---------- ----------- ----------- -------- -------- ----------- -----------
           INFO2                INFO3     
           -------------------- ----------
4          3           -1          SP       RAFT_SP1 1           NULL
           NULL                 NULL


已用时间: 1.058(毫秒). 执行号:527.
SQL> select * from DPC_INSTANCE;

行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
1          0           4096        MP   MP       7008        5237
           192.168.145.130 NORMAL   4           1           MP instance
           192.168.145.130 65536       NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
2          1           4097        BP11 BP       6002        5238
           192.168.145.131 STANDBY  6           0           BP instance
           192.168.145.131 65536       NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
3          1           4098        BP12 BP       6003        5239
           192.168.145.131 STANDBY  6           0           BP instance
           192.168.145.131 131072      NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
4          1           4099        BP13 BP       6004        5240
           192.168.145.131 STANDBY  6           0           BP instance
           192.168.145.131 196608      NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
5          2           4100        BP21 BP       6005        5241
           192.168.145.131 STANDBY  6           0           BP instance
           192.168.145.131 65536       NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
6          2           4101        BP22 BP       6006        5242
           192.168.145.131 STANDBY  6           0           BP instance
           192.168.145.131 131072      NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
7          2           4102        BP23 BP       6007        5243
           192.168.145.131 STANDBY  6           0           BP instance
           192.168.145.131 196608      NULL                 NULL


行号     RAFT_ID     INST_ID     NAME DPC_MODE XMAL_PORT   INST_PORT  
---------- ----------- ----------- ---- -------- ----------- -----------
           IP_INTERNAL     SYS_MODE SYS_STATUS  STATUS      DESCRIPTION
           --------------- -------- ----------- ----------- -----------
           IP_EXTERNAL     INFO1       INFO2                INFO3     
           --------------- ----------- -------------------- ----------
8          3           4103        SP1  SP       6000        5236
           192.168.145.130 NORMAL   6           2           SP instance
           192.168.145.130 NULL        NULL                 NULL


8 rows got

已用时间: 1.002(毫秒). 执行号:528.
SQL> 

7 配置 BP11

1: 配置 BP11 的 dm.ini

ARCH_INI = 1   #打开归档配置

2: 配置 BP11 的本地归档 dmarch.ini。此处先只配本地归档,避免提前发起 RAFT 选举

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST =/dmdata/dpc_data/bp11/DAMENG/arch  #本地归档文件路径
ARCH_FILE_SIZE = 128   #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

3:正常启动 BP11 到 Open 状态

[dmdba@localhost bin]$ ./dmserver /dmdata/dpc_data/bp11/DAMENG/dm.ini dpc_mode=bp
file dm.key not found, use default license!
version info: develop
enet begin to find valid MP....
enet check MP success! MP[](cfg:192.168.145.130:8000, inst_id:4096, xmal_port:7008, rraft_stat:1, l_term_id:0) SELF(raft_id:1, inst_id:4097)
enet fix valid MP SUCCESS! MP[](cfg:192.168.145.130:8000, inst_id:4096, xmal_port:7008, rraft_stat:1, l_term_id:0) SELF(raft_id:1, inst_id:4097)
enet select raft valid inst. raft:0, inst:4096, ps_flag:1, xsite:(nil), l_term_id:0.
enet set new xsite[0x7f411a4ce800] from raft:0 inst:4096 valid_flag:1
enet_check_mp_ini complete. elnk:[0x7f411a4ce800] to site[4096] code:0
[EDCT]edct_sys_bsp_set_last_modify_tick (4294967295->29822804). current dpc_dct_refresh_policy:1
edct_collect_raft_primary_info get self_stat:0.curr_sys_status:0, curr_sys_mode:0, raft_cnt:0, raft_stat:1,inst_sys_status:6, inst_sys_mode:2, inst_status:0, is_to_mount:0.
DM Database Server 64 V8 03134284132-20240115-215128-20081 startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2025-01-15
file lsn: 0
ckpt2_exec_immediately begin.
checkpoint begin, used_space[0], free_space[536862720]...
checkpoint begin, used_space[0], free_space[536862720]...
pseg_set_gtv_trxid_low next_trxid in mem:[36066]
pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 to_release_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 to_release_pages, 0 mgr pages, 0 mgr recs!
next_trxid in mem:[36066]
next_trxid = 38068.
pseg recv finished
nsvr_startup end.
uthr_pipe_create, create pipe[read:43, write:44]
uthr_pipe_create, create pipe[read:45, write:46]
uthr_pipe_create, create pipe[read:47, write:48]
uthr_pipe_create, create pipe[read:49, write:50]
uthr_pipe_create, create pipe[read:51, write:52]
uthr_pipe_create, create pipe[read:53, write:54]
uthr_pipe_create, create pipe[read:55, write:56]
uthr_pipe_create, create pipe[read:57, write:58]
uthr_pipe_create, create pipe[read:59, write:60]
uthr_pipe_create, create pipe[read:61, write:62]
uthr_pipe_create, create pipe[read:63, write:64]
uthr_pipe_create, create pipe[read:65, write:66]
uthr_pipe_create, create pipe[read:67, write:68]
uthr_pipe_create, create pipe[read:69, write:70]
uthr_pipe_create, create pipe[read:71, write:72]
uthr_pipe_create, create pipe[read:73, write:74]
aud sys init success.
aud rt sys init success.
nsvr_process_before_open begin.
nsvr_process_before_open success.
SYSTEM IS READY.

8 准备 RAFT_1 组内数据

1 退出 BP11 并进行脱机备份

首先,退出 BP11。

其次,对 BP11 进行脱机备份。

[dmdba@localhost bin]$ ./dmrman CTLSTMT="BACKUP DATABASE '/dmdata/dpc_data/bp11/DAMENG/dm.ini' FULL TO BACKUP_01 BACKUPSET '/dmdata/dpc_data/bp11/BACKUP_01'" USE_AP=2
dmrman V8
BACKUP DATABASE '/dmdata/dpc_data/bp11/DAMENG/dm.ini' FULL TO BACKUP_01 BACKUPSET '/dmdata/dpc_data/bp11/BACKUP_01'
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[4510], file_lsn[4510]
Processing backupset /dmdata/dpc_data/bp11/BACKUP_01
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
backup successfully!
time used: 00:00:03.915

2 将 BP11 的备份文件脱机还原到 BP12

[dmdba@localhost bin]$ ./dmrman CTLSTMT="RESTORE DATABASE '/dmdata/dpc_data/bp12/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp11/BACKUP_01'" USE_AP=2
dmrman V8
RESTORE DATABASE '/dmdata/dpc_data/bp12/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp11/BACKUP_01'
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
restore successfully.
time used: 00:00:02.472
[dmdba@localhost bin]$ ./dmrman CTLSTMT="RECOVER DATABASE '/dmdata/dpc_data/bp12/DAMENG/dm.ini' UPDATE DB_MAGIC" USE_AP=2
dmrman V8
RECOVER DATABASE '/dmdata/dpc_data/bp12/DAMENG/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[4510], file_lsn[4510]
recover successfully!
time used: 00:00:01.321
[dmdba@localhost bin]$ 

3 BP11 的备份文件脱机还原到 BP13

[dmdba@localhost bin]$ ./dmrman CTLSTMT="RESTORE DATABASE '/dmdata/dpc_data/bp13/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp11/BACKUP_01'" USE_AP=2
dmrman V8
RESTORE DATABASE '/dmdata/dpc_data/bp13/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp11/BACKUP_01'
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
restore successfully.
time used: 00:00:02.503
[dmdba@localhost bin]$ ./dmrman CTLSTMT="RECOVER DATABASE '/dmdata/dpc_data/bp13/DAMENG/dm.ini' UPDATE DB_MAGIC" USE_AP=2
dmrman V8
RECOVER DATABASE '/dmdata/dpc_data/bp13/DAMENG/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[4510], file_lsn[4510]
recover successfully!
time used: 00:00:01.095
[dmdba@localhost bin]$ 

9 配置 BP21

1: 配置 BP21 的 dm.ini

ARCH_INI = 1   #打开归档配置

2: 配置 BP21 的本地归档 dmarch.ini。此处先只配本地归档,避免提前发起 RAFT 选举

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST =/dmdata/dpc_data/bp21/DAMENG/arch  #本地归档文件路径
ARCH_FILE_SIZE = 128   #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

3:正常启动 BP21 到 Open 状态

[dmdba@localhost bin]$ ./dmserver /dmdata/dpc_data/bp21/DAMENG/dm.ini  dpc_mode=bp
file dm.key not found, use default license!
version info: develop
enet begin to find valid MP....
enet check MP success! MP[](cfg:192.168.145.130:8000, inst_id:4096, xmal_port:7008, rraft_stat:1, l_term_id:0) SELF(raft_id:2, inst_id:4100)
enet fix valid MP SUCCESS! MP[](cfg:192.168.145.130:8000, inst_id:4096, xmal_port:7008, rraft_stat:1, l_term_id:0) SELF(raft_id:2, inst_id:4100)
enet select raft valid inst. raft:0, inst:4096, ps_flag:1, xsite:(nil), l_term_id:0.
enet set new xsite[0x7ff1a3e00800] from raft:0 inst:4096 valid_flag:1
enet_check_mp_ini complete. elnk:[0x7ff1a3e00800] to site[4096] code:0
[EDCT]edct_sys_bsp_set_last_modify_tick (4294967295->29822804). current dpc_dct_refresh_policy:1
DM Database Server 64 V8 03134284132-20240115-215128-20081 startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
edct_collect_raft_primary_info get self_stat:0.curr_sys_status:1, curr_sys_mode:0, raft_cnt:0, raft_stat:1,inst_sys_status:6, inst_sys_mode:2, inst_status:0, is_to_mount:0.
Database mode = 0, oguid = 0
License will expire on 2025-01-15
file lsn: 0
ckpt2_exec_immediately begin.
checkpoint begin, used_space[0], free_space[536862720]...
checkpoint begin, used_space[0], free_space[536862720]...
pseg_set_gtv_trxid_low next_trxid in mem:[36066]
pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 to_release_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 to_release_pages, 0 mgr pages, 0 mgr recs!
next_trxid in mem:[36066]
next_trxid = 38068.
pseg recv finished
nsvr_startup end.
uthr_pipe_create, create pipe[read:43, write:44]
uthr_pipe_create, create pipe[read:45, write:46]
uthr_pipe_create, create pipe[read:47, write:48]
uthr_pipe_create, create pipe[read:49, write:50]
uthr_pipe_create, create pipe[read:51, write:52]
uthr_pipe_create, create pipe[read:53, write:54]
uthr_pipe_create, create pipe[read:55, write:56]
uthr_pipe_create, create pipe[read:57, write:58]
uthr_pipe_create, create pipe[read:59, write:60]
uthr_pipe_create, create pipe[read:61, write:62]
uthr_pipe_create, create pipe[read:63, write:64]
uthr_pipe_create, create pipe[read:65, write:66]
uthr_pipe_create, create pipe[read:67, write:68]
uthr_pipe_create, create pipe[read:69, write:70]
uthr_pipe_create, create pipe[read:71, write:72]
uthr_pipe_create, create pipe[read:73, write:74]
aud sys init success.
aud rt sys init success.
nsvr_process_before_open begin.
nsvr_process_before_open success.
SYSTEM IS READY.

10 准备 RAFT_2 组内数据

1:对BP12进行脱机备份

[dmdba@localhost bin]$ ./dmrman CTLSTMT="BACKUP DATABASE '/dmdata/dpc_data/bp21/DAMENG/dm.ini' FULL TO BACKUP_01 BACKUPSET '/dmdata/dpc_data/bp21/BACKUP_01'" USE_AP=2
dmrman V8
BACKUP DATABASE '/dmdata/dpc_data/bp21/DAMENG/dm.ini' FULL TO BACKUP_01 BACKUPSET '/dmdata/dpc_data/bp21/BACKUP_01'
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[4511], file_lsn[4511]
Processing backupset /dmdata/dpc_data/bp21/BACKUP_01
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
backup successfully!
time used: 00:00:03.917

2 将 BP21 的备份文件脱机还原到 BP22

[dmdba@localhost bin]$ ./dmrman CTLSTMT="RESTORE DATABASE '/dmdata/dpc_data/bp22/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp21/BACKUP_01'" USE_AP=2
dmrman V8
RESTORE DATABASE '/dmdata/dpc_data/bp22/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp21/BACKUP_01'
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
restore successfully.
time used: 00:00:02.472
[dmdba@localhost bin]$ ./dmrman CTLSTMT="RECOVER DATABASE '/dmdata/dpc_data/bp22/DAMENG/dm.ini' UPDATE DB_MAGIC" USE_AP=2
dmrman V8
RECOVER DATABASE '/dmdata/dpc_data/bp22/DAMENG/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[4511], file_lsn[4511]
recover successfully!
time used: 00:00:01.323
[dmdba@localhost bin]$ 

2 将 BP21 的备份文件脱机还原到 BP23

[dmdba@localhost bin]$ ./dmrman CTLSTMT="RESTORE DATABASE '/dmdata/dpc_data/bp23/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp21/BACKUP_01'" USE_AP=2
dmrman V8
RESTORE DATABASE '/dmdata/dpc_data/bp23/DAMENG/dm.ini' FROM BACKUPSET '/dmdata/dpc_data/bp21/BACKUP_01'
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
restore successfully.
time used: 00:00:02.503
[dmdba@localhost bin]$ ./dmrman CTLSTMT="RECOVER DATABASE '/dmdata/dpc_data/bp23/DAMENG/dm.ini' UPDATE DB_MAGIC" USE_AP=2
dmrman V8
RECOVER DATABASE '/dmdata/dpc_data/bp23/DAMENG/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[4511], file_lsn[4511]
recover successfully!
time used: 00:00:01.097
[dmdba@localhost bin]$ 

11 配置 BP dm.ini

RAFT_1 组各实例(BP11、BP12、BP13)和 RAFT_2 组各实例(BP21、BP22、BP23)中 dm.ini 文件的配置方法完全相同。

下面以 BP11 的 dm.ini 为例进行介绍。dm.ini 文件配置如下:

ARCH_INI = 1   #打开归档配置
ALTER_MODE_STATUS = 0   #不允许用户直接通过SQL语句修改服务器模式

12 配置 BP RAFT _1归档文件

修改 DMARCH.INI,配置 RAFT 归档与本地归档。RAFT_1 组配置如下:
1: 配置 BP11 归档文件 DMARCH.INI

XMAL_HB_INTERVAL = 5   #节点通信检测间隔
RAFT_HB_INTERVAL = 150   #选举心跳间隔
RAFT_VOTE_INTERVAL = 1500  #选举超时时间,三个库设置不同以尽快选出主库
RAFT_SELF_ID = 1   #多副本自身节点ID

[ARCHIVE_RAFT1]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP12  #归档目标实例名
ARCH_DEST_ID = 2   #归档目标多副本节点ID

[ARCHIVE_RAFT2]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP13   #归档目标 实例名
ARCH_DEST_ID = 3   #归档目标多副本节点ID

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST =/dmdata/dpc_data/bp11/DAMENG/arch  #本地归档文件路径
ARCH_FILE_SIZE = 128   #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

2.配置 BP12 归档配置文件 DMARCH.INI

XMAL_HB_INTERVAL = 5  #节点通信检测间隔
RAFT_HB_INTERVAL = 150   #选举心跳间隔
RAFT_VOTE_INTERVAL = 2000   #选举超时时间
RAFT_SELF_ID = 2   #多副本自身节点ID

[ARCHIVE_RAFT1]
ARCH_TYPE = RAFT  #RAFT归档
ARCH_DEST = BP11  #归档目标实例名
ARCH_DEST_ID = 1  #归档目标多副本节点ID

[ARCHIVE_RAFT2]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP13   #归档目标实例名
ARCH_DEST_ID = 3   #归档目标多副本节点ID

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL   #本地归档类型
ARCH_DEST = /dmdata/dpc_data/bp12/DAMENG/arch   #本地归档文件路径
ARCH_FILE_SIZE = 128   #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

配置 BP13 归档配置文件 DMARCH.INI

XMAL_HB_INTERVAL = 5   #节点通信检测间隔
RAFT_HB_INTERVAL = 150   #选举心跳间隔
RAFT_VOTE_INTERVAL = 2500   #选举超时时间
RAFT_SELF_ID = 3   #多副本自身节点ID

[ARCHIVE_RAFT1]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP11   #归档目标实例名
ARCH_DEST_ID = 1   #多副本归档目标节点ID

[ARCHIVE_RAFT2]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP12   #归档目标实例名
ARCH_DEST_ID = 2   #多副本归档目标节点ID

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL   #本地归档类型
ARCH_DEST = /dmdata/dpc_data/bp13/DAMENG/arch  #本地归档文件路径
ARCH_FILE_SIZE = 128  #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

13 配置 BP RAFT _2归档文件

1: 配置 BP21 归档文件 DMARCH.INI

XMAL_HB_INTERVAL = 5   #节点通信检测间隔
RAFT_HB_INTERVAL = 150   #选举心跳间隔
RAFT_VOTE_INTERVAL = 1500  #选举超时时间,三个库设置不同以尽快选出主库
RAFT_SELF_ID = 1   #多副本自身节点ID

[ARCHIVE_RAFT1]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP22  #归档目标实例名
ARCH_DEST_ID = 2   #归档目标多副本节点ID

[ARCHIVE_RAFT2]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP23   #归档目标 实例名
ARCH_DEST_ID = 3   #归档目标多副本节点ID

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST =/dmdata/dpc_data/bp21/DAMENG/arch  #本地归档文件路径
ARCH_FILE_SIZE = 128   #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

2.配置 BP22 归档配置文件 DMARCH.INI

XMAL_HB_INTERVAL = 5  #节点通信检测间隔
RAFT_HB_INTERVAL = 150   #选举心跳间隔
RAFT_VOTE_INTERVAL = 2000   #选举超时时间
RAFT_SELF_ID = 2   #多副本自身节点ID

[ARCHIVE_RAFT1]
ARCH_TYPE = RAFT  #RAFT归档
ARCH_DEST = BP21  #归档目标实例名
ARCH_DEST_ID = 1  #归档目标多副本节点ID

[ARCHIVE_RAFT2]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP23   #归档目标实例名
ARCH_DEST_ID = 3   #归档目标多副本节点ID

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL   #本地归档类型
ARCH_DEST = /dmdata/dpc_data/bp22/DAMENG/arch   #本地归档文件路径
ARCH_FILE_SIZE = 128   #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

配置 BP23 归档配置文件 DMARCH.INI

XMAL_HB_INTERVAL = 5   #节点通信检测间隔
RAFT_HB_INTERVAL = 150   #选举心跳间隔
RAFT_VOTE_INTERVAL = 2500   #选举超时时间
RAFT_SELF_ID = 3   #多副本自身节点ID

[ARCHIVE_RAFT1]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP21   #归档目标实例名
ARCH_DEST_ID = 1   #多副本归档目标节点ID

[ARCHIVE_RAFT2]
ARCH_TYPE = RAFT   #RAFT归档
ARCH_DEST = BP22   #归档目标实例名
ARCH_DEST_ID = 2   #多副本归档目标节点ID

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL   #本地归档类型
ARCH_DEST = /dmdata/dpc_data/bp23/DAMENG/arch  #本地归档文件路径
ARCH_FILE_SIZE = 128  #本地单个归档文件最大值,单位MB
ARCH_SPACE_LIMIT = 0   #本地归档文件总大小,0表示无限制

14 启动 SP 和 RAFT 组内所有 BP

启动 SP 和 BP 没有先后之分。

./dmserver path=/dmdata/dpc_data/sp1/DAMENG/dm.ini dpc_mode=sp
./dmserver /dmdata/dpc_data/bp11/DAMENG/dm.ini  dpc_mode=bp mount
./dmserver /dmdata/dpc_data/bp12/DAMENG/dm.ini  dpc_mode=bp mount
./dmserver /dmdata/dpc_data/bp13/DAMENG/dm.ini  dpc_mode=bp mount
./dmserver /dmdata/dpc_data/bp21/DAMENG/dm.ini  dpc_mode=bp mount
./dmserver /dmdata/dpc_data/bp22/DAMENG/dm.ini  dpc_mode=bp mount
./dmserver /dmdata/dpc_data/bp23/DAMENG/dm.ini  dpc_mode=bp mount

15v连接SP,可以对外提供服务

[dmdba@localhost bin]$ ./disql SYSDBA/SYSDBA@192.168.145.130:5236

服务器[192.168.145.130:5236]:处于普通打开状态
登录使用时间 : 96.731(ms)
disql V8
SQL> 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1666163.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

0基础理解ECC并做题-攻防世界easy-ECC理解

基点p就是最初选定的那个点 1和2都是整数集合,但是1/20.5就不属于整数集合 一直加,一直乘,还能保证有限个数字?这是因为采用了取模的运算,让元素始终都在有限的范围内。 如何计算分数求模? 设n1/2mod23,那么…

使用注解的方式进行配置RabbitMQ

引入依赖&#xff1a; <dependency><groupId>org.springframework.amqp</groupId><artifactId>spring-rabbit-test</artifactId><scope>test</scope></dependency> 配置application.yml server:port: 8082 spring:rabbitmq…

Coze扣子开发指南:AI零代码编程创建插件

在Coze扣子中创建插件&#xff0c;有两种方式&#xff0c;一是用API&#xff0c;具体方式参照上一篇文章《Coze扣子开发指南&#xff1a;用免费API自己创建插件》&#xff0c;还有一种方式就是编程&#xff0c;不过有了AI的帮助&#xff0c;即使不会编程的人&#xff0c;也可以…

如何清除DNS缓存,刷新DNS

大家在使用域名访问服务器的时候&#xff0c;经常会遇到一个问题&#xff0c;同一个局域网里的两台电脑&#xff0c;一台可以访问而另一台不行。这是为什么呢&#xff1f;这里我要和大家说下DNS缓存的问题&#xff0c;顾名思义&#xff0c;每台电脑都有DNS缓存&#xff0c;在域…

MyBatis-plus(一):快速入门

目录 一、MyBatis-plus 快速入门 1、原理 2、实体类命名规则 3、常见注解 4、主键 id 策略 5、使用 TableField 的常见场景 6、常用配置 二、核心功能 1、条件构造器 2、自定义 SQL 3、IService 接口 一、MyBatis-plus 快速入门 1、原理 MyBatisPlus 通过扫描实体…

Leetcode 剑指 Offer II 077.排序链表

题目难度: 中等 原题链接 今天继续更新 Leetcode 的剑指 Offer&#xff08;专项突击版&#xff09;系列, 大家在公众号 算法精选 里回复 剑指offer2 就能看到该系列当前连载的所有文章了, 记得关注哦~ 题目描述 给定链表的头结点 head &#xff0c;请将其按 升序 排列并返回 排…

STM32入门_江协科技_5~6_OB记录的自学笔记_GPIO输出_LED流水灯_蜂鸣器

5. GPIO 输出 5.1. GPIO简介 GPIO&#xff08;General Purpose Input Output&#xff09;通用输入输出口可配置为8种输入输出模式引脚电平&#xff1a;0V~3.3V&#xff0c;部分引脚可容忍5V&#xff08;端口输入5V的电压&#xff0c;之前引脚定义表格中带FT标识的&#xff09…

暗区突围哪里获得测试资格 暗区突围测试资格获取方法

在游戏业界的浩瀚星空中&#xff0c;《暗区突围》如同一颗璀璨新星&#xff0c;以其独树一帜的游戏模式和前所未有的沉浸式体验&#xff0c;迅速吸引了全球玩家的目光。它不仅仅是一款游戏&#xff0c;更像是一次对勇气、智慧与团队合作的深度探索。玩家在危机四伏的暗区中&…

【软考高项】四十四、高级项目管理

一、项目集管理 相关角色 项目集发起人、项目集指导委员会、项目集经理、其他影响项目集的干系人项目集管理绩效域 项目集战略一致性、项目集效益管理、项目集干系人参与、项目集治理和项目集生命周期管理 二、项目组合管理 项目组合经理角色 项目组合管理原…

软件测试报告(交付文档支撑word原件)

软件测试报告在软件开发过程中起着至关重要的作用&#xff0c;主要有以下几个主要原因&#xff1a; 1、确保软件质量 2、提供决策支持 3、记录测试过程和结果 4、促进沟通和协作 5、符合标准和法规要求 6、改进测试流程和策略 7、降低风险 软件开发全套资料获取进主页或者本文…

【字符函数与字符串函数】

文章目录 一、strlen函数1.strlen函数的使用2.strlen函数的模拟实现(1)计算器办法(2)不创建临时变量计数器(3)指针 二、strcpy函数1、strcpy函数的使用2、strcpy函数的模拟实现 三、strcat函数1、strcat函数的使用2、strcat模拟实现3、字符串自己给自己追加&#xff1f; 四、st…

2024年数维杯数学建模

高质量原创论文已完成 需要的私我

构建内网yum仓库

1、环境介绍 系统&#xff1a;龙蜥os 7.9 2、安装epel源 yum install epel-release -y3、安装nginx服务器并启动 yum install nginx httpd -y配置 server {listen 80;server_name repo.wtown.com;root /usr/share/nginx/html/repo;index index.html index.htm;location / {…

信息安全-古典密码学简介

目录 C. D. Shannon: 一、置换密码 二、单表代替密码 ① 加法密码 ② 乘法密码 ③密钥词组代替密码 三、多表代替密码 代数密码 四、古典密码的穷举分析 1、单表代替密码分析 五、古典密码的统计分析 1、密钥词组单表代替密码的统计分析 2、英语的统计规…

报表-集成

1、部署报表服务器 以centos为例 1.1 将服务拷贝到服务器 其中JDK-17是对应平台的jdk 1.2 修改lite-report下的source.config 1.3 把设计好的报表文件拷贝到lite-report/report 1.4 启动服务&#xff1a;sh run.sh restart 2、使用Nginx location /litereport/ { …

前端笔记-day1

文章目录 01-标签的写法02-HTML的基本骨架03-标签的关系04-注释05-标题标签06-段落标签07-换行与水平线标签08-文本格式化标签09-图像的基本使用10-图像的属性12-绝对路径13-超链接14-音频15-视频标签16-招聘案例18-个人简历19-vue简介 01-标签的写法 <strong>文字内容&…

LabVIEW开发MOOG控制系统数据处理软件

LabVIEW开发MOOG控制系统数据处理软件 在现代航空领域&#xff0c;飞机结构的静强度试验是保证飞机安全运行的关键环节。MOOG加载控制系统作为试验中的关键设备&#xff0c;其数据输出的直观性和易处理性对于提高试验效率具有重要意义。设计了一种基于LabVIEW的MOOG控制系统数…

##15 探索高级数据增强技术以提高模型泛化能力

文章目录 前言数据增强的重要性常见的数据增强技术高级数据增强技术在PyTorch中实现数据增强结论 前言 在深度学习领域&#xff0c;数据增强是一种有效的技术&#xff0c;它可以通过在原始数据上应用一系列变换来生成新的训练样本&#xff0c;从而增加数据的多样性&#xff0c…

Redis过期删除策略和内存淘汰策略有什么区别?

Redis过期删除策略和内存淘汰策略有什么区别&#xff1f; 前言过期删除策略如何设置过期时间&#xff1f;如何判定 key 已过期了&#xff1f;过期删除策略有哪些&#xff1f;Redis 过期删除策略是什么&#xff1f; 内存淘汰策略如何设置 Redis 最大运行内存&#xff1f;Redis 内…

ADS基础介绍篇1

一. ADS简介 常用的射频仿真软件有ADS和AWR&#xff0c;ADS(Advanced Design system)最传统&#xff0c;是Agilent公司于2008年推出的电磁场仿真器&#xff0c;可提供原理图设计和layout版图设计。仿真功能十分强大&#xff0c;可提供从无源到有源&#xff0c;从直流到交流&am…