解达梦数据库DPC集群的主要使用场景:
DMDPC 关注和解决的是大数据、计算与存储分离、高可用、支持全部的 SQL 标准、拥有完整的事务处理能力和集群规模能够动态伸缩的业务场景:
- 大量的复杂查询操作要求优化器能够生成优良的执行计划,并且执行引擎能够充分利用多机器、多核的硬件资源
- 某些行业对数据一致性和多副本备份容灾有较高要求,同时希望维护成本足够低和故障恢复时间足够短;
- 用户的业务规模有峰值,要求所需的机器资源能够灵活地添加和删除。
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
上一次登录: 日 4月 28 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 ROLLlog file path: /dmdata/dpc_data/mp/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/mp/DAMENG/DAMENG02.logwrite 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 infowill 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 ROLLlog file path: /dmdata/dpc_data/bp11/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/bp11/DAMENG/DAMENG02.logwrite 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 ROLLlog file path: /dmdata/dpc_data/bp12/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/bp12/DAMENG/DAMENG02.logwrite 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 ROLLlog file path: /dmdata/dpc_data/bp13/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/bp13/DAMENG/DAMENG02.logwrite 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 ROLLlog file path: /dmdata/dpc_data/bp21/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/bp21/DAMENG/DAMENG02.logwrite 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 ROLLlog file path: /dmdata/dpc_data/bp22/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/bp22/DAMENG/DAMENG02.logwrite 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 ROLLlog file path: /dmdata/dpc_data/bp23/DAMENG/DAMENG01.loglog file path: /dmdata/dpc_data/bp23/DAMENG/DAMENG02.logwrite 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 infowill 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 0NULL 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 NULLNULL NULL2 1 -1 BP RAFT_1 1 NULLNULL NULL3 2 -1 BP RAFT_2 1 NULLNULL NULL行号 RAFT_ID GROUP_ID DPC_MODE NAME IS_VALID INFO1
---------- ----------- ----------- -------- -------- ----------- -----------INFO2 INFO3 -------------------- ----------
4 3 -1 SP RAFT_SP1 1 NULLNULL 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 5237192.168.145.130 NORMAL 4 1 MP instance192.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 5238192.168.145.131 STANDBY 6 0 BP instance192.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 5239192.168.145.131 STANDBY 6 0 BP instance192.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 5240192.168.145.131 STANDBY 6 0 BP instance192.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 5241192.168.145.131 STANDBY 6 0 BP instance192.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 5242192.168.145.131 STANDBY 6 0 BP instance192.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 5243192.168.145.131 STANDBY 6 0 BP instance192.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 5236192.168.145.130 NORMAL 6 2 SP instance192.168.145.130 NULL NULL NULL8 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>