数据库运维
记录DBA学习成长历程

DM8-DSC-双节点搭建

文章目录
DMDSC集群是一个多实例、单数据库的系统。多个数据库实例可以同时访问、修改同一个数据库的数据。用户可以登录集群中的任意一个数据库实例,获得完整的数据库服务。
主机名称 IP地址 数据库软件安装目录 操作系统
localhost 10.0.0.200 /dm8 CentOS Linux release 7.5.1804 (Core)
localhost1 10.0.0.201 /dm8 CentOS Linux release 7.5.1804 (Core)

1、将磁盘分区并配置持久化(vmware添加共享盘在panminghe.com)

1节点执行分区,2节点不需执行。

1) 输入 fdisk /dev/sdb
2) 依次输入 n > p > 1 > 回车 > +500M > 回车,w保存 完成第一块磁盘划分
3) 依次输入 n > p > 2 > 回车 > +500M > 回车,w保存完成第二块磁盘划分
4) 依次输入 n > p > 3 > 回车 > +4000M > 回车,w保存完成第三块磁盘划分
5) 依次输入 n > p > 4 > 回车 > 回车 > 回车,w保存完成第四块磁盘划分

1、2节点都需配置持久化
6) 编辑/etc/udev/rules.d/98-kexec.rules(不同操作系统98-kexec.rules文件的文件名不同) 文件,增加以下语句:
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb4", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="raw[1-4]", OWNER="dmdba", GROUP="dinstall", MODE="660"

配置后使绑定生效

/sbin/udevadm trigger --type=devices --action=change
或者:
/sbin/udevadm control --reload

此时我遇见了一节点正常,二节点看不见分区的情况,我在2节点执行了fdisk /dev/sdb  ,然后w了一下,就可以了。

2、准备配置文件/home/dmdba/config

1、dmdcr_cfg.ini

dmdcr_cfg.ini是格式化DCR和Voting Disk的配置文件。配置信息包括三类:集群环境全局信息、集群组信息、以及组内节点信息。
写好后放到2节点同样的目录下一份

DCR_N_GRP = 3
DCR_VTD_PATH = /dev/raw/raw2
DCR_OGUID = 63635

[GRP]
DCR_GRP_TYPE = CSS
DCR_GRP_NAME = GRP_CSS
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_CSS]
DCR_EP_NAME = CSS0
DCR_EP_HOST = 10.0.0.200
DCR_EP_PORT = 9341
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 10.0.0.201
DCR_EP_PORT = 9343

[GRP]
DCR_GRP_TYPE = ASM
DCR_GRP_NAME = GRP_ASM
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_ASM]
DCR_EP_NAME = ASM0
DCR_EP_SHM_KEY = 93360
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.0.0.200
DCR_EP_PORT = 9349
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP_ASM]
DCR_EP_NAME = ASM1
DCR_EP_SHM_KEY = 93361
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.0.0.201
DCR_EP_PORT = 9351
DCR_EP_ASM_LOAD_PATH = /dev/raw

[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = TEST
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[TEST]
DCR_EP_NAME = TEST01
DCR_EP_SEQNO = 0
DCR_EP_PORT =5236
DCR_CHECK_PORT = 9741
[TEST]
DCR_EP_NAME = TEST02
DCR_EP_SEQNO = 1
DCR_EP_PORT =5236
DCR_CHECK_PORT = 9742

2、使用DMASMCMD工具初始化磁盘

create dcrdisk '/dev/raw/raw1' 'dcr'
create votedisk '/dev/raw/raw2' 'vote'
create asmdisk '/dev/raw/raw3' 'LOG0'
create asmdisk '/dev/raw/raw4' 'DATA0'
init dcrdisk '/dev/raw/raw1' from '/home/dmdba/config/dmdcr_cfg.ini' identified by 'abcd'
init votedisk '/dev/raw/raw2' from '/home/dmdba/config/dmdcr_cfg.ini'
[dmdba@loaclhost bin]$ ./dmasmcmd 
DMASMCMD V8

ASM>create dcrdisk '/dev/raw/raw1' 'dcr'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr
Used time: 63.772(ms).
ASM>create votedisk '/dev/raw/raw2' 'vote'
[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote
Used time: 98.402(ms).
ASM>create asmdisk '/dev/raw/raw3' 'LOG0'
[Trace]The ASM initialize asmdisk /dev/raw/raw3 to name DMASMLOG0
Used time: 94.945(ms).
ASM>create asmdisk '/dev/raw/raw4' 'DATA0'
[Trace]The ASM initialize asmdisk /dev/raw/raw4 to name DMASMDATA0
Used time: 116.293(ms).

ASM>init dcrdisk '/dev/raw/raw1' from '/home/dmdba/config/dmdcr_cfg.ini' identified by 'abcd'
[Trace]DG 126 allocate 4 extents for file 0xfe000002.
Used time: 418.045(ms).
ASM>init votedisk '/dev/raw/raw2' from '/home/dmdba/config/dmdcr_cfg.ini'
[Trace]DG 125 allocate 4 extents for file 0xfd000002.
Used time: 60.500(ms).

3、DMASM 的 MAL 配置文件

dmasvermal.ini是MAL配置文件。使用同一套MAL系统的所有实例,MAL系统配置文件要严格保持一致。

vi dmasvrmal.ini

[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 10.0.0.200
MAL_PORT = 7236
[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 10.0.0.201
MAL_PORT = 7237

4、准备 dmdcr.ini 配置文件,注意节点1、2有区别

dmdcr.ini是dmcss、dmasmsvr、dmasmtool等工具的输入参数。记录了当前节点序列号以及DCR磁盘路径。
注意DMDCR_SEQNO不能相同
1节点
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/home/dmdba/config/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /dm8/bin/dmasmsvr dcr_ini=/home/dmdba/config/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/home/dmdba/config/rac0_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini

2节点
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/home/dmdba/config/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 1
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /dm8/bin/dmasmsvr dcr_ini=/home/dmdba/config/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/home/dmdba/config/rac0_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini

 

5、启动 DMCSS、DMASM 服务程序在这两个点的数据库安装目录bin下先后分别启动 dmcss、dmasmsvr程序

1节点启动css

1节点启动asmsvr

2节点启动css

2节点启动dmasmsvr

6、使用 dmasmtool 工具创建 DMASM 磁盘组

使用1节点启动 dmasmtool 工具

./dmasmtool DCR_INI=/home/data/dmdcr.ini
输入下列语句创建 DMASM 磁盘组:
#创建日志磁盘组
create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
#创建数据磁盘组
create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
[dmdba@loaclhost bin]$ ./dmasmtool DCR_INI=/home/dmdba/config/dmdcr.ini
DMASMTOOL V8
ASM>create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
Used time: 26.038(ms).
ASM>create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
Used time: 22.093(ms).
ASM>

7、准备 dminit.ini 配置文件,在1节点配置即可

db_name = TEST
system_path = +DMDATA/data
system = +DMDATA/data/dsc/system.dbf
system_size = 128
roll = +DMDATA/data/dsc/roll.dbf
roll_size = 128
main = +DMDATA/data/dsc/main.dbf
main_size = 128
ctl_path = +DMDATA/data/dsc/fk.ctl
ctl_size = 8
log_size = 256
dcr_path = /dev/raw/raw1
dcr_seqno = 0
auto_overwrite = 1
[TEST01] 
config_path = /home/dmdba/config/rac0_config
port_num = 5236
mal_host = 10.0.0.200 
mal_port = 9340
log_path = +DMLOG/log/ht1_log01.log 
log_path = +DMLOG/log/ht1_log02.log
[TEST02]
config_path = /home/dmdba/config/rac1_config
port_num = 5236
mal_host = 10.0.0.201 
mal_port = 9341
log_path = +DMLOG/log/ht2_log01.log 
log_path = +DMLOG/log/ht2_log02.log

8、使用dminit.ini初始化DB

此步在1节点操作即可执行成功后会在/dm8/dmdba/config下生成两个目录(/dm8/dmdba/config/rac0_config 和/dm8/dmdba/config/rac1_config),这两个目录下会自动生成配置文件 dm.ini 和 dmmal.ini。

[dmdba@loaclhost bin]$ ./dminit control=/home/dmdba/config/dminit.ini
initdb V8
db version: 0x7000b
file dm.key not found, use default license!
License will expire on 2021-12-14

log file path: +DMLOG/log/ht1_log01.log

log file path: +DMLOG/log/ht1_log02.log

log file path: +DMLOG/log/ht2_log01.log

log file path: +DMLOG/log/ht2_log02.log

write to dir [+DMDATA/data/TEST].
create dm database success. 2021-11-30 14:26:00

9、启动数据库服务器

将 1节点/dm8/dmdba/config/rac1_config 目录拷贝到 2节点相同目录下,再分别启动 dmserver 即可完成 DMDSC 集群搭建。

如果 DMCSS 配置有自动拉起 dmserver 的功能,可以等待 DMCSS 自动拉起实例,不需要手动启动。如果需要手动启动,可参考下面的操作步骤:

1节点:
./dmserver /dm8/dmdba/config/rac0_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini
2节点:
./dmserver /dm8/dmdba/config/rac1_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini

10、配置监视器

[dmdba@loaclhost bin]$ cat /home/dmdba/config/dmcssm.ini
CSSM_OGUID = 63635 
CSSM_CSS_IP = 10.0.0.200:9341
CSSM_CSS_IP = 10.0.0.201:9343
CSSM_LOG_PATH = /home/dmdba/config/dmcssm_log
CSSM_LOG_FILE_SIZE = 32 
CSSM_LOG_SPACE_LIMIT = 0
[dmdba@loaclhost bin]$ ./dmcssm INI_PATH=/home/dmdba/config/dmcssm.ini
[monitor] 2021-11-30 14:48:33: CSS MONITOR V8
[monitor] 2021-11-30 14:48:33: CSS MONITOR SYSTEM IS READY.

[monitor] 2021-11-30 14:48:33: Wait CSS Control Node choosed...
show
[monitor] 2021-11-30 14:48:34: Wait CSS Control Node choosed succeed.


monitor current time:2021-11-30 14:48:34, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS0] global info:
[ASM0] auto restart = FALSE
[TEST01] auto restart = FALSE

[CSS1] global info:
[ASM1] auto restart = FALSE
[TEST02] auto restart = FALSE


ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts 
2021-11-30 14:48:34 CSS0 0 9341 Control Node OPEN WORKING OK TRUE 540530851 540534069 
2021-11-30 14:48:34 CSS1 1 9343 Normal Node OPEN WORKING OK TRUE 540560283 540563402

=================== group[name = GRP_ASM, seq = 1, type = ASM, Control Node = 0] ========================================

n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)

sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL

crash process over flag is TRUE
ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts 
2021-11-30 14:48:34 ASM0 0 9349 Control Node OPEN WORKING OK TRUE 540548085 540551244 
2021-11-30 14:48:34 ASM1 1 9351 Normal Node OPEN WORKING OK TRUE 540563847 540566953

=================== group[name = TEST, seq = 2, type = DB, Control Node = 0] ========================================

n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)

sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL

crash process over flag is TRUE
ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts 
2021-11-30 14:48:34 TEST01 0 5236 Control Node OPEN WORKING OK TRUE 1720093725 1720094585 
2021-11-30 14:48:34 TEST02 1 5236 Normal Node OPEN WORKING OK TRUE 1720122140 1720122971

==================================================================================================================

11、注册服务,开机自启

因为启动有顺序要求,所以asmsvr和server加-y参数,就是依赖服务的意思

1节点
./dm_service_installer.sh -t dmcss -p _TEST0 -dcr_ini /home/dmdba/config/dmdcr.ini
./dm_service_installer.sh -t dmasmsvr -p _TEST0 -dcr_ini /home/dmdba/config/dmdcr.ini -y DmCSSService_TEST0.service
./dm_service_installer.sh -t dmserver -p _TEST0 -dm_ini /home/dmdba/config/rac0_config/dm.ini -dcr_ini /home/dmdba/config/dmdcr.ini -y DmASMSvrService_TEST0.service
2节点
./dm_service_installer.sh -t dmcss -p _TEST1 -dcr_ini /home/dmdba/config/dmdcr.ini
./dm_service_installer.sh -t dmasmsvr -p _TEST1 -dcr_ini /home/dmdba/config/dmdcr.ini -y DmCSSService_TEST1.service
./dm_service_installer.sh -t dmserver -p _TEST1 -dm_ini /home/dmdba/config/rac1_config/dm.ini -dcr_ini /home/dmdba/config/dmdcr.ini -y DmASMSvrService_TEST1.service

开启自启:
systemctl enable DmCSSService_TEST0.service
systemctl enable DmASMSvrService_TEST0.service
systemctl enable DmService_TEST0.service
赞(1)
MySQL学习笔记 » DM8-DSC-双节点搭建