注册
DMDSC简介以及详细部署过程
专栏/培训园地/ 文章详情 /

DMDSC简介以及详细部署过程

意林公主的侍卫 2024/10/09 477 0 0
摘要

1 DMDSC介绍

DM Data Shared Cluster
DM共享存储集群

DMDSC 集群是一个多实例、单数据库的系统。多个数据库实例可以同时访问、修改同一个数据库的数据。用户可以登录集群中的任意一个数据库实例,获得完整的数据库服务。
数据文件、控制文件在集群系统中只有一份,不论有几个节点,这些节点都平等地使用这些文件,这些文件保存在共享存储上。
每个节点有自己独立的联机日志和归档日志,联机日志和归档日志都需要保存在共享存储上。

DMDSC 集群主要由数据库和数据库实例、共享存储、DMASM 或 DMASM 镜像、本地存储、通信网络、集群控制软件 DMCSS、集群监视器 DMCSSM 组成

把数据库实例(运行在服务器上的、用来访问数据的进程和内存结构)与数据库(在存储设备上的实际数据的物理结构,也就是通常所说的数据文件)进行分离,从而使一个DMDSC数据库可以为多个实例提供访问服务

2 环境准备

准备两台安装了DM8的机器
至少4块共享磁盘
关闭防火墙或者开放对应端口
关闭SELINUX

如果是vmware虚拟机,可以创建4个虚拟磁盘

2.1 使用工具在自己电脑上创建4个虚拟磁盘作为共享磁盘

CMD中运行(路径根据自己实际情况修改):

"D:\Program Files (x86)\vmware\vmware-vdiskmanager.exe" -c -s 1G -a lslogic -t 2 "F:\iso\Sharedisk\sdb.vmdk"
"D:\Program Files (x86)\vmware\vmware-vdiskmanager.exe" -c -s 1G -a lslogic -t 2 "F:\iso\Sharedisk\sdc.vmdk"
"D:\Program Files (x86)\vmware\vmware-vdiskmanager.exe" -c -s 10G -a lslogic -t 2 "F:\iso\Sharedisk\sdd.vmdk"
"D:\Program Files (x86)\vmware\vmware-vdiskmanager.exe" -c -s 10G -a lslogic -t 2 "F:\iso\Sharedisk\sde.vmdk"

Pasted image 20240930143016.png
Pasted image 20240930143055.png

2.2 在两台机器上分别添加4个共享磁盘

在vmware中点击【编辑虚拟机设置】->【添加】->【硬盘】->【下一步】->【下一步】->【使用现有虚拟磁盘】->选择【sdb.vmdk】
在两台虚拟机上重复四次,分别添加sdb,sdc,sdd,sde

2.3 修改两台虚拟机的.vmx文件

在最后添加下面的内容:(两台都要)(盘号要对应)

scsi0:1.mode = "independent-persistent"
scsi0:1.SharedBus = "Virtual"
scsi0:2.mode = "independent-persistent"
scsi0:2.SharedBus = "Virtual"
scsi0:3.mode = "independent-persistent"
scsi0:3.SharedBus = "Virtual"
scsi0:4.mode = "independent-persistent"
scsi0:4.SharedBus = "Virtual"
disk.locking = "FALSE"
disk.EnableUUID = "TRUE"

现在打开两台虚拟机
看一下磁盘是否正常:

lsblk

Pasted image 20240730145232.png

查看存储scsi id(root用户)

for i in b c d e;
do
echo /dev/sd$i
/usr/lib/udev/scsi_id -g -u /dev/sd$i
done

Pasted image 20240930152411.png

2.4 udev绑定

两台机器依次执行,root用户

vi /etc/udev/rules.d/88-dm-asmdevices.rules

RESULT与之前查询的scsi id对应

KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29c77afe1902c5f45f06ddede40", SYMLINK+="ASMDISK/dmdcr",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2917485b3e04f2eca422edc3b26", SYMLINK+="ASMDISK/dmvote",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29ea7614719cb79e782367ffc1b", SYMLINK+="ASMDISK/dmredo",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c292f227aa2410c060588df96746", SYMLINK+="ASMDISK/dmdata",OWNER="dmdba", GROUP="dinstall",MODE="0660"

使规则生效:

udevadm trigger --type=devices --action=change

重启服务器,查看确认路径及权限 (A机器、B机器依次执行)

ls -l /dev/ASMDISK

Pasted image 20241004121243.png

3. IP和端口规划

端口号 用途
5236 数据库实例端口(DCR_EP_PORT)
5336 CSS节点 TCP 监听端口(DCR_EP_PORT)
5436 ASM节点 TCP 监听端口(DCR_EP_PORT)
5536 DCR检查端口(DCR_CHECK_PORT)
5636 ASM MAL 监听端口(MAL_PORT)
5736 DM MAL 监听端口(MAL_PORT)
22 SSH及SCP端口
A机器 B机器
业务IP 192.168.198.170 192.168.198.171
心跳IP 192.168.198.170 192.168.198.171
安装目录 /home/dmdba/dmdbms /home/dmdba/dmdbms
配置文件目录 /home/dmdba/dmdbms/config /home/dmdba/dmdbms/config
dmdcr_cfg:CSS DCR_EP_NAME DB0 DB1
DCR_EP_HOST 192.168.198.170 192.168.198.171
DCR_EP_PORT 5336 5336
dmdcr_cfg:ASM DCR_EP_NAME ASM0 ASM1
DCR_EP_HOST 192.168.198.170 192.168.198.171
DCR_EP_PORT 5436 5436
dmdcr_cfg:DB DCR_EP_NAME DB0 DB1
DCR_EP_PORT 5236 5236
DCR_CHECK_PORT 5536 5536
dmasvrmal MAL_INST_NAME ASM0 ASM1
MAL_HOST 192.168.198.170 192.168.198.171
MAL_PORT 5636 5636
dminit PORT_NUM 5236 5236
MAL_HOST 192.168.198.170 192.168.198.171
MAL_PORT 5736 5736
归档上限 102400 102400
OGUID 45331

4 磁盘规划

虚拟磁盘 符号连接 用途
sdb dmdcr 存放dcr信息
sdc dmvote 存放vote信息
sdd dmredo 存放redo log
sde dmdata 存放数据和归档

5 部署过程

5.1 配置dmdcr_cfg.ini

A机器、B机器配置相同,dmdba用户依次执行:

vim /home/dmdba/dmdbms/config/dmdcr_cfg.ini
DCR_N_GRP = 3 #集群环境有多少个GROUP,范围:1~16 DCR_VTD_PATH = /dev/ASMDISK/dmvote DCR_OGUID = 45331 [GRP] #新建一个GROUP DCR_GRP_TYPE = CSS #组类型(CSS/ASM/DB) DCR_GRP_NAME = GRP_CSS #组名 DCR_GRP_N_EP = 2 #组内节点个数 DCR_GRP_DSKCHK_CNT = 60 #磁盘心跳容错时间,单位:秒 [GRP_CSS] DCR_EP_NAME = CSS0 #CSS节点名 DCR_EP_HOST = 192.168.198.170 #心跳地址 DCR_EP_PORT = 5336 #CSS端口 [GRP_CSS] DCR_EP_NAME = CSS1 DCR_EP_HOST = 192.168.198.171 #心跳地址 DCR_EP_PORT = 5336 [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 #ASM节点名,和dmasvrmal的MAL_INST_NAME一致 DCR_EP_SHM_KEY = 93360 #共享内存标识 DCR_EP_SHM_SIZE = 10 #共享内存大小 DCR_EP_HOST = 192.168.198.170 #心跳地址 DCR_EP_PORT = 5436 #ASM端口 DCR_EP_ASM_LOAD_PATH = /dev/ASMDISK [GRP_ASM] DCR_EP_NAME = ASM1 DCR_EP_SHM_KEY = 93361 DCR_EP_SHM_SIZE = 10 DCR_EP_HOST = 192.168.198.171 #心跳地址 DCR_EP_PORT = 5436 DCR_EP_ASM_LOAD_PATH = /dev/ASMDISK [GRP] DCR_GRP_TYPE = DB DCR_GRP_NAME = GRP_DB DCR_GRP_N_EP = 2 DCR_GRP_DSKCHK_CNT = 60 [GRP_DB] DCR_EP_NAME = DB0 #实例名,和dm.ini的INSTANCE_NAME一致 DCR_EP_SEQNO = 0 #组内序号,不能重复 DCR_EP_PORT = 5236 #实例端口,和dm.ini的PORT_NUM一致 DCR_CHECK_PORT = 5536 #DCR检查端口 [GRP_DB] DCR_EP_NAME = DB1 DCR_EP_SEQNO = 1 DCR_EP_PORT = 5236 DCR_CHECK_PORT = 5536

5.2 初始化磁盘

任一机器,dmdba用户执行

vim /home/dmdba/dmdbms/config/asminit.txt
#asm script file
create dcrdisk '/dev/ASMDISK/dmdcr' 'DMDCR'
create votedisk '/dev/ASMDISK/dmvote' 'DMVOTE'
create asmdisk '/dev/ASMDISK/dmredo' 'DMREDO'
create asmdisk '/dev/ASMDISK/dmdata' 'DMDATA'
init dcrdisk '/dev/ASMDISK/dmdcr' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini' identified by 'admin123'
init votedisk '/dev/ASMDISK/dmvote' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini'
/home/dmdba/dmdbms/bin/dmasmcmd SCRIPT_FILE=/home/dmdba/dmdbms/config/asminit.txt

Pasted image 20241005123346.png

5.3配置dmasvrmal.ini

A机器、B机器配置相同,dmdba用户依次执行:

vim /home/dmdba/dmdbms/config/dmasvrmal.ini
[MAL_INST1] MAL_INST_NAME = ASM0 MAL_HOST = 192.168.198.170 #心跳地址 MAL_PORT = 5636 [MAL_INST2] MAL_INST_NAME = ASM1 MAL_HOST = 192.168.198.171 #心跳地址 MAL_PORT = 5636

5.4 配置dmdcr.ini

dmdba用户执行:
A机器:

vim /home/dmdba/dmdbms/config/dmdcr.ini
DMDCR_PATH = /dev/ASMDISK/dmdcr DMDCR_MAL_PATH = /home/dmdba/dmdbms/config/dmasvrmal.ini DMDCR_SEQNO = 0 DMDCR_ASM_TRACE_LEVEL = 2 DMDCR_AUTO_OPEN_CHECK = 90 #DMDCR_ASM_RESTART_INTERVAL = 30 #DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start #DMDCR_DB_RESTART_INTERVAL = 60 #DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmServiceDMS start
/home/dmdba/dmdbms/bin/dmserver path=/home/dmdba/dmdbms/config/db1_config/dm.ini  dcr_ini=/home/dmdba/dmdbms/config/dmdcr.ini

B机器:

vim /home/dmdba/dmdbms/config/dmdcr.ini
DMDCR_PATH = /dev/ASMDISK/dmdcr DMDCR_MAL_PATH = /home/dmdba/dmdbms/config/dmasvrmal.ini DMDCR_SEQNO = 1 DMDCR_AUTO_OPEN_CHECK = 90 DMDCR_ASM_TRACE_LEVEL = 2 #DMDCR_ASM_RESTART_INTERVAL = 30 #DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start #DMDCR_DB_RESTART_INTERVAL = 60 #DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmServiceDMS start

5.5 注册CSS、ASM服务

A机器, B机器均要执行,root用户

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -p CSS
/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -y DmCSSServiceCSS.service -p ASM

5.6 启动CSS、ASM服务

dmdba用户
A机器:

/home/dmdba/dmdbms/bin/DmCSSServiceCSS start

B机器:

/home/dmdba/dmdbms/bin/DmCSSServiceCSS start

A机器:

/home/dmdba/dmdbms/bin/DmASMSvrServiceASM start

B机器:

/home/dmdba/dmdbms/bin/DmASMSvrServiceASM start

5.7 创建DMASM磁盘组

任一机器,dmdba用户执行

/home/dmdba/dmdbms/bin/dmasmtool DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini
create diskgroup 'DM_REDO' asmdisk '/dev/ASMDISK/dmredo'
create diskgroup 'DM_DATA' asmdisk '/dev/ASMDISK/dmdata'

Pasted image 20241005124038.png

5.8 配置dminit.ini

任一机器,dmdba用户执行

vim /home/dmdba/dmdbms/config/dminit.ini
db_name = DSC system_path = +DM_DATA/DATA main = +DM_DATA/DATA/DSC/main.dbf main_size = 128 roll = +DM_DATA/DATA/DSC/roll.dbf roll_size = 128 system = +DM_DATA/DATA/DSC/system.dbf system_size = 128 ctl_path = +DM_DATA/DATA/DSC/dm.ctl ctl_size = 8 log_size = 1024 dcr_path = /dev/ASMDISK/dmdcr dcr_seqno = 0 auto_overwrite = 1 PAGE_SIZE = 32 EXTENT_SIZE = 32 CASE_SENSITIVE = Y CHARSET = 0 LENGTH_IN_CHAR = 0 BLANK_PAD_MODE = 1 [DB0] config_path = /home/dmdba/dmdbms/config/db0_config port_num = 5236 mal_host = 192.168.198.170 #心跳地址 mal_port = 5736 log_path = +DM_REDO/log/db0_log01.log log_path = +DM_REDO/log/db0_log02.log log_path = +DM_REDO/log/db0_log03.log log_path = +DM_REDO/log/db0_log04.log [DB1] config_path = /home/dmdba/dmdbms/config/db1_config port_num = 5236 mal_host = 192.168.198.171 #心跳地址 mal_port = 5736 log_path = +DM_REDO/log/db1_log01.log log_path = +DM_REDO/log/db1_log02.log log_path = +DM_REDO/log/db1_log03.log log_path = +DM_REDO/log/db1_log04.log

5.9 初始化实例

任一机器,dmdba用户执行

/home/dmdba/dmdbms/bin/dminit control=/home/dmdba/dmdbms/config/dminit.ini
scp -r /home/dmdba/dmdbms/config/db1_config/ @192.168.198.171:/home/dmdba/dmdbms/config

5.10 配置dmcssm.ini

A机器、B机器配置相同,dmdba用户执行:

vim /home/dmdba/dmdbms/config/dmcssm.ini
CSSM_OGUID = 45331 CSSM_CSS_IP = 192.168.198.170:5336 CSSM_CSS_IP = 192.168.198.171:5336 CSSM_LOG_PATH = /home/dmdba/dmdbms/log CSSM_LOG_FILE_SIZE = 256 CSSM_LOG_SPACE_LIMIT = 2048

5.11 配置dmarch.ini

A机器:

vim /home/dmdba/dmdbms/config/db0_config/dm.ini

修改ARCH_INI的值为1(默认值为0)

vim /home/dmdba/dmdbms/config/db0_config/dmarch.ini
[ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = +DM_DATA/DB0/arch ARCH_FILE_SIZE = 1024 ARCH_SPACE_LIMIT = 102400 [ARCHIVE_REMOTE1] ARCH_TYPE = REMOTE ARCH_DEST = DB1 ARCH_INCOMING_PATH = +DM_DATA/DB1/arch ARCH_FILE_SIZE = 1024

B机器:

vim /home/dmdba/dmdbms/config/db1_config/dm.ini

修改ARCH_INI的值为1

vim /home/dmdba/dmdbms/config/db1_config/dmarch.ini
[ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = +DM_DATA/DB1/arch ARCH_FILE_SIZE = 1024 ARCH_SPACE_LIMIT = 102400 [ARCHIVE_REMOTE1] ARCH_TYPE = REMOTE ARCH_DEST = DB0 ARCH_INCOMING_PATH = +DM_DATA/DB0/arch ARCH_FILE_SIZE = 1024

5.12 注册DMSERVER后台服务

root用户:
A机器:

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/dmdbms/config/db0_config/dm.ini -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -y DmASMSvrServiceASM.service -p DMS

B机器:

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/dmdbms/config/db1_config/dm.ini -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -y DmASMSvrServiceASM.service -p DMS

5.13 修改dmdcr.ini

dmdba用户

vim /home/dmdba/dmdbms/config/dmdcr.ini

反注释最后4行配置
重启两台机器

5.14 集群后台启停

停止顺序:A/B机器DMSERVER→A/B机器ASM→A/B机器CSS
打开CSSM

/home/dmdba/dmdbms/bin/dmcssm ini_path=/home/dmdba/dmdbms/config/dmcssm.ini

停止DMSERVER,输入:

ep stop GRP_DB

停止ASM,输入:

ep stop GRP_ASM

停止CSS (A/B机器操作):

/home/dmdba/dmdbms/bin/DmCSSServiceCSS stop

启动顺序:A/B机器CSS→A/B机器ASM→A/B机器DMSERVER
启动CSS (A/B机器操作):

/home/dmdba/dmdbms/bin/DmCSSServiceCSS start

启动ASM (A/B机器操作):

/home/dmdba/dmdbms/bin/DmASMSvrServiceASM start

启动DMSERVER (A/B机器操作):

/home/dmdba/dmdbms/bin/DmServiceDMS start

dmdcr.ini反注释后,CSS启动后30秒自动拉起ASM,60秒自动拉起DMSERVER

5.15 启动监视器

/home/dmdba/dmdbms/bin/dmcssm ini_path=/home/dmdba/dmdbms/config/dmcssm.ini

Pasted image 20241005131520.png

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服