userdel -r dmdba
groupadd dinstall -g 2001
useradd -g dinstall -m -d /home/dmdba -s /bin/bash -u 2001 dmdba
echo dmdba| passwd --stdin dmdba
mkdir -p /dbbak/dmbak /dbarch/dmarch
mkdir /home/dmdba/core
chown -R dmdba:dinstall /dbbak/dmbak /dbarch/dmarch
chmod -R 755 /dbbak/dmbak /dbarch/dmarch
通过以下命令可获取多路径。即搭建需要采用的 lun,其多路径名称依次为:/dev/mapper/mpatha
[root@RS1824 ~]# fdisk -l |grep mpath
通过多路径 UUID 绑定。通过 mpath.sh 生成配置文件 88-dm-asmdevices.rules。
[root@RS1824 ~]# cat mpath.sh
curr=$(cd "$(dirname "$0")";pwd)
rm -f $curr/88-dm-asmdevices.rules
for i in mpatha mpathb mpathc mpathd mpathe;
do
str1="$i:`udevadm info --query=all --name=/dev/mapper/$i | grep DM_UUID`"
str2=${str1#*=}
echo "KERNEL==\"dm-*\",ENV{DM_UUID}==\"${str2}\",SYMLINK+=\"dm/asm-${i}\",OWNER=\"dmdba\",GROUP=\"dinstall\",MODE=\"0660\"" ''
done
##执行上述脚本
[root@RS1824 ~]# ./mpath.sh
##脚本执行成功后,会生成绑定配置文件,可以根据需求进行修改别名 SYMLINK,例如:
[root@RS1824 ~]# cat 88-dm-asmdevices.rules
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600b342697bdcefdae7fd52cfd1b00db",SYMLINK+="dm/asm-dmdcr",OWNER="dmdba",GROUP="dinstall",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600b342449774d0d2c16d990fd6300db",SYMLINK+="dm/asm-dmvote",OWNER="dmdba",GROUP="dinstall",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600b342a2b1bd08d28e0d58c5db300db",SYMLINK+="dm/asm-dmlog",OWNER="dmdba",GROUP="dinstall",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600b34208f0b5c5d515dd41dfde300db",SYMLINK+="dm/asm-dmdata",OWNER="dmdba",GROUP="dinstall",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600b342dfa7bea6dc4c4dec06da300db",SYMLINK+="dm/asm-dmarch",OWNER="dmdba",GROUP="dinstall",MODE="0660"
部署配置文件。复制 88-dm-asmdevices.rules 配置文件到 DSC 集群的所有节点的相关目录下。
cp 88-dm-asmdevices.rules /etc/udev/rules.d/88-dm-asmdevices.rules
检查生效。
(1)重启服务器,建议使用该方法。
(2)如果无法重启,执行下述命令。
udevadm trigger --type=devices --action=change
udevadm control --reload-rules
(3)授权。
chown dmdba:dinstall /dev/mapper/mpath* -R
chown dmdba:dinstall /dev/dm/asm-* -R
(4)检查生效。
blockdev --getsize64 /dev/dm/asm-dmdcr
blockdev --getsize64 /dev/dm/asm-dmvote
blockdev --getsize64 /dev/dm/asm-dmlog
blockdev --getsize64 /dev/dm/asm-dmdata
blockdev --getsize64 /dev/dm/asm-dmarch
共享存储集群部署前应进行完整的环境检查,详细内容可参考环境检查与修改。在 DSC 集群中应特别注意以下内容:
检查共享存储设备绑定情况。如果使用了多路径软件,可对比 2 台服务器的多路径信息,重点确认 2 台服务器绑定的设备 uuid 是否一致,并检查绑定是否生效。
##检查设备 uuid 是否一致
multipath -ll
##检查绑定是否生效
blockdev --getsize64 /dev/dm/asm-dmvote
blockdev --getsize64 /dev/dm/asm-dmdcr
blockdev --getsize64 /dev/dm/asm-dmlog
blockdev --getsize64 /dev/dm/asm-dmarch
blockdev --getsize64 /dev/dm/asm-dmdata
需进行共享磁盘测速。在部署 DSC 之前,将划分的磁盘挂载到本地,然后采用 dd / fio 方式进行磁盘 IO 测试。生产环境中,建议共享磁盘读写速度不低于 150M/s。Fio 测试方法如下:
##测试方法和脚本,以下三个命令分别测试随机写,随机读,随机读写:
f=/data2/1.g
fio -direct=1 -iodepth=128 -rw=randwrite -ioengine=libaio -bs=8k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=$f -name=Rand_Write_Testing --output fio.log
fio -direct=1 -iodepth=128 -rw=randread -ioengine=libaio -bs=8k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=$f -name=Rand_Read_Testing >> fio.log
fio -direct=1 -iodepth=128 -rw=randrw -rwmixread=70 -ioengine=libaio -bs=8k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=$f -name=Mix_Read_Testing >> fio.log
略
2个节点新建目录/home/dmdba/dmdbms/dsc_config,配置dmdcr_cfg.ini文件
DCR_N_GRP = 3 ##集群环境有多少个 GROUP,范围:1~16
DCR_VTD_PATH = /dev/dm/asm-dmvote ##规划为 vote 的磁盘
DCR_OGUID = 210715 ## 消息标识,一个组里面只有一个。
[GRP] #新建一个 GROUP
DCR_GRP_TYPE = CSS ##组类型(CSS/ASM/DB)
DCR_GRP_NAME = GRP_CSS ##组名
DCR_GRP_N_EP = 2 ##组内节点个数
DCR_GRP_DSKCHK_CNT = 65 ##磁盘心跳容错时间,单位:秒
[GRP_CSS]
DCR_EP_NAME = CSS0 ##CSS 节点名
DCR_EP_HOST = 192.168.85.130 ##心跳地址
DCR_EP_PORT = 11286 ##CSS 端口
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 192.168.85.131
DCR_EP_PORT = 11286
[GRP]
DCR_GRP_TYPE = ASM
DCR_GRP_NAME = GRP_ASM
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 61
[GRP_ASM]
DCR_EP_NAME = ASM0 ##ASM 节点名,和 dmasvrmal 的 MAL_INST_NAME 一致
DCR_EP_SHM_KEY = 42424 ##共享内存标识
DCR_EP_SHM_SIZE = 1024 ##共享内存大小
DCR_EP_HOST = 192.168.85.130 ##心跳地址
DCR_EP_PORT = 11276 ##ASM 端口
DCR_EP_ASM_LOAD_PATH = /dev/dm
[GRP_ASM]
DCR_EP_NAME = ASM1
DCR_EP_SHM_KEY = 42425
DCR_EP_SHM_SIZE = 1024
DCR_EP_HOST = 192.168.85.131
DCR_EP_PORT = 11276
DCR_EP_ASM_LOAD_PATH = /dev/dm
[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = GRP_DSC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 57
[GRP_DSC]
DCR_EP_NAME = DSC0 ##实例名,和 dm.ini 的 INSTANCE_NAME 一致
DCR_EP_SEQNO = 0 ##组内序号,不能重复
DCR_EP_PORT = 5236 ##实例端口,和 dm.ini 的 PORT_NUM 一致
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
在节点1执行
[dmdba@node1 ~]$ /home/dmdba/dmdbms/bin/dmasmcmd
create dcrdisk '/dev/dm/asm-dmdcr' 'dcr'
create votedisk '/dev/dm/asm-dmvote' 'vote'
init dcrdisk '/dev/dm/asm-dmdcr' from '/home/dmdba/dmdbms/dsc_config/dmdcr_cfg.ini' identified by 'damengdba'
init votedisk '/dev/dm/asm-dmvote' from '/home/dmdba/dmdbms/dsc_config/dmdcr_cfg.ini'
create asmdisk '/dev/dm/asm-dmdata' 'DATA0'
create asmdisk '/dev/dm/asm-dmlog' 'LOG0'
create asmdisk '/dev/dm/asm-dmarch' 'ARCH0'
2.7. 配置dmasvrmal.ini
2个节点配置dmasvrmal.ini文件
[dmdba@node1 ~]$ vi /home/dmdba/dmdbms/dsc_config/dmasvrmal.ini
[[MAL_INST0]
MAL_INST_NAME = ASM0
MAL_HOST = 192.168.85.130 #心跳地址
MAL_PORT = 11266 #MAL 监听端口
[MAL_INST1]
MAL_INST_NAME = ASM1
MAL_HOST = 192.168.85.131
MAL_PORT = 11266
2.6. 配置dmdcr.ini
节点1的DMDCR_SEQNO为0
[dmdba@node1 ~]$ vi /home/dmdba/dmdbms/dsc_config/dmdcr.ini
DMDCR_PATH = /dev/dm/asm-dmdcr
DMDCR_MAL_PATH = /home/dmdba/dmdbms/dsc_config/dmasvrmal.ini
DMDCR_SEQNO = 0
DMDCR_AUTO_OPEN_CHECK = 111
DMDCR_ASM_TRACE_LEVEL = 2
##DMDCR_ASM_RESTART_INTERVAL = 60
##DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
##DMDCR_DB_RESTART_INTERVAL = 60
##DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmServiceDSC start
节点2的DMDCR_SEQNO为1
[dmdba@node2 ~]$ vi /home/dmdba/dmdbms/dsc_config/dmdcr.ini
DMDCR_PATH = /dev/dm/asm-dmdcr
DMDCR_MAL_PATH = /home/dmdba/dmdbms/dsc_config/dmasvrmal.ini
DMDCR_SEQNO = 1
DMDCR_AUTO_OPEN_CHECK = 111
DMDCR_ASM_TRACE_LEVEL = 2
##DMDCR_ASM_RESTART_INTERVAL = 60
##DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
##DMDCR_DB_RESTART_INTERVAL = 60
##DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmServiceDSC start
注意
当前为手动拉起 db0 机器和 db1 机器的 ASM 和 DMSERVER 服务。待集群配置完成后,再修改为自动拉起(删除 dmdcr.ini 中的“##”号即可)。在实际项目中集群出现异常时需排查诱因,故在生产环境上一般不建议配置自动拉起。
节点1
[dmdba@rac01 dsc_config]$ more dmarch.ini
ARCH_WAIT_APPLY = 0
ARCH_LOCAL_SHARE = 1
ARCH_LOCAL_SHARE_CHECK = 0
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = +DMARCH/ARCH/DSC0/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 204800
ARCH_FLUSH_BUF_SIZE = 32
[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC1
ARCH_INCOMING_PATH = +DMARCH/ARCH/DSC1/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 204800
ARCH_FLUSH_BUF_SIZE = 32
[ARCHIVE_LOCAL2]
ARCH_TYPE = LOCAL
ARCH_DEST = /dbarch/dmarch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 409600
ARCH_FLUSH_BUF_SIZE = 32
节点2
ARCH_WAIT_APPLY = 0
ARCH_LOCAL_SHARE = 1
ARCH_LOCAL_SHARE_CHECK = 0
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = +DMARCH/ARCH/DSC1/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 204800
ARCH_FLUSH_BUF_SIZE = 32
[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC0
ARCH_INCOMING_PATH = +DMARCH/ARCH/DSC0/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 204800
ARCH_FLUSH_BUF_SIZE = 32
[ARCHIVE_LOCAL2]
ARCH_TYPE = LOCAL
ARCH_DEST = /dbarch/dmarch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 409600
ARCH_FLUSH_BUF_SIZE = 32
在 2 个节点分别启动 dmcss 命令:
[dmdba@node1 ~]$ /home/dmdba/dmdbms/bin/dmcss DCR_INI=/home/dmdba/dmdbms/dsc_config/dmdcr.ini
[dmdba@node2 ~]$ /home/dmdba/dmdbms/bin/dmcss DCR_INI=/home/dmdba/dmdbms/dsc_config/dmdcr.ini
在 2 个节点分别启动 dmasmsvr 命令:
[dmdba@node1 ~]# /home/dmdba/dmdbms/bin/dmasmsvr DCR_INI=/home/dmdba/dmdbms/dsc_config/dmdcr.ini
[dmdba@node2 ~]# /home/dmdba/dmdbms/bin/dmasmsvr DCR_INI=/home/dmdba/dmdbms/dsc_config/dmdcr.ini
这四个窗口都不能关闭
在节点1启动 dmasmtool 工具
[dmdba@node1 ~]$ /home/dmdba/dmdbms/bin/dmasmtool DCR_INI=/home/dmdba/dmdbms/dsc_config/dmdcr.ini
ASM>create diskgroup 'DMLOG' asmdisk '/dev/dm/asm-dmlog'
ASM>create diskgroup 'DMDATA' asmdisk '/dev/dm/asm-dmdata'
ASM>create diskgroup 'DMARCH' asmdisk '/dev/dm/asm-dmarch'
在节点1上创建dminit.ini文件
[dmdba@node1 ~]$ vi /dm/dmdbms/dsc_config/dminit.ini
DB_NAME = DSC
##SYSDBA_PWD 和 SYSAUDITOR_PWD 为配置数据库 SYSDBA 用户和 SYSAUDITOR 用户的登录密码,需要用户自定义配置,且需保证一定的密码强度。详细参数解释可参考达梦数据库安装目录下 doc 目录中《DM8_dm
init 使用手册》
SYSDBA_PWD = damengdba
SYSAUDITOR_PWD = damengdba
SYSTEM_PATH = +DMDATA/data
SYSTEM = +DMDATA/data/SYSTEM.dbf
SYSTEM_SIZE = 1024
ROLL = +DMDATA/data/ROLL.dbf
ROLL_SIZE = 1024
MAIN = +DMDATA/data/MAIN.dbf
MAIN_SIZE = 1024
CTL_PATH = +DMDATA/data/dm.ctl
CTL_SIZE = 8
LOG_SIZE = 1024
DCR_PATH = /dev/dm/asm-dmdcr
DCR_SEQNO = 0
AUTO_OVERWRITE = 1
PAGE_SIZE = 32
EXTENT_SIZE = 16
BLANK_PAD_MODE = 1
[DSC0]
CONFIG_PATH = /home/dmdba/dmdbms/dsc_config/DSC0
PORT_NUM = 5236
MAL_HOST = 192.168.85.130
MAL_PORT = 11246
LOG_PATH = +DMLOG/DSC0_LOG01.log
LOG_PATH = +DMLOG/DSC0_LOG02.log
[DSC1]
CONFIG_PATH = /home/dmdba/dmdbms/dsc_config/DSC1
PORT_NUM = 5236
MAL_HOST = 192.168.85.131
MAL_PORT = 11246
LOG_PATH = +DMLOG/DSC1_LOG01.log
LOG_PATH = +DMLOG/DSC1_LOG02.log
在当前节点执行
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-07-03
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: +DMLOG/DSC0_LOG01.log
log file path: +DMLOG/DSC0_LOG02.log
log file path: +DMLOG/DSC1_LOG01.log
log file path: +DMLOG/DSC1_LOG02.log
write to dir [+DMDATA/data/DSC].
create dm database success. 2024-08-12 18:06:47
##拷贝文件到 db1 节点
[dmdba@~]# scp -r /home/dmdba/dmdbms/dsc_config/DSC1 dmdba@192.168.182.130:/home/dmdba/dmdbms/dsc_config/
如果 DMCSS 配置有自动拉起 dmserver 的功能,可以等待 DMCSS 自动拉起实例,不需要手动启动。如果需要手动启动,可参考以下步骤:
##db0 机器
[dmdba@]# /home/dmdba/dmdbms/bin/dmserver /home/dmdba/dmdbms/dsc_config/DSC0/dm.ini dcr_ini=/home/dmdba/dmdbms/dsc_config/DSC0/dmdcr.ini
##db1 机器
[dmdba@~]# /home/dmdba/dmdbms/bin/dmserver /dm/dmdbms/dsc_config/DSC1/dm.ini dcr_ini=/home/dmdba/dmdbms/dsc_config/DSC1/dmdcr.ini
注册 CSS、ASM、DMSERVER 后台服务
##db0 机器
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /home/dmdba/dmdbms/dsc_config/dmdcr.ini -p CSS
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /home/dmdba/dmdbms/dsc_config/dmdcr.ini -y DmCSSServiceCSS.service -p ASM
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/dmdbms/dsc_config/DSC0/dm.ini -dcr_ini /home/dmdba/dmdbms/dsc_config/dmdcr.ini -y DmASMSvrServiceASM.service -p DSC
##db1 机器
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /home/dmdba/dmdbms/dsc_config/dmdcr.ini -p CSS
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /home/dmdba/dmdbms/dsc_config/dmdcr.ini -y DmCSSServiceCSS.service -p ASM
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/dmdbms/dsc_config/DSC1/dm.ini -dcr_ini /home/dmdba/dmdbms/dsc_config/dmdcr.ini -y DmASMSvrServiceASM.service -p DSC
备注:db0 机器、db1 机器删除自启可参考以下命令。
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_uninstaller.sh -n DmCSSServiceCSS
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_uninstaller.sh -n DmASMSvrServiceASM
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_uninstaller.sh -n DmServiceDSC
创建 dmcssm.ini
A 机器、B 机器配置相同
[dmdba@~]# vi /home/dmdba/dmdbms/bin/dmcssm.ini
CSSM_OGUID = 210715
CSSM_CSS_IP = 192.168.85.130:11286
CSSM_CSS_IP = 192.168.85.131:11286
CSSM_LOG_PATH = …/log
CSSM_LOG_FILE_SIZE = 512
CSSM_LOG_SPACE_LIMIT = 2048
注册服务(选做)
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcssm -cssm_ini /home/dmdba/dmdbms/bin/dmcssm.ini -p Monitor
##备注:删除自启
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_uninstaller.sh -n DmCSSMonitorServiceMonitor
2个节点的/home/dmdba/dmdbms/dsc_config/dmdcr.ini配置文件都要取消注释
[dmdba@node1 ~]$ vi /home/dmdba/dmdbms/dsc_config/dmdcr.ini
说明:CSS 启动后 30 秒自动拉起 ASM,60 秒自动拉起 DMSERVER。
[root@node1 ~]# systemctl start DmCSSServiceCSS
[root@node2 ~]# systemctl start DmCSSServiceCSS
[root@localhost ~]# systemctl start DmCSSMonitorServiceCSSM
请按顺序停止,在返回[ OK ]之后执行下一条命令
也可以通过监视器停止
[root@node1 ~]# /home/dmdba/dmdbms/bin/DmServiceDSC stop
[root@node2 ~]# /home/dmdba/dmdbms/bin/DmServiceDSC stop
[root@node1 ~]# /home/dmdba/dmdbms/bin/DmASMSvrServiceASM stop
[root@node2 ~]# /home/dmdba/dmdbms/bin/DmASMSvrServiceASM stop
[root@node1 ~]# systemctl stop DmCSSServiceCSS
[root@node2 ~]# systemctl stop DmCSSServiceCSS
os_asm_env_init error.CODE:-11041,DESC:ASM连接异常
由于DSC集群的数据文件和REDO日志是存放在DMASM文件系统中的,所以初始化实例的时候需要访问dmasm服务,该报错一般是因为dmasmsvr服务没有启动,若dmasm服务启动正常,则检查dminit中配置的dcr_path是否正确。
execute open ASM file fail, code: [-2405]
解决方案
无影响,忽略。
536870912000
[root@RS1824 ~]# blockdev --getsize64 /dev/dm/asm-dmarch
536870912000
文章
阅读量
获赞