序号 | 端口号 | 用途 |
---|---|---|
1 | 5236 | 数据库实例端口(DCR_EP_PORT) |
2 | 5336 | CSS节点 TCP 监听端口(DCR_EP_PORT) |
3 | 5436 | ASM节点 TCP 监听端口(DCR_EP_PORT) |
4 | 5536 | DCR检查端口(DCR_CHECK_PORT) |
5 | 5636 | ASM MAL 监听端口(MAL_PORT) |
6 | 5736 | DM MAL 监听端口(MAL_PORT) |
7 | 22 | SSH及SCP端口 |
配置项 | A机器 | B机器 |
---|---|---|
业务IP | 10.127.17.115 | 10.127.17.114 |
心跳IP | 10.127.17.115 | 10.127.17.114 |
dmdcr_cfg | ||
CSS | ||
- DCR_EP_NAME | DSC0 | DSC1 |
- DCR_EP_HOST | 10.127.17.115 | 10.127.17.114 |
- DCR_EP_PORT | 5336 | 5336 |
ASM | ||
- DCR_EP_NAME | ASM0 | ASM1 |
- DCR_EP_HOST | 10.127.17.115 | 10.127.17.114 |
- DCR_EP_PORT | 5436 | 5436 |
DB | ||
- DCR_EP_NAME | DSC0 | DSC1 |
- DCR_EP_PORT | 5236 | 5236 |
- DCR_CHECK_PORT | 5536 | 5536 |
dmasvrmal | ||
- MAL_INST_NAME | ASM0 | ASM1 |
- MAL_HOST | 10.127.17.115 | 10.127.17.114 |
- MAL_PORT | 5636 | 5636 |
dminit | ||
- PORT_NUM | 5236 | 5236 |
- MAL_HOST | 10.127.17.115 | 10.127.17.114 |
- MAL_PORT | 5736 | 5736 |
归档上限 | 10240 | 10240 |
OGUID | 250715 | 250715 |
磁盘 | 容量 | 用途 | 目标软链接名称 |
---|---|---|---|
sdc | 5G | DCR 盘 | dmdcr |
sdd | 5G | VOTE 盘 | dmvote |
sde | 8G | REDO 日志盘 | dmredo |
sdf | 10G | 数据盘 | dmdata1 |
sdg | 10G | 数据盘 | dmdata2 |
DSC1服务器一共创建四个磁盘,大小分别为5G(DCR),5G(VOTE),8G(RLOG),10G(DATA)。操作如下: 关闭虚拟机–>编辑虚拟机设置–>添加–>硬盘–>SCSI–>创建新的虚拟磁盘–>5G-立即分配-存储为单个文件–>选择存放位置以及改名–>完成。
DSC2服务器需要基于DSC1服务器创建的四个磁盘进行添加,操作如下: 关闭虚拟机–>编辑虚拟机设置–>添加–>硬盘–>SCSI–>使用现有的虚拟磁盘–>浏览选择磁盘–>完成。
A机器、B机器配置相同,依次执行
使用 lsblk 命令查看所有挂载的块设备,确认2台服务器的磁盘挂载是否一致
10.127.17.115
10.127.17.114
记录用于部署数据库的盘符,例如上图中,sd [c、d、e、f、g] 是用于部署数据库使用
结合提供的磁盘列表(sdc-sdg,共 5 块磁盘),优化后的 uuid.sh 脚本如下,专门针对这些磁盘生成 udev 规则,确保适配达梦共享存储需求:
#!/bin/bash
# 功能:自动生成指定名称的 udev 规则,替换原有软链接
# 对应关系:sdc->dmdcr, sdd->dmvote, sde->dmredo, sdf->dmdata, sdg->dmdata_bak
# 脚本所在目录
curr=$(cd "$(dirname "$0")"; pwd)
# 规则文件名
rules_file="$curr/99-dm-asmdevices.rules"
# 清理旧规则
rm -f "$rules_file"
# 定义磁盘与目标名称的对应关系(数组顺序:sdc, sdd, sde, sdf, sdg)
disk_suffixes=("c" "d" "e" "f" "g")
target_names=("dmdcr" "dmvote" "dmredo" "dmdata1" "dmdata2")
# 遍历生成规则
for i in "${!disk_suffixes[@]}"; do
suffix=${disk_suffixes[$i]}
name=${target_names[$i]}
disk="/dev/sd$suffix"
# 检查磁盘是否存在
if [ ! -b "$disk" ]; then
echo "警告:磁盘 $disk 不存在,已跳过"
continue
fi
# 获取 scsi_id
scsi_id=$(/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device="$disk" 2>/dev/null)
if [ -z "$scsi_id" ]; then
echo "错误:无法获取 $disk 的 scsi_id,已跳过"
continue
fi
# 写入规则(指定目标名称)
cat <<EOF >> "$rules_file"
KERNEL=="sd$suffix", SUBSYSTEM=="block", \
PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name", \
RESULT=="$scsi_id", \
SYMLINK+="ASMDISK/$name", \
OWNER="dmdba", GROUP="dinstall", MODE="0660"
EOF
done
# 提示后续操作
echo "已生成新规则文件:$rules_file"
echo "执行以下命令生效:"
echo "sudo cp $rules_file /etc/udev/rules.d/"
echo "sudo rm -f /dev/ASMDISK/*" # 清理旧链接
echo "sudo udevadm control --reload-rules && sudo udevadm trigger"
创建目录并存放脚本:
cd /home
vim uuid.sh # 粘贴上述脚本内容
chmod +x uuid.sh
./uuid.sh
# 复制规则到 udev 目录
cp 99-dm-asmdevices.rules /etc/udev/rules.d/
# 重载规则并触发生效
udevadm control --reload-rules
udevadm trigger
验证结果:
检查软链接是否正确创建:
ls -l /dev/ASMDISK/
2. 检查磁盘权限与属主
执行命令查看磁盘的属主和权限:
ls -l /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg
cat /etc/udev/rules.d/99-dm-asmdevices.rules
确保每个磁盘的 KERNEL、RESULT(scsi_id)、SYMLINK 等参数正确,无语法错误(如引号、逗号是否缺失)。
A机器、B机器配置相同,root依次执行:
root 用户执行:
mkdir /home/dmdba/dmdbms/config -p
mkdir /dmbak/dmcore -p
mkdir /dmbak/logcommit -p
chown dmdba.dinstall /data/dmdata -R
chown dmdba.dinstall /home/dmdba -R
chown dmdba.dinstall /dmbak -R
4.2.创建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 = 250715
[GRP] #新建一个GROUP
DCR_GRP_TYPE = CSS #组类型(CSS/ASM/DB)
DCR_GRP_NAME = GRP_CSS #组名
DCR_GRP_N_EP = 2 #组内节点个数
DCR_GRP_DSKCHK_CNT = 30 #磁盘心跳容错时间,单位:秒
[GRP_CSS]
DCR_EP_NAME = CSS0 #CSS节点名
DCR_EP_HOST = 10.127.17.115 #心跳地址
DCR_EP_PORT = 5336 #CSS端口
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 10.127.17.114 #心跳地址
DCR_EP_PORT = 5336
[GRP]
DCR_GRP_TYPE = ASM
DCR_GRP_NAME = GRP_ASM
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 30
[GRP_ASM]
DCR_EP_NAME = ASM0 #ASM节点名,和dmasvrmal的MAL_INST_NAME一致
DCR_EP_SHM_KEY = 93360 #共享内存标识
DCR_EP_SHM_SIZE = 1024 #共享内存大小
DCR_EP_HOST = 10.127.17.115 #心跳地址
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 = 1024
DCR_EP_HOST = 10.127.17.114 #心跳地址
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 = 30
[GRP_DB]
DCR_EP_NAME = DSC0 #实例名,和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 = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 5536
A机器、B机器配置相同,依次执行
dmdba用户执行:
vim /home/dmdba/dmdbms/config/dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 10.127.17.115 #心跳地址
MAL_PORT = 5636
[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 10.127.17.114 #心跳地址
MAL_PORT = 5636
(注意在操作的时候,下面标红部分的代码要注释掉,否则会报错,待启动完成后再进行反注释)
A机器
dmdba用户执行:
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 = 111
#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/DmServiceDMS start
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 = 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/DmServiceDMS start
在A机器执行
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 = 1024
roll = +DM_DATA/DATA/DSC/roll.dbf
roll_size = 10240
system = +DM_DATA/DATA/DSC/system.dbf
system_size = 1024
ctl_path = +DM_DATA/DATA/DSC/dm.ctl
ctl_size = 8
log_size = 2048
dcr_path = /dev/ASMDISK/dmdcr
dcr_seqno = 0
auto_overwrite = 1
PAGE_SIZE = 32
EXTENT_SIZE = 32
CASE_SENSITIVE = Y
CHARSET = 0
BLANK_PAD_MODE = 1
SYSDBA_PWD = Sysdba@123
SYSAUDITOR_PWD = Sysauditor@123
[DSC0]
config_path = /home/dmdba/dmdbms/config/DSC0_config
port_num = 5236
mal_host = 10.127.17.115 #心跳地址
mal_port = 5736
log_path = +DM_REDO/log/DSC0_log01.log
log_path = +DM_REDO/log/DSC0_log02.log
log_path = +DM_REDO/log/DSC0_log03.log
log_path = +DM_REDO/log/DSC0_log04.log
[DSC1]
config_path = /home/dmdba/dmdbms/config/DSC1_config
port_num = 5236
mal_host = 10.127.17.114 #心跳地址
mal_port = 5736
log_path = +DM_REDO/log/DSC1_log01.log
log_path = +DM_REDO/log/DSC1_log02.log
log_path = +DM_REDO/log/DSC1_log03.log
log_path = +DM_REDO/log/DSC1_log04.log
A机器
vim /home/dmdba/dmdbms/config/asminit.txt
# asm script file(修正后)
# 对应 sdc(5G,DCR 盘)
create dcrdisk '/dev/ASMDISK/dmdcr' 'DMDCR'
# 对应 sdd(5G,VOTE 盘)
create votedisk '/dev/ASMDISK/dmvote' 'DMVOTE'
# 对应 sde(8G,REDO 日志盘)
create asmdisk '/dev/ASMDISK/dmredo' 'DMREDO'
# 对应 sdf(10G,数据盘1)
create asmdisk '/dev/ASMDISK/dmdata1' 'DMDATA1'
# 对应 sdg(10G,数据盘2)
create asmdisk '/dev/ASMDISK/dmdata2' 'DMDATA2'
# 初始化 DCR 盘
init dcrdisk '/dev/ASMDISK/dmdcr' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini' identified by 'Dameng123'
# 初始化 VOTE 盘
init votedisk '/dev/ASMDISK/dmvote' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini'
A机器
初始化磁盘
/home/dmdba/dmdbms/bin/dmasmcmd SCRIPT_FILE=/home/dmdba/dmdbms/config/asminit.txt
A机器, B机器均要执行
root用户执行:
[root@dameng mnt]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -p CSS
[root@dameng mnt]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -y DmCSSServiceCSS.service -p ASM
dmdba用户执行:
A机器:
[dmdba@localhost bin]$ /home/dmdba/dmdbms/bin/DmCSSServiceCSS start
B机器:
[dmdba@localhost bin]$ /home/dmdba/dmdbms/bin/DmCSSServiceCSS start
A机器:
[dmdba@localhost bin]$ /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
B机器:
[dmdba@localhost bin]$ /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
在A机器dmdba用户执行
/home/dmdba/dmdbms/bin/dmasmtool DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini
-- 创建 REDO 日志磁盘组(使用 dmredo 磁盘)
ASM> create diskgroup 'DM_REDO' asmdisk '/dev/ASMDISK/dmredo'
-- 创建 DATA 数据磁盘组(使用 dmdata1 磁盘)
ASM> create diskgroup 'DM_DATA' asmdisk '/dev/ASMDISK/dmdata1'
-- 创建 ARCH 归档磁盘组(使用 dmdata2 磁盘)
ASM> create diskgroup 'DM_ARCH' asmdisk '/dev/ASMDISK/dmdata2'
A机器
dmdba用户执行:
[dmdba@rdmDSC03] /home/dmdba/dmdbms/bin/dminit control=/home/dmdba/dmdbms/ config/dminit.ini
...
create dm database success.
--拷贝文件
scp -r /home/dmdba/dmdbms/config/DSC1_config/ 10.127.17.114:/home/dmdba/dmdbms/config/
A机器
vim /home/dmdba/dmdbms/config/DSC0_config/dm.ini
修改ARCH_INI的值为1(默认值为0)
[dmdba@rdmDSC03]$vim /home/dmdba/dmdbms/config/DSC0_config/dm.ini
ARCH_INI = 1
vim /home/dmdba/dmdbms/config/DSC0_config/dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = +DM_ARCH/DSC0/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC1
ARCH_INCOMING_PATH = +DM_ARCH/DSC1/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 10240
B机器
vim /home/dmdba/dmdbms/config/DSC1_config/dm.ini
[dmdba@rdmDSC04]$vi /home/dmdba/dmdbms/config/DSC1_config/dm.ini
ARCH_INI = 1
vim /home/dmdba/dmdbms/config/DSC1_config/dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = +DM_ARCH/DSC1/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC0
ARCH_INCOMING_PATH = +DM_ARCH/DSC0/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 10240
两个节点都需要修改
vi /home/dmdba/dmdbms/config/DSC0_config/sqllog.ini
vi /home/dmdba/dmdbms/config/DSC1_config/sqllog.ini
#确认并修改以下参数
BUF_TOTAL_SIZE = 10240
BUF_SIZE = 1024
BUF_KEEP_CNT = 20
FILE_PATH = /dmbak/dmlogcommit
SWITCH_LIMIT = 128 --单个日志128M
FILE_NUM = 100 --保留日志数量,100个
ASYNC_FLUSH = 1 --异步写入日志
## 4.13.注册DMSERVER后台服务
A机器
root用户执行:
[root@rdmDSC03 ~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/dmdbms/config/DSC0_config/dm.ini -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -y DmASMSvrServiceASM.service -p DMS
B机器
root用户执行:
[root@rdmDSC04 ~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/dmdbms/config/DSC1_config/dm.ini -dcr_ini /home/dmdba/dmdbms/config/dmdcr.ini -y DmASMSvrServiceASM.service -p DMS
A、B 机器都要执行
vi /home/dmdba/dmdbms/bin/DmServiceDMS
修改为:
export MALLOC_ARENA_MAX=1
4.15.修改dmdcr.ini,反注释3.4注释的4行配置
反注释之后,执行reboot,两个节点都要执行。
su - dmdba
vim /home/dmdba/dmdbms/config/dmdcr.ini
5.后台启停服务
5.1.启停集群
停止顺序:A/B机器DMSERVER→A/B机器ASM→A/B机器CSS
停止DMSERVER (A/B机器操作):
su - dmdba
/home/dmdba/dmdbms/bin/DmServiceDMS stop
停止ASM (A/B机器操作):
su - dmdba
/home/dmdba/dmdbms/bin/DmASMSvrServiceASM stop
停止CSS (A/B机器操作):
su - dmdba
/home/dmdba/dmdbms/bin/DmCSSServiceCSS stop
A机器、B机器配置相同,依次执行
dmdba用户执行:
vim /home/dmdba/dmdbms/config/dmcssm.ini
CSSM_OGUID = 250715
CSSM_CSS_IP = 10.127.17.114:5336 #心跳IP
CSSM_CSS_IP = 10.127.17.115:5336 #心跳IP
CSSM_LOG_PATH = /home/dmdba/dmdbms/log
CSSM_LOG_FILE_SIZE = 512
CSSM_LOG_SPACE_LIMIT = 2048
cd /home/dmdba/dmdbms/bin
./dmcssm INI_PATH=/home/dmdba/dmdbms/config/dmcssm.ini
使用 DMASMTOOLM 登录到 ASM 文件系统,通过 ls 命令查看磁盘组信息是否正确。
[dmdba@dameng bin]$ /home/dmdba/dmdbms/bin/dmasmtool DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini
dmasmtool V8
ASM>ls
通过 lsdsk 命令查看磁盘详细信息是否正确。
使用 DIsql 工具,以 SYSDBA 身份登录服务器查看 V$ASMDISK 视图中的信息是否正确。
SELECT GROUP_ID,DISK_ID,DISK_NAME,DISK_PATH,SIZE,FREE_MB,STATUS FROM V$ASMDISK;
达梦社区地址 :https://eco.dameng.com
文章
阅读量
获赞