注册
达梦DSC数据库共享集群概念及搭建
专栏/技术分享/ 文章详情 /

达梦DSC数据库共享集群概念及搭建

Ma- 2025/07/18 403 0 0
摘要

DMDSC(DM Data Shared Cluster) 概述

定义:DM 数据共享集群(DMDSC)是多实例单数据库的共享存储集群系统,支持高可用、高性能及负载均衡。
架构特性

  • 多实例单数据库:多个实例并发访问同一共享存储上的数据库文件(数据/控制文件),各实例独享联机/归档日志(存于共享存储)。
  • 核心组件
    • 共享存储:由 DMASM 文件系统管理(基础版或镜像版)。
    • DMCSS:集群控制软件,负责节点监控、故障切换与重加入。
    • DMCSSM:集群监视器,提供状态监控与管理命令。
    • MAL 链路:实例间高速通信网络,保障数据协同。
  • 节点限制:最多支持 8 个实例节点。
    image.png

核心功能特性

  1. 高可用性

    • 故障自动处理:DMCSS 实时检测故障节点并踢出集群,连接自动切换至存活节点。
    • 多副本容灾:DMASM 镜像技术通过多副本机制应对磁盘损坏,支持自动恢复。
    • 高效恢复:仅重做故障节点 REDO 日志,无需全量加载数据(优于传统双机热备)。
  2. 高性能与扩展性

    • 多节点并发:充分利用多服务器资源,提升整体事务吞吐量。
    • 无资源闲置:所有节点均活跃服务,避免备用节点资源浪费。
  3. 负载均衡

    • 连接均衡:通过服务名配置,将用户请求均匀分配至各节点。
    • 数据均衡:DMASM 条带化技术将数据均匀写入磁盘组内多磁盘。

关键概念

  • 集群类型:DMDSC 集群(DB 组)、DMCSS 集群(CSS 组)、DMASM 集群(ASM 组)。
  • 存储网络
    • 对外服务网络:用户访问入口。
    • MAL 网络:实例间数据交换。
    • 高速共享存储网络:实例与共享存储通信。
  • DMASM:专用于管理共享存储的分布式文件系统,仅通过 API 访问(存放数据/日志/控制文件)。
  • 心跳机制:通过 VOTE/DCRV 磁盘实现故障检测,超时判定节点失效。

功能限制

  • 仅控制节点支持:定时器配置、作业执行、HUGE 表操作。
  • 不支持:外部表、表级空间限额、MPP 混合部署、联机配置定时器。
  • 全文索引:仅支持默认词库(需置于 ASM 文件系统)。

DMDSC 通过多实例并发访问共享存储、DMCSS 故障自动管理及 DMASM 存储优化,实现高可用、高性能的数据库集群服务,适用于需高可靠性与扩展性的场景。(精炼后字数减少约 70%,保留全部核心技术要点)

部署DMDSC集群所用到的硬件和软件环境

硬件环境

主机两台:用于部署数据库实例dmserver、DMCSS、DMASMSVR。
内存大小要求:至少2GB。
共享存储:两台机器可以同时访问到的,可以划分为裸设备的磁盘。
网卡:每台主机至少准备2块网卡,提供内部网络和外部网络服务。

软件环境

操作系统:Linux、Unix、Windows等。

达梦数据库软件:安装好DM数据库软件之后,将拥有配置和管理DMDSC所需的所有软件:dmserver、dminit、dmasmcmd、dmasmsvr、dmasmtool、dmcss、dmcssm等。

DSC搭建

环境准备

IP配置表

主机名称 外部IP 内部IP 软件状态
dcs01 192.168.123.10 192.168.123.20 数据库软件已安装
dcs02 192.168.123.11 192.168.123.21 数据库软件已安装

磁盘路径与用途规划

磁盘类型 路径名 空间用途 说明
共享磁盘 +DM_RED0 在线日志 在线日志
+DM_DATA 数据库实例 根据数据量和未来增长需求规划
本地磁盘 /home/dmdba/dmdbms 数据库安装路径 存放数据库运行日志等
/dmbak 数据库备份 规划保留备份的空间

存储空间规划

用途 空间规划
Dcr 盘 2G
Vote 盘 2G
redolog 盘 5G
数据存储盘 5G × 3

端口用途规划

序号 端口号 用途
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端口

安装前准备

创建用户

groupadd dinstall -g 2001
useradd -g dinstall dmdba -u 1001

创建目录及授权

mkdir -p /data/dmdata
mkdir -p /dmarch
mkdir -p /dmbak/dmlogcommit
mkdir -p /dmbak/dmcore
mkdir -p /dmbak
chown -R dmdba.dinstall /data 
chown -R dmdba.dinstall /dmbak
chown -R dmdba.dinstall /dmarch

用户环境变量修改

cp /home/dmdba/.bash_profile /home/dmdba/.bash_profile.bak
echo "export MALLOC_ARENA_MAX=1" >> /home/dmdba/.bash_profile
echo 'export DM_HOME=/home/dmdba/dmdbms'>>/home/dmdba/.bash_profile
echo 'export PATH=$DM_HOME/bin:$PATH'>> /home/dmdba/.bash_profile
echo 'export LD_LIBRARY_PATH=$DM_HOME/bin:/lib:/usr/lib'>>/home/dmdba/.bash_profile

防火墙检查

1:查看防火状态
systemctl status firewalld
service  iptables status
2:暂时关闭防火墙
systemctl stop firewalld
service  iptables stop
3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off

关闭selinux

##临时关闭 SELinux:
[root@localhost ~]# setenforce 0
##永久关闭
[root@~]# vi /etc/selinux/config
SELINUX=disabled
##确认状态
[root@localhost ~]# getenforce
Disabled

关闭SWAP

备注:数据库独占内存且物理内存大于等于128G时需要关闭
#临时关闭 swap 分区,重启后失效
[root@~]# swapoff -a

#永久关闭 swap 分区
sed -ri 's/.*swap.*/#&/' /etc/fstab

调整limits.conf

cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "dmdba soft nproc 65536" >>/etc/security/limits.conf
echo "dmdba hard nproc 65536" >>/etc/security/limits.conf
echo "dmdba soft nofile 65536" >>/etc/security/limits.conf
echo "dmdba hard nofile 65536" >>/etc/security/limits.conf
echo "dmdba hard data unlimited" >>/etc/security/limits.conf
echo "dmdba soft data unlimited" >>/etc/security/limits.conf
echo "dmdba hard fsize unlimited" >>/etc/security/limits.conf
echo "dmdba soft fsize unlimited" >>/etc/security/limits.conf
echo "dmdba soft core unlimited" >>/etc/security/limits.conf
echo "dmdba hard core unlimited" >>/etc/security/limits.conf
echo "dmdba soft as unlimited" >>/etc/security/limits.conf
echo "dmdba hard as unlimited" >>/etc/security/limits.conf
echo "dmdba soft memlock unlimited" >>/etc/security/limits.conf
echo "dmdba hard memlock unlimited" >>/etc/security/limits.conf
echo "dmdba soft nice 0" >>/etc/security/limits.conf
echo "dmdba hard nice 0" >>/etc/security/limits.conf
chmod a+x /etc/security
chmod a+r /etc/security/limits.conf

调整system.conf

cp /etc/systemd/system.conf /etc/systemd/system.conf.bak
echo "DefaultLimitNOFILE=65536" >>/etc/systemd/system.conf
echo "DefaultLimitNPROC=10240" >>/etc/systemd/system.conf

调整sysctl.conf

cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "vm.swappiness=10" >>/etc/sysctl.conf
echo "vm.overcommit_memory=0" >>/etc/sysctl.conf
echo "kernel.core_pattern =/dmbak/dmcore/core-%e-%p-%s" >>/etc/sysctl.conf
echo "vm.min_free_kbytes = 1153434" >>/etc/sysctl.conf

sysctl -p
kill -s SIGSEGV $$

磁盘调度算法检查

查看对应的调度算法:
cat /sys/block/{DEVICE-NAME}/queue/scheduler

注意把{DEVICE-NAME}替换会数据库所使用的对应的磁盘名称,以下以sda为例。
cat /sys/block/sda/queue/scheduler
 
调度算法为deadline,如果不是deadline需要进行修改

--注意修改盘符
--执行以下命令临时修改:
echo deadline > /sys/block/{DEVICE-NAME}/queue/scheduler
--将修改加入启动项,重启后自动执行
echo "echo deadline > /sys/block/{DEVICE-NAME}/queue/scheduler" >> /root/.bash_profile

关闭numa检查

1、vi /etc/default/grub文件,调整如下行,增加numa=off:
GRUB_CMDLINE_LINUX="resume=/dev/sda1 splash=silent quiet showoptscrashkernel=113M,highcrashkernel=72M,low numa=off"

2、查询是UEFI-based机器还是BIOS-based的机器
[ -d /sys/firmware/efi ]&& echo UEFI || echo BIOS

3、重新生成grub.cfg
(1)若是 UEFI-based 的机器,请执行:
grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg
(2)若是 BIOS-based 的机器,请执行:
grub2-mkconfig -o /boot/grub2/grub.cfg

4、重启操作系统
查看是否生效:
dmesg | grep -i numa       --确认NUMA turned off
再次确认
cat /proc/cmdline

禁用透明大页

永久关闭 transparent_hugepage
1、查看透明大页设置:
#cat /sys/kernel/mm/transparent_hugepage/enabled
[always]madvise never
说明已启用透明大页 

2、vi/etc/default/grub文件,配置如下参数(标红部分):
GRUB_CMDLINE_LINUX="resume=/dev/sda1 splash=silent quiet showoptscrashkernel=113M,highcrashkernel=72M,low numa=off transparent_hugepage=never"
3、查询是UEFI-based机器还是BIOS-based的机器
[ -d /sys/firmware/efi ]&& echo UEFI || echo BIOS
4、重新生成grub.cfg
(1)若是 UEFI-based 的机器,请执行:
grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg
(2)若是 BIOS-based 的机器,请执行:
grub2-mkconfig -o /boot/grub2/grub.cfg
5、重启操作系统
6、查看是否生效:
#cat /sys/kernel/mm/transparent_hugepage/enabled

注意:如果以上操作关闭不了透明大页,按照如下方式进行关闭:

查看/sys/kernel/mm/transparent_hugepage/defrag配置文件缺省配置为“madvise”。
如需永久修改配置为“never”,需在/etc/rc.local中添加如下内容:
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
Fi

磁盘绑定

存储检查
A机器、B机器、(C机器后期添加节点使用)配置相同,依次执行
image.png
可以输出ID即为SCSI块设备

[root@dsc01 ~]# udevadm info --query=all --name=/dev/sdb | grep ID_SERIAL
E: ID_SERIAL=36000c29745b683fb8651e29180cdb8c7
E: ID_SERIAL_SHORT=6000c29745b683fb8651e29180cdb8c7
[root@dsc01 ~]#

通过ID绑定磁盘,共有b c d e f g 六块盘

vim uuid.sh
curr=$(cd "$(dirname "$0")";pwd)
rm -f $curr/88-dm-asmdevices.rules
for i in b c d e f g;
do
echo "KERNEL==\"sd?\",SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", SYMLINK+=\"ASMDISK/asm-disk$i\",OWNER=\"dmdba\", GROUP=\"dinstall\",MODE=\"0660\"" >> $curr/999-dm-asmdevices.rules
done

编写配置文件
vi /etc/udev/rules.d/999-dm-asmdevices.rules

KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29745b683fb8651e29180cdb8c7", SYMLINK+="ASMDISK/asm-diskb",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2985924f09086afca1a6b5ea74d", SYMLINK+="ASMDISK/asm-diskc",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29c2f042dbba4b050df362ba4e4", SYMLINK+="ASMDISK/asm-diskd",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c298ce4bada3f6b4612bb4f44dd0", SYMLINK+="ASMDISK/asm-diske",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2932f272639cc442529d919c450", SYMLINK+="ASMDISK/asm-diskf",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29729d2ae9d31f034d7f1de5e8f", SYMLINK+="ASMDISK/asm-diskg",OWNER="dmdba", GROUP="dinstall",MODE="0660"

检查生效
重启机器, 建议使用该方法。
如果无法重启, 执行下述命令:

udevadm trigger --type=devices --action=change
udevadm control --reload-rules

验证生效

[root@dsc01 ~]# blockdev --getsize64 /dev/ASMDISK/asm-diskb
2147483648
[root@dsc01 ~]# blockdev --getsize64 /dev/ASMDISK/asm-diskc
2147483648
[root@dsc01 ~]# blockdev --getsize64 /dev/ASMDISK/asm-diskd
5368709120
[root@dsc01 ~]# blockdev --getsize64 /dev/ASMDISK/asm-diske
5368709120
[root@dsc01 ~]# blockdev --getsize64 /dev/ASMDISK/asm-diskf
5368709120
[root@dsc01 ~]# blockdev --getsize64 /dev/ASMDISK/asm-diskg
5368709120
---输出空间大小即生效

搭建DSC

创建存放目录

A B 机器都要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

创建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/asm-diskb
  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       = 30  #磁盘心跳容错时间,单位:秒
[GRP_CSS]
  DCR_EP_NAME              = CSS0  #CSS节点名
  DCR_EP_HOST              = 192.168.123.20 #心跳地址
  DCR_EP_PORT              = 5336  #CSS端口
[GRP_CSS]
  DCR_EP_NAME              = CSS1
  DCR_EP_HOST              = 192.168.123.21 #心跳地址
  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              = 192.168.123.20  #心跳地址
  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              = 192.168.123.21 #心跳地址
  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

创建dmasvrmal.ini
A机器、B机器配置相同,依次执行
dmdba用户执行:
vim /home/dmdba/dmdbms/config/dmasvrmal.ini

[MAL_INST1]
  MAL_INST_NAME            = ASM0
  MAL_HOST                 = 192.168.123.20 #心跳地址
  MAL_PORT                 = 5636
[MAL_INST2]
  MAL_INST_NAME            = ASM1
  MAL_HOST                 = 192.168.123.21 #心跳地址
  MAL_PORT                 = 5636

创建dmdcr.ini
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  --B机器为1
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
#号部分在CSS ASM启动完成后再进行反注释

创建dminit.ini
在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/asm-diskc
  dcr_seqno                = 0
  auto_overwrite           = 1
  PAGE_SIZE                = 32
  EXTENT_SIZE                  = 32
  CASE_SENSITIVE           = Y
  CHARSET                  = 0
  BLANK_PAD_MODE           = 1
SYSDBA_PWD        =  !QAZ2wsx
SYSAUDITOR_PWD    =  !QAZ2wsx
[DSC0]
  config_path              = /home/dmdba/dmdbms/config/DSC0_config
  port_num                 = 5236
  mal_host                 = 192.168.123.20 #心跳地址
  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                 = 192.168.123.21 #心跳地址
  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
create dcrdisk '/dev/ASMDISK/asm-diskc' 'DMDCR'
create votedisk '/dev/ASMDISK/asm-diskb' 'DMVOTE'
create asmdisk '/dev/ASMDISK/asm-diskd' 'DMREDO'
create asmdisk '/dev/ASMDISK/asm-diske' 'DMDATA1'
create asmdisk '/dev/ASMDISK/asm-diskf' 'DMDATA2'
create asmdisk '/dev/ASMDISK/asm-diskg' 'DMDATA3'
init dcrdisk '/dev/ASMDISK/asm-diskc' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini' identified by '!QAZ2wsx'
init votedisk '/dev/ASMDISK/asm-diskb' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini'

A机器 初始化磁盘组

/home/dmdba/dmdbms/bin/dmasmcmd SCRIPT_FILE=/home/dmdba/dmdbms/config/asminit.txt

注册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

启动CSS、ASM服务

dmdba用户执行:
A机器:
/home/dmdba/dmdbms/bin/DmCSSServiceCSS start
Starting DmCSSServiceCSS: Last login: Fri Jul 18 00:22:08 CST 2025 on pts/0
                                                           [ OK ]
B机器:
/home/dmdba/dmdbms/bin/DmCSSServiceCSS start
Starting DmCSSServiceCSS: Last login: Fri Jul 18 00:22:08 CST 2025 on pts/0
                                                           [ OK ]
A机器:
/home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
Starting DmASMSvrServiceASM: Last login: Fri Jul 18 00:41:57 CST 2025
                                                           [ OK ]
B机器:
/home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
Starting DmASMSvrServiceASM: Last login: Fri Jul 18 00:42:25 CST 2025
                                                           [ OK ]

创建DMASM磁盘组
在A机器dmdba用户执行
/home/dmdba/dmdbms/bin/dmasmtool DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini

dmasmtool V8
ASM>create diskgroup 'DM_REDO' asmdisk '/dev/ASMDISK/asm-diskd'
Used time: 41.479(ms).
ASM>create diskgroup 'DM_DATA' asmdisk '/dev/ASMDISK/asm-diske'
Used time: 41.746(ms).
ASM>alter  diskgroup 'DM_DATA' add  asmdisk '/dev/ASMDISK/asm-diskf'
Used time: 32.918(ms).
ASM>alter  diskgroup 'DM_DATA' add  asmdisk '/dev/ASMDISK/asm-diskg'
Used time: 39.259(ms).
ASM>

初始化实例
A机器
dmdba用户执行:
/home/dmdba/dmdbms/bin/dminit control=/home/dmdba/dmdbms/config/dminit.ini

initdb V8
db version: 0x7000d
file dm.key not found, use default license!
License will expire on 2026-04-30
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: +DM_REDO/log/DSC0_log01.log


 log file path: +DM_REDO/log/DSC0_log02.log


 log file path: +DM_REDO/log/DSC0_log03.log


 log file path: +DM_REDO/log/DSC0_log04.log


 log file path: +DM_REDO/log/DSC1_log01.log


 log file path: +DM_REDO/log/DSC1_log02.log


 log file path: +DM_REDO/log/DSC1_log03.log


 log file path: +DM_REDO/log/DSC1_log04.log

FILE "/home/dmdba/dmdbms/config/DSC0_config/dm.ini" has already existed
FILE "/home/dmdba/dmdbms/config/DSC0_config/sqllog.ini" has already existed
FILE "/home/dmdba/dmdbms/config/DSC1_config/dm.ini" has already existed
FILE "/home/dmdba/dmdbms/config/DSC1_config/sqllog.ini" has already existed
FILE "+DM_DATA/DATA/DSC/dm.ctl" has already existed
write to dir [+DM_DATA/DATA/DSC].
create dm database success. 2025-07-18 17:39:51

---拷贝文件
[dmdba@dsc01 config]$ scp -r /home/dmdba/dmdbms/config/DSC1_config/ dmdba@192.168.123.11:/home/dmdba/dmdbms/config/DSC1_config/
The authenticity of host '192.168.123.11 (192.168.123.11)' can't be established.
ECDSA key fingerprint is SHA256:OVP67iINnS7EHxSRBgCjW+IPmMRpcdd8kPYyZt/JH9Q.
ECDSA key fingerprint is MD5:17:53:98:2f:79:5e:16:0e:71:01:fc:95:c1:33:03:e1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.123.11' (ECDSA) to the list of known hosts.
dmdba@192.168.123.11's password:
dm.ini                                                                                                                    100%   82KB  26.5MB/s   00:00
sqllog.ini                                                                                                                100%  714     1.1MB/s   00:00
dmmal.ini                                                                                                                 100%  208   357.8KB/s   00:00
[dmdba@dsc01 config]$
[dmdba@dsc01 config]$

创建dmarch.ini
A机器
vi /home/dmdba/dmdbms/config/DSC0_config/dm.ini
修改ARCH_INI的值为1(默认值为0)

  ARCH_INI                 = 1
vi /home/dmdba/dmdbms/config/DSC0_config/dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = +DM_DATA/DSC0/arch
ARCH_FILE_SIZE = 500
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC1
ARCH_INCOMING_PATH = +DM_DATA/DSC1/arch
ARCH_FILE_SIZE = 500
ARCH_SPACE_LIMIT = 10240

B机器
vim /home/dmdba/dmdbms/config/DSC1_config/dm.ini

  ARCH_INI                 = 1
vi /home/dmdba/dmdbms/config/DSC1_config/dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = +DM_DATA/DSC1/arch
ARCH_FILE_SIZE = 500
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC0
ARCH_INCOMING_PATH = +DM_DATA/DSC0/arch
ARCH_FILE_SIZE = 500
ARCH_SPACE_LIMIT = 10240

修改sqllog.ini
两个节点都需要修改
vi /home/dmdba/dmdbms/config/DSC0_config/sqllog.ini
vi /home/dmdba/dmdbms/config/DSC1_config/sqllog.ini

#确认并修改以下参数
BUF_TOTAL_SIZE          = 10240         #SQLs Log Buffer Total Size(K)(1024~1024000)
    BUF_SIZE                = 1024          #SQLs Log Buffer Size(K)(50~102400)
    BUF_KEEP_CNT            = 6             #SQLs Log buffer keeped count(1~100)

    [SLOG_ALL]
    FILE_PATH    = /dmbak/dmlogcommit
    PART_STOR    = 0
    SWITCH_MODE  = 2
    SWITCH_LIMIT   = 128
    ASYNC_FLUSH   = 1
    FILE_NUM = 20
    ITEMS    = 0
    SQL_TRACE_MASK  = 1
    MIN_EXEC_TIME = 0
    USER_MODE   = 0
    USERS =
    EXECTIME_PREC_FLAG = 0

    [SLOG_ERROR]
    SQL_TRACE_MASK = 23
    FILE_PATH      = ../log

    [SLOG_DDL]
    SQL_TRACE_MASK = 3

    [SLOG_LONG_SQL]
    SQL_TRACE_MASK = 25
    MIN_EXEC_TIME = 60000

注册DMSERVER后台服务
A机器
root用户执行:

/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
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceDMS.service to /usr/lib/systemd/system/DmServiceDMS.service.
创建服务(DmServiceDMS)完成

B机器
root用户执行:

/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
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceDMS.service to /usr/lib/systemd/system/DmServiceDMS.service.
创建服务(DmServiceDMS)完成

修改服务脚本
A、B 机器都要执行
vi /home/dmdba/dmdbms/bin/DmServiceDMS

export MALLOC_ARENA_MAX=4
修改为:
export MALLOC_ARENA_MAX=1

MALLOC_ARENA_MAX 的核心矛盾在于 ​并发性能​ 与 ​内存稳定性​ 的权衡。
达梦数据库建议优先保障稳定性,通过限制 ARENA 数量减少虚拟内存膨胀风险,同时结合业务负载测试动态调整

修改dmdcr.ini,反注释配置
反注释之后,执行reboot,两个节点都要执行。
su - dmdba
vi /home/dmdba/dmdbms/config/dmdcr.ini

后台启停服务

启停集群
停止顺序: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机器CSS→A/B机器ASM→A/B机器DMSERVER

启动CSS (A/B机器操作):
su - dmdba
/home/dmdba/dmdbms/bin/DmCSSServiceCSS start
启动ASM (A/B机器操作):
su - dmdba
/home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
启动DMSERVER (A/B机器操作):
su - dmdba
/home/dmdba/dmdbms/bin/DmServiceDMS start

说明:CSS启动后30秒自动拉起ASM,60秒自动拉起DMSERVER。

配置监视器

创建dmcssm.ini
A机器、B机器配置相同,依次执行
dmdba用户执行:
vi /home/dmdba/dmdbms/config/dmcssm.ini
CSSM_OGUID = 45331
CSSM_CSS_IP = 192.168.36.33:5336 #心跳IP
CSSM_CSS_IP = 192.168.36.34: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

show

monitor current time:2025-07-18 18:18:17, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

DSC_MODE = FULL
[CSS0] auto check = TRUE, global info:
[ASM0] auto restart = TRUE
[DSC0] auto restart = TRUE
[CSS1] auto check = TRUE, global info:
[ASM1] auto restart = TRUE
[DSC1] auto restart = TRUE

ep:     css_time               inst_name seqno port   mode         inst_status       vtd_status   is_ok  active guid          pid       ts
        2025-07-18 18:18:17    CSS0      0     5336   Control Node OPEN              WORKING      OK     TRUE   5655          1031      6745
        2025-07-18 18:18:17    CSS1      1     5336   Normal Node  OPEN              WORKING      OK     TRUE   5558          1033      6648

=================== 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          pid       ts
        2025-07-18 18:18:17    ASM0      0     5436   Control Node OPEN              WORKING      OK     TRUE   14123         1396      15194
        2025-07-18 18:18:17    ASM1      1     5436   Normal Node  OPEN              WORKING      OK     TRUE   14022         1403      15093

=================== group[name = GRP_DB, 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          pid       ts
        2025-07-18 18:18:17    DSC0      0     5236   Control Node OPEN              WORKING      OK     TRUE   31101         1580      32155
        2025-07-18 18:18:17    DSC1      1     5236   Normal Node  OPEN              WORKING      OK     TRUE   31025         1580      32079

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


监视器使用

命令 含义
show 查看所有组的信息
show config 查看 dmdcr_cfg.ini 的配置信息
show monitor 查看当前连接到主 CSS 的所有监视器信息
help 更多指令可通过 help 命令获取

集群数据测试

创建测试表,添加数据
A机器未提交,B查看
A机器提交,B查看
image.png

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服