1、操作系统配置
1.1 关闭防火墙
[root@~]# systemctl stop firewalld
[root@~]# systemctl disable firewalld
[root@~]# systemctl status firewalld
#A机器、B机器依次执行
1.2 设置网卡自启
A机器、B机器依次修改
[root@~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
[root@~]# systemctl restart network
1.3 检查用户/修改limits
检查用户ID
[root@ dmsoft]# id dmdba
用户id=1201(dmdba) 组id=1201(dmdbagrp) 组=1201(dmdbagrp)
如果未创建dmdba用户,使用以下命令创建:
groupadd dmdbagrp -g 2001
useradd -G dmdbagrp -m -d /home/dmdba -s /bin/bash -u 2001 dmdba
修改密码:
passwd dmdba
修改用户资源限制
vi /etc/security/limits.conf
在文件末尾添加一下内容
dmdba soft nofile 65536
dmdba hard nofile 65536
dmdba soft nproc 10240
dmdba hard nproc 10240
dmdba soft core unlimited
dmdba hard core unlimited
2、磁盘配置
lsblk 查看共享磁盘信息
修改88-dm-asmdevices.rules
[root@ dmsoft]# vi /etc/udev/rules.d/88-dm-asmdevices.rules
添加内容为:
ACTION=="add", KERNEL=="vdc", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="vdd", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="vde", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="vdf", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="raw[2-5]", OWNER="dmdba", GROUP="dmdbagrp", MODE="660"
重启数据库服务器生效。
3、DSC搭建
3.1 A机器、B机器依次将安装镜像挂载到/mnt之后切换到dmdba用户开始进行数据库软件安装。
[root@ dmsoft]# mount -o loop dm8.iso /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@ dmsoft]# su - dmdba
上一次登录: 一 6月 6 16:09:08 CST 2024 pts/0 上
[dmdba@ ~]$ cd /mnt
[dmdba@ mnt]$ ./DMInstall.bin -i
请选择安装语言(C/c:中文 E/e:英文) [C/c]:c
解压安装程序.........
欢迎使用达梦数据库安装程序
是否输入Key文件路径? (Y/y:是 N/n:否) [Y/y]:n
是否设置时区? (Y/y:是 N/n:否) [Y/y]:y
设置时区:
[ 1]: GTM-12=日界线西
[ 2]: GTM-11=萨摩亚群岛
[ 3]: GTM-10=夏威夷
[ 4]: GTM-09=阿拉斯加
[ 5]: GTM-08=太平洋时间(美国和加拿大)
[ 6]: GTM-07=亚利桑那
[ 7]: GTM-06=中部时间(美国和加拿大)
[ 8]: GTM-05=东部部时间(美国和加拿大)
[ 9]: GTM-04=大西洋时间(美国和加拿大)
[10]: GTM-03=巴西利亚
[11]: GTM-02=中大西洋
[12]: GTM-01=亚速尔群岛
[13]: GTM=格林威治标准时间
[14]: GTM+01=萨拉热窝
[15]: GTM+02=开罗
[16]: GTM+03=莫斯科
[17]: GTM+04=阿布扎比
[18]: GTM+05=伊斯兰堡
[19]: GTM+06=达卡
[20]: GTM+07=曼谷,河内
[21]: GTM+08=中国标准时间
[22]: GTM+09=汉城
[23]: GTM+10=关岛
[24]: GTM+11=所罗门群岛
[25]: GTM+12=斐济
[26]: GTM+13=努库阿勒法
[27]: GTM+14=基里巴斯
请选择设置时区 [21]:21
安装类型:
1 典型安装
2 服务器
3 客户端
4 自定义
请选择安装类型的数字序号 [1 典型安装]:1
所需空间: 1139M
请选择安装目录 [/home/dmdba/dmdbms]:
可用空间: 49G
是否确认安装路径(/home/dmdba/dmdbms)? (Y/y:是 N/n:否) [Y/y]:y
安装前小结
安装位置: /home/dmdba/dmdbms
所需空间: 1139M
可用空间: 49G
是否确认安装? (Y/y:是 N/n:否):y
2024-06-06 16:44:24
[INFO] 安装达梦数据库...
2024-06-06 16:44:24
[INFO] 安装 基础 模块...
2024-06-06 16:44:26
[INFO] 安装 服务器 模块...
2024-06-06 16:44:26
[INFO] 安装 客户端 模块...
2024-06-06 16:44:26
[INFO] 安装 驱动 模块...
2024-06-06 16:44:27
[INFO] 安装 手册 模块...
2024-06-06 16:44:27
[INFO] 安装 服务 模块...
2024-06-06 16:44:27
[INFO] 移动日志文件。
2024-06-06 16:44:28
[INFO] 安装达梦数据库完成。
请以root系统用户执行命令:
/home/dmdba/dmdbms/script/root/root_installer.sh
安装结束
[dmdba@ mnt]$ exit
注销
[root@ dmsoft]# /home/dmdba/dmdbms/script/root/root_installer.sh
移动 /home/dmdba/dmdbms/bin/dm_svc.conf 到/etc目录
修改服务器权限
创建DmAPService服务
Created symlink /etc/systemd/system/multi-user.target.wants/DmAPService.service → /usr/lib/systemd/system/DmAPService.service.
创建服务(DmAPService)完成
启动DmAPService服务
3.2 创建dmdcr_cfg.ini
A机器、B机器配置相同
[dmdba@~]# vi /home/dmdba/config/dmdcr_cfg.ini
DCR_N_GRP = 3
DCR_VTD_PATH = dev/raw/raw3
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.98.40.231
DCR_EP_PORT = 9341
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 10.98.40.233
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 = 20
DCR_EP_HOST = 10.98.40.231
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 = 20
DCR_EP_HOST = 10.98.40.233
DCR_EP_PORT = 9351
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = GRP_DSC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_DSC]
DCR_EP_NAME = DSC0
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5237
DCR_CHECK_PORT = 9741
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5237
DCR_CHECK_PORT = 9742
3.3初始化磁盘组
初始化磁盘组只需要在一个节点执行即可,这里选择第一个节点执行。
[dmdba@ bin]$ ./dmasmcmd
DMASMCMD V8
ASM>依次执行如下语句
create dcrdisk '/dev/raw/raw2' 'dcr'
create votedisk '/dev/raw/raw3' 'vote'
create asmdisk '/dev/raw/raw5' 'LOG0'
create asmdisk '/dev/raw/raw4' 'DATA0'
init dcrdisk '/dev/raw/raw2' from '/home/dmdba/config/dmdcr_cfg.ini' identified by 'DmA$m_pwd'
init votedisk '/dev/raw/raw3' from '/home/dmdba/config/dmdcr_cfg.ini'
3.4 创建dmasvrmal.ini
A机器、B机器配置相同
[dmdba@~]# vi /home/dmdba/config/dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 10.98.40.231 #心跳地址
MAL_PORT = 7236 #MAL监听端口
[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 10.98.40.233
MAL_PORT = 7237
3.5 创建dmdcr.ini
A机器
[dmdba@~]# vi /home/dmdba/config/dmdcr.ini
DMDCR_PATH = /dev/raw/raw2
DMDCR_MAL_PATH =/home/dmdba/config/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmasmsvr dcr_ini=/home/dmdba/config/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver path=/home/dmdba/config/dsc0_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini
B机器
[dmdba@~]# vi /home/dmdba/config/dmdcr.ini
DMDCR_PATH = /dev/raw/raw2
DMDCR_MAL_PATH =/home/dmdba/config/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 1
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmasmsvr dcr_ini=/home/dmdba/config/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver path=/home/dmdba/config/dsc1_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini
注意:当前为手动拉起A机器和B机器的ASM和DMSERVER服务。
3.6 启动CSS、ASM服务
A机器、B机器依次执行。
A\B
cd /home/dmdba/dmdbms/bin
/home/dmdba/dmdbms/bin/dmcss DCR_INI=/home/dmdba/config/dmdcr .ini
/home/dmdba/dmdbms/bin/dmasmsvr DCR_INI=/home/dmdba/config/dmdcr .ini
3.7 创建DMASM磁盘组
cd /home/dmdba/dmdbms/bin
./dmasmtool DCR_INI=/home/dmdba/config/dmdcr.ini
create diskgroup 'archdg' asmdisk '/dev/raw/raw5'
create diskgroup 'datadg' asmdisk '/dev/raw/raw4'
3.8 创建dminit.ini
A机器、B机器配置相同。
[dmdba@~]# vi /home/dmdba/config/dminit.ini
db_name = dscdb
system_path = +datadg/data
system = +datadg/data/dscdb/system.dbf
system_size = 256
roll = +datadg/data/dscdb/roll.dbf
roll_size = 256
main = +datadg/data/dscdb/main.dbf
main_size = 1024
ctl_path = +datadg/data/dscdb/dm.ctl
ctl_size = 8
log_size = 2048
dcr_path = /dev/raw/raw2
dcr_seqno = 0
page_size =32
extent_size =32
case_sensitive =1
charset =1
[DSC0]
config_path =/home/dmdba/config/dsc0_config
port_num = 5237
mal_host = 10.98.40.231
mal_port = 9340
log_path = +archdg/log/dsc0_log01.log
log_path = +archdg/log/dsc0_log02.log
log_path = +archdg/log/dsc0_log03.log
log_path = +archdg/log/dsc0_log04.log
log_path = +archdg/log/dsc0_log05.log
[DSC1]
config_path =/home/dmdba/config/dsc1_config
port_num = 5237
mal_host = 10.98.40.233
mal_port = 9341
log_path = +archdg/log/dsc1_log01.log
log_path = +archdg/log/dsc1_log02.log
log_path = +archdg/log/dsc1_log03.log
log_path = +archdg/log/dsc1_log04.log
log_path = +archdg/log/dsc1_log05.log
3.9 初始化实例
[dmdba@jnpd-dj-dbdm-01-hg config]$ /home/dmdba/dmdbms/bin/dminit control=/home/dmdba/config/dminit.ini
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: +archdg/log/dsc0_log01.log
log file path: +archdg/log/dsc0_log02.log
log file path: +archdg/log/dsc0_log03.log
log file path: +archdg/log/dsc0_log04.log
log file path: +archdg/log/dsc0_log05.log
log file path: +archdg/log/dsc1_log01.log
log file path: +archdg/log/dsc1_log02.log
log file path: +archdg/log/dsc1_log03.log
log file path: +archdg/log/dsc1_log04.log
log file path: +archdg/log/dsc1_log05.log
write to dir [+datadg/data/PBMS].
create dm database success. 2024-06-06 16:58:37
--拷贝文件
[dmdba@~]# scp -r /home/dmdba/config/dsc1_config dmdba@10.98.40.233:/home/dmdba/config/
3.10 启动DMSERVER服务
A机器
/home/dmdba/dmdbms/bin/dmserver /home/dmdba/config/dsc0_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini
B机器
/home/dmdba/dmdbms/bin/dmserver /home/dmdba/config/dsc1_config/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini
3.11 配置dmcssm.ini并且启动dmcssm
选择其中一个节点配置dmcssm.ini,作为集群的监视器
[dmdba@ bin]$ cd /home/dmdba/config
[dmdba@ config]$ vi dmcssm.ini
#和 dmdcr_cfg.ini 中的 DCR_OGUID 保持一致
CSSM_OGUID = 63635
#配置所有 CSS 的连接信息,
#和 dmdcr_cfg.ini 中 CSS 配置项的 DCR_EP_HOST 和 DCR_EP_PORT 保持一致
CSSM_CSS_IP = 10.98.40.231:9341
CSSM_CSS_IP = 10.98.40.233:9343
CSSM_LOG_PATH =/home/dmdba/dmdbms/cssm_log #监视器日志文件存放路径
CSSM_LOG_FILE_SIZE = 32 #每个日志文件最大 32M
CSSM_LOG_SPACE_LIMIT = 4096 #不限定日志文件总占用空间.
dmdba@ config]$ cd /home/dmdba/dmdbms/bin
[dmdba@ bin]$ ./dmcssm ini_path=/home/dmdba/config/dmcssm.ini
[monitor] 2024-06-06 17:05:19: CSS MONITOR V8
[monitor] 2024-06-06 17:05:19: CSS MONITOR SYSTEM IS READY.
[monitor] 2024-06-06 17:05:19: Wait CSS Control Node choosed...
[monitor] 2024-06-06 17:05:20: Wait CSS Control Node choosed succeed.
show
monitor current time:2024-06-06 17:05:23, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================
[CSS0] global info:
[ASM0] auto restart = FALSE
[DSCDB0] auto restart = FALSE
[CSS1] global info:
[ASM1] auto restart = FALSE
[DSCDB1] auto restart = FALSE
ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts
2024-06-06 17:05:23 CSS0 0 9341 Control Node OPEN WORKING OK TRUE 698646298 698646465
2024-06-06 17:05:23 CSS1 1 9343 Normal Node OPEN WORKING OK TRUE 698652488 698652646
=================== group[name = GRP_ASM, seq = 1, type = ASM, Control Node = 1] ========================================
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
2024-06-06 17:05:23 ASM0 0 9349 Normal Node OPEN WORKING OK TRUE 698657201 698657331
2024-06-06 17:05:23 ASM1 1 9351 Control Node OPEN WORKING OK TRUE 698659779 698659912
=================== group[name = GRP_DSC, 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
2024-06-06 17:05:23 DSCDB0 0 5237 Control Node OPEN WORKING OK TRUE 2245530742 2245530832
2024-06-06 17:05:23 DSCDB1 1 5237 Normal Node OPEN WORKING OK TRUE 2245548625 2245548709
==================================================================================================================
3.12 配置dmarch.ini
所有服务器下均需要配置归档,因为达梦在备份时要求开启归档。
A机器
[dmdba@ dsc0_config]$ vi dmarch.ini
ARCH_LOCAL_SHARE =1
[ARCHIVE_LOCAL]
ARCH_TYPE = LOCAL
ARCH_DEST = +archdg/dscdb0/arch
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC1
ARCH_INCOMING_PATH = +archdg/dscdb1/arch
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[dmdba@ dsc0_config]$ vi dm.ini
ARCH_INI = 1
B机器
[dmdba@ dsc1_config]$ vi dmarch.ini
ARCH_LOCAL_SHARE =1
[ARCHIVE_LOCAL]
ARCH_TYPE = LOCAL
ARCH_DEST = +archdg/dscdb1/arch
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC0
ARCH_INCOMING_PATH = +archdg/dscdb0/arch
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[dmdba@ dsc1_config]$ vi dm.ini
ARCH_INI = 1
修改完归档之后需要重启集群使使归档生效。
3.13 注册CSS、ASM、DMSERVER后台服务
A机器
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /home/dmdba/config/dmdcr.ini -p CSS
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /home/dmdba/config/dmdcr.ini -y DmCSSServiceCSS.service -p ASM
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/config/dsc0_config/dm.ini -dcr_ini /home/dmdba/config/dmdcr.ini -y DmASMSvrServiceASM.service -p DSC
B机器
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /home/dmdba/config/dmdcr.ini -p CSS
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /home/dmdba/config/dmdcr.ini -y DmCSSServiceCSS.service -p ASM
[root@~]# /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/config/dsc1_config/dm.ini -dcr_ini /home/dmdba/config/dmdcr.ini -y DmASMSvrServiceASM.service -p DSC
4、DSC集群启停
启动:A/B机器CSS→A/B机器ASM→A/B机器Service
A/B机器:[dmdba@~]# /home/dmdba/dmdbms/bin/DmCSSServiceCSS start
A/B机器:[dmdba@~]# /home/dmdba/dmdbms/bin/DmASMSvrServiceASM start
A/B机器:[dmdba@~]# /home/dmdba/dmdbms/bin/DmServiceDSC start
说明:如果配置了自动拉起CSS启动后30秒自动拉起ASM,60秒自动拉起DMSERVER。
停止: A/B机器DMSERVER→A/B机器ASM→A/B机器CSS
A/B机器:[dmdba@~]# /home/dmdba/dmdbms/bin/DmServiceDSC stop
A/B机器:[dmdba@~]# /home/dmdba/dmdbms/bin/DmASMSvrServiceASM stop
A/B机器:[dmdba@~]# /home/dmdba/dmdbms/bin/DmCSSServiceCSS stop
说明:1)DSC正常停库必须2节点同时停止。2)ASM服务在任意节点停止,2个节点的ASM服务都会停止,为了保险起见,可以两边都执行停止命令。3)服务全部停止后,要检查后台进程是否全部停止。
文章
阅读量
获赞