简介
达梦数据库集群,一键部署过程的每一个步骤都自动化,脚本自动化部署,可以带来包括效能在内的显著的好处。你可以手工做这些事情,但是很耗时。二者的生产率差异真的很大。一般部署过程涉及到应用、环境和部署流程主要的模型。要实现自动化首先要做的是将需要部署的应用、环境和流程进行建模,所以还是需要一个自动化部署系统来支撑。
1、配置文件
1.1 服务器互信
说明:
- 服务器通信IP地址,可以使用ifconfig或ip a进行查看,多个使用空格分隔
- 主机名称,跟服务器IP地址一一对应
- 服务器账号及密码,如果所有的服务器账号密码相同,填写一个即可,否则跟服务器IP地址对应
1.2 设置操作系统环境
说明:
1、操作系统环境变量配置,包含内核参数配置以及资源限制等
1.3 达梦数据库
说明:
- 安装数据库的服务器列表,请根据实际需求填写
- 数据库访问端口,假如客户要求不能使用默认端口,则需要进行修改,否则默认即可
- 数据库操作系统用户,默认创建dmdba用户,非必须不建议修改
- 操作系统密码,请根据客户现场安全要求,设置强密码
- 初始化数据库、创建数据库实例、创建数据库服务等,请根据需求选填Y/N
- 安装数据库路径及数据存储路径,请根据服务器情况修改配置文件,目前批量安装暂时不支持,每个服务器指定路径
1.4 达梦数据守护集群DMDataWatch
说明:
- 数据库公共IP地址,多个以空隔分开即可
- 数据库私有通信IP地址,主要用于MAL系统、确认监视器等内部通信使用
- 本地归档路径、归档文件大小、守护类型、故障切换模式等,根据实际需求修改
- 端口中实例端口,需要在防火墙进行对客户网络放通,其他端口直接使用只需要服务器间可以正常通信即可;
1.5 达梦数据共享集群DMDSC
说明:
- 数据库公共IP地址,多个以空隔分开即可
- 数据库私有通信IP地址,主要用于MAL系统、确认监视器等内部通信使用
- 共享磁盘配置,根据客户环境修改盘号,如果需要使用UUID,则修改下代码即可;
- 端口中实例端口,需要在防火墙进行对客户网络放通,其他端口直接使用只需要服务器间可以正常通信即可;
2、核心代码
2.1 服务器互信
说明:
- 服务器互信,主要为方便后续可以免密执行命令
- 主要使用expect工具,完成互信过程发送密码到其他服务器
2.2 设置操作系统环境
说明:
- 安装所有软件,均需要对操作系统进行环境参数的修改
- 修改资源限制,打开文件数默认1024,对于生产环境这个值肯定是远远不够的,因此必须调整这些资源限制的值;
- 时区、防火墙等后台程序均可以自动修改
2.3 达梦数据库
说明:
1、达梦数据库自动安装脚本,可以自动创建用户、用户组、设置用户密码
2、支持根据安装路径,配置数据库环境变量
3、数据库采用静默安装方式,安装数据库服务
4、安装完成后,脚本自带服务自检功能
2.4 达梦数据守护集群DMDataWatch
说明:
1、脚本需要读取dm.conf文件的配置项,请保持配置安装路径正确
2、数据备份恢复、配置文件新建/修改、主备服务器配置、确认监视器安装等,均在脚本一键完成;
3、安装完成后,脚本自带集群服务自检功能
1.5 达梦数据共享集群DMDSC
说明:
1、脚本需要读取dm.conf文件的配置项,请保持配置安装路径正确
2、共享磁盘配置、磁盘组配置、配置文件新建/修改、数据库实例初始化,均在脚本一键完成;
3、安装完成后,脚本自带集群服务自检功能
3、安装截图
2.1 服务器互信
2.2 设置操作系统环境
2.3 达梦数据库
[root@dm191 bin]# ./3_one_key_dm.sh
====================当前服务器存在pssh命令,可以执行pssh====================
default host_ip=192.168.137.191 192.168.137.192 192.168.137.193
default ssh_port=22
default dm_port=5236
default is_init_db=Y
default db_name=DAMENG
default dm_language=EN
===================当前 192.168.137.191 系统CPU为X86架构====================
===================当前 192.168.137.191 系统发行系列为Redhat系====================
===================当前 192.168.137.191 系统发行版本为CentOS====================
===================当前 192.168.137.192 系统CPU为X86架构====================
===================当前 192.168.137.192 系统发行系列为Redhat系====================
===================当前 192.168.137.192 系统发行版本为CentOS====================
===================当前 192.168.137.193 系统CPU为X86架构====================
===================当前 192.168.137.193 系统发行系列为Redhat系====================
===================当前 192.168.137.193 系统发行版本为CentOS====================
====================安装达梦数据库====================
====================开始初始化 安装引导文件====================
====================开始创建 192.168.137.191 用户及目录====================
[1] 09:15:12 [SUCCESS] 192.168.137.191:22
[1] 09:15:12 [SUCCESS] 192.168.137.191:22
[1] 09:15:12 [SUCCESS] 192.168.137.191:22
[1] 09:15:12 [SUCCESS] 192.168.137.191:22
[1] 09:15:12 [SUCCESS] 192.168.137.191:22
[1] 09:15:13 [SUCCESS] 192.168.137.191:22
====================开始配置 192.168.137.191 数据库管理员用户的环境变量====================
[1] 09:15:13 [SUCCESS] 192.168.137.191:22
[1] 09:15:13 [SUCCESS] 192.168.137.191:22
[1] 09:15:13 [SUCCESS] 192.168.137.191:22
[1] 09:15:13 [SUCCESS] 192.168.137.191:22
====================正在安装 192.168.137.191 数据库软件,需要复制软件到安装服务器,取决网络速率影响,请耐心等待====================
[1] 09:15:13 [SUCCESS] 192.168.137.191:22
[1] 09:15:14 [SUCCESS] 192.168.137.191:22
[1] 09:15:14 [SUCCESS] 192.168.137.191:22
[1] 09:15:14 [SUCCESS] 192.168.137.191:22
[1] 09:16:41 [SUCCESS] 192.168.137.191:22
[1] 09:16:41 [SUCCESS] 192.168.137.191:22
Stderr: mount: /dev/loop0 is write-protected, mounting read-only
[1] 09:16:41 [SUCCESS] 192.168.137.191:22
[1] 09:16:41 [SUCCESS] 192.168.137.191:22
[1] 09:18:28 [SUCCESS] 192.168.137.191:22
Extract install files..........
2022-06-02 09:17:14
[INFO] Installing DM DBMS...
2022-06-02 09:17:14
[INFO] Installing BASE Module...
2022-06-02 09:17:28
[INFO] Installing SERVER Module...
2022-06-02 09:17:31
[INFO] Installing CLIENT Module...
2022-06-02 09:17:50
[INFO] Installing DRIVERS Module...
2022-06-02 09:17:57
[INFO] Installing MANUAL Module...
2022-06-02 09:17:59
[INFO] Installing SERVICE Module...
2022-06-02 09:18:02
[INFO] Move log file to log directory.
2022-06-02 09:18:03
[INFO] Change the power of installtion directory successfully.
2022-06-02 09:18:03
[INFO] Starting DmAPService service...
2022-06-02 09:18:06
[INFO] Start DmAPService service successfully.
2022-06-02 09:18:06
[INFO] Installed DM DBMS completely.
2022-06-02 09:18:09
[INFO] Creating database...
2022-06-02 09:18:12
[INFO] Create database completed.
2022-06-02 09:18:12
[INFO] Creating database service...
2022-06-02 09:18:12
[INFO] Create database service completed.
2022-06-02 09:18:12
[INFO] Starting the database service(DmServiceDMSERVER)...
2022-06-02 09:18:27
[INFO] Start the database service(DmServiceDMSERVER) success!
====================开始创建 192.168.137.192 用户及目录====================
[1] 09:18:30 [SUCCESS] 192.168.137.192:22
[1] 09:18:30 [SUCCESS] 192.168.137.192:22
[1] 09:18:30 [SUCCESS] 192.168.137.192:22
[1] 09:18:30 [SUCCESS] 192.168.137.192:22
[1] 09:18:31 [SUCCESS] 192.168.137.192:22
[1] 09:18:31 [SUCCESS] 192.168.137.192:22
====================开始配置 192.168.137.192 数据库管理员用户的环境变量====================
[1] 09:18:31 [SUCCESS] 192.168.137.192:22
[1] 09:18:31 [SUCCESS] 192.168.137.192:22
[1] 09:18:31 [SUCCESS] 192.168.137.192:22
[1] 09:18:31 [SUCCESS] 192.168.137.192:22
====================正在安装 192.168.137.192 数据库软件,需要复制软件到安装服务器,取决网络速率影响,请耐心等待====================
[1] 09:18:32 [SUCCESS] 192.168.137.192:22
[1] 09:18:32 [SUCCESS] 192.168.137.192:22
[1] 09:18:32 [SUCCESS] 192.168.137.192:22
[1] 09:18:32 [SUCCESS] 192.168.137.192:22
[1] 09:19:19 [SUCCESS] 192.168.137.192:22
[1] 09:19:19 [SUCCESS] 192.168.137.192:22
Stderr: mount: /dev/loop0 is write-protected, mounting read-only
[1] 09:19:20 [SUCCESS] 192.168.137.192:22
[1] 09:19:20 [SUCCESS] 192.168.137.192:22
[1] 09:21:17 [SUCCESS] 192.168.137.192:22
Extract install files..........
2022-06-02 09:20:13
[INFO] Installing DM DBMS...
2022-06-02 09:20:14
[INFO] Installing BASE Module...
2022-06-02 09:20:26
[INFO] Installing SERVER Module...
2022-06-02 09:20:27
[INFO] Installing CLIENT Module...
2022-06-02 09:20:41
[INFO] Installing DRIVERS Module...
2022-06-02 09:20:49
[INFO] Installing MANUAL Module...
2022-06-02 09:20:52
[INFO] Installing SERVICE Module...
2022-06-02 09:20:54
[INFO] Move log file to log directory.
2022-06-02 09:20:54
[INFO] Change the power of installtion directory successfully.
2022-06-02 09:20:55
[INFO] Starting DmAPService service...
2022-06-02 09:20:56
[INFO] Start DmAPService service successfully.
2022-06-02 09:20:56
[INFO] Installed DM DBMS completely.
2022-06-02 09:20:58
[INFO] Creating database...
2022-06-02 09:21:01
[INFO] Create database completed.
2022-06-02 09:21:01
[INFO] Creating database service...
2022-06-02 09:21:02
[INFO] Create database service completed.
2022-06-02 09:21:02
[INFO] Starting the database service(DmServiceDMSERVER)...
2022-06-02 09:21:17
[INFO] Start the database service(DmServiceDMSERVER) success!
====================开始创建 192.168.137.193 用户及目录====================
[1] 09:21:18 [SUCCESS] 192.168.137.193:22
[1] 09:21:18 [SUCCESS] 192.168.137.193:22
[1] 09:21:18 [SUCCESS] 192.168.137.193:22
[1] 09:21:18 [SUCCESS] 192.168.137.193:22
[1] 09:21:18 [SUCCESS] 192.168.137.193:22
[1] 09:21:18 [SUCCESS] 192.168.137.193:22
====================开始配置 192.168.137.193 数据库管理员用户的环境变量====================
[1] 09:21:19 [SUCCESS] 192.168.137.193:22
[1] 09:21:19 [SUCCESS] 192.168.137.193:22
[1] 09:21:19 [SUCCESS] 192.168.137.193:22
[1] 09:21:19 [SUCCESS] 192.168.137.193:22
====================正在安装 192.168.137.193 数据库软件,需要复制软件到安装服务器,取决网络速率影响,请耐心等待====================
[1] 09:21:19 [SUCCESS] 192.168.137.193:22
[1] 09:21:20 [SUCCESS] 192.168.137.193:22
[1] 09:21:20 [SUCCESS] 192.168.137.193:22
[1] 09:21:20 [SUCCESS] 192.168.137.193:22
[1] 09:21:57 [SUCCESS] 192.168.137.193:22
[1] 09:21:57 [SUCCESS] 192.168.137.193:22
Stderr: mount: /dev/loop0 is write-protected, mounting read-only
[1] 09:21:57 [SUCCESS] 192.168.137.193:22
[1] 09:21:58 [SUCCESS] 192.168.137.193:22
[1] 09:23:27 [SUCCESS] 192.168.137.193:22
Extract install files..........
2022-06-02 09:22:23
[INFO] Installing DM DBMS...
2022-06-02 09:22:24
[INFO] Installing BASE Module...
2022-06-02 09:22:35
[INFO] Installing SERVER Module...
2022-06-02 09:22:38
[INFO] Installing CLIENT Module...
2022-06-02 09:22:54
[INFO] Installing DRIVERS Module...
2022-06-02 09:23:01
[INFO] Installing MANUAL Module...
2022-06-02 09:23:03
[INFO] Installing SERVICE Module...
2022-06-02 09:23:05
[INFO] Move log file to log directory.
2022-06-02 09:23:05
[INFO] Change the power of installtion directory successfully.
2022-06-02 09:23:05
[INFO] Starting DmAPService service...
2022-06-02 09:23:06
[INFO] Start DmAPService service successfully.
2022-06-02 09:23:06
[INFO] Installed DM DBMS completely.
2022-06-02 09:23:08
[INFO] Creating database...
2022-06-02 09:23:11
[INFO] Create database completed.
2022-06-02 09:23:11
[INFO] Creating database service...
2022-06-02 09:23:11
[INFO] Create database service completed.
2022-06-02 09:23:11
[INFO] Starting the database service(DmServiceDMSERVER)...
2022-06-02 09:23:27
[INFO] Start the database service(DmServiceDMSERVER) success!
====================检查是否已完成达梦数据库的安装====================
SUCCESS 服务器 192.168.137.191 达梦数据库软件已安装
SUCCESS 服务器 192.168.137.192 达梦数据库软件已安装
SUCCESS 服务器 192.168.137.193 达梦数据库软件已安装
2.4 达梦数据守护集群DMDataWatch
备份数据,并同步到备机
安装完成后检查集群,守护进程状态
脚本安装日志:
[root@dm172 bin]# ./5_one_key_dm_dw.sh
====================当前服务器存在pssh命令,可以执行pssh====================
default host_ip=192.168.137.172 192.168.137.173
default ssh_port=22
default dm_port=5236
===================当前 192.168.137.172 系统CPU为X86架构====================
===================当前 192.168.137.172 系统发行系列为Redhat系====================
===================当前 192.168.137.172 系统发行版本为CentOS====================
===================当前 192.168.137.173 系统CPU为X86架构====================
===================当前 192.168.137.173 系统发行系列为Redhat系====================
===================当前 192.168.137.173 系统发行版本为CentOS====================
====================安装达梦数据库/共享存储集群====================
[1] 15:11:26 [SUCCESS] 192.168.137.172:22
[1] 15:11:26 [SUCCESS] 192.168.137.172:22
[1] 15:11:26 [SUCCESS] 192.168.137.173:22
[1] 15:11:26 [SUCCESS] 192.168.137.173:22
====================开始同步主机数据到备机====================
====================开始停止 192.168.137.172 数据库服务====================
[1] 15:11:27 [SUCCESS] 192.168.137.172:22
DmServiceDMSERVER service is stopped.
====================开始启动 192.168.137.172 数据库AP服务====================
[1] 15:11:47 [SUCCESS] 192.168.137.172:22
Stopping DmAPService: [ OK ]
Starting DmAPService: [ OK ]
====================开始停止 192.168.137.173 数据库服务====================
[1] 15:11:47 [SUCCESS] 192.168.137.173:22
DmServiceDMSERVER service is stopped.
====================开始启动 192.168.137.173 数据库AP服务====================
[1] 15:12:07 [SUCCESS] 192.168.137.173:22
Stopping DmAPService: [ OK ]
Starting DmAPService: [ OK ]
====================开始在服务器 192.168.137.172 备份数据====================
dmrman V8
backup database '/data1/dmdba/dmdbms/data/DAMENG/dm.ini' backupset '/home/dmdba/bakfull';
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[36027], file_lsn[36027]
Processing backupset /home/dmdba/bakfull
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]
backup successfully!
time used: 00:00:03.338
====================开始在服务器 192.168.137.173 恢复数据====================
[1] 15:12:11 [SUCCESS] 192.168.137.173:22
[1] 15:12:11 [SUCCESS] 192.168.137.173:22
[1] 15:12:11 [SUCCESS] 192.168.137.173:22
[1] 15:12:12 [SUCCESS] 192.168.137.173:22
[1] 15:12:15 [SUCCESS] 192.168.137.173:22
dmrman V8
restore database '/data1/dmdba/dmdbms/data/DAMENG/dm.ini' from backupset '/home/dmdba/bakfull';
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]
restore successfully.
time used: 00:00:02.654
Stderr: file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[1] 15:12:16 [SUCCESS] 192.168.137.173:22
dmrman V8
recover database '/data1/dmdba/dmdbms/data/DAMENG/dm.ini' update db_magic;
recover successfully!
time used: 00:00:01.048
Stderr: file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[36027], file_lsn[36027]
[1] 15:12:16 [SUCCESS] 192.168.137.172:22
[1] 15:12:16 [SUCCESS] 192.168.137.172:22
[1] 15:12:16 [SUCCESS] 192.168.137.172:22
[1] 15:12:16 [SUCCESS] 192.168.137.172:22
[1] 15:12:17 [SUCCESS] 192.168.137.172:22
[1] 15:12:17 [SUCCESS] 192.168.137.173:22
[1] 15:12:17 [SUCCESS] 192.168.137.173:22
[1] 15:12:17 [SUCCESS] 192.168.137.173:22
[1] 15:12:17 [SUCCESS] 192.168.137.173:22
[1] 15:12:18 [SUCCESS] 192.168.137.173:22
[1] 15:12:18 [SUCCESS] 192.168.137.172:22
[1] 15:12:18 [SUCCESS] 192.168.137.172:22
[1] 15:12:18 [SUCCESS] 192.168.137.172:22
[1] 15:12:18 [SUCCESS] 192.168.137.173:22
[1] 15:12:18 [SUCCESS] 192.168.137.173:22
[1] 15:12:19 [SUCCESS] 192.168.137.173:22
[1] 15:12:19 [SUCCESS] 192.168.137.172:22
[1] 15:12:19 [SUCCESS] 192.168.137.173:22
[1] 15:12:19 [SUCCESS] 192.168.137.172:22
[1] 15:12:19 [SUCCESS] 192.168.137.173:22
====================开始配置主备服务器====================
[1] 15:12:19 [SUCCESS] 192.168.137.172:22
[1] 15:12:20 [SUCCESS] 192.168.137.172:22
[1] 15:12:22 [SUCCESS] 192.168.137.173:22
[1] 15:12:22 [SUCCESS] 192.168.137.173:22
====================正在启动数据库到mount模式,请等待====================
====================修改数据库oguid,并配置主备关系(多次执行,会出现出错,忽略即可)====================
Server[LOCALHOST:5236]:mode is normal, state is mount
login used time : 1.631(ms)
disql V8
SQL> sp_set_oguid(453331);
DMSQL executed successfully
used time: 10.026(ms). Execute id is 0.
SQL> alter database primary;
executed successfully
used time: 7.950(ms). Execute id is 0.
SQL> exit;
192.168.137.173
[1] 15:12:34 [SUCCESS] 192.168.137.173:22
[1] 15:12:35 [SUCCESS] 192.168.137.173:22
Server[LOCALHOST:5236]:mode is normal, state is mount
login used time : 1.785(ms)
disql V8
SQL> sp_set_oguid(453331);
DMSQL executed successfully
used time: 86.714(ms). Execute id is 0.
SQL> alter database standby;
executed successfully
used time: 24.589(ms). Execute id is 0.
SQL> exit;
====================正在启动守护进程dmwatcher====================
[1] 15:12:35 [SUCCESS] 192.168.137.172:22
[1] 15:12:37 [SUCCESS] 192.168.137.173:22
====================正在启动确认监视器dmmonitor====================
[1] 15:12:39 [SUCCESS] 192.168.137.172:22
[1] 15:12:41 [SUCCESS] 192.168.137.173:22
====================正在启动普通监视器,检查守护进程状态====================
[monitor] 2022-05-31 15:12:42: DMMONITOR[4.0] V8
[monitor] 2022-05-31 15:12:42: DMMONITOR[4.0] IS READY.
[monitor] 2022-05-31 15:12:42: Received message from(DMDW1)
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN
2022-05-31 15:12:42 RECOVERY OK DMDW1 OPEN PRIMARY VALID 2 37284 37284
[monitor] 2022-05-31 15:12:42: Received message from(DMDW2)
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN
2022-05-31 15:12:42 OPEN OK DMDW2 OPEN STANDBY INVALID 1 36027 36027
2022-05-31 15:12:42
#================================================================================#
GROUP OGUID MON_CONFIRM MODE MPP_FLAG
GRP_RW 453331 FALSE AUTO FALSE
<<DATABASE GLOBAL INFO:>>
DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT
192.168.137.172 52141 2022-05-31 15:12:42 GLOBAL VALID RECOVERY DMDW1 OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID
EP INFO:
INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG
192.168.137.172 5236 OK DMDW1 OPEN PRIMARY 0 0 REALTIME VALID 4565 37284 4565 37284 DW_RECOVERY
<<DATABASE GLOBAL INFO:>>
DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT
192.168.137.173 52141 2022-05-31 15:12:42 GLOBAL VALID OPEN DMDW2 OK 1 1 OPEN STANDBY DSC_OPEN REALTIME INVALID
EP INFO:
INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG
192.168.137.173 5236 OK DMDW2 OPEN STANDBY 0 0 REALTIME INVALID 4563 36027 4563 36027 NONE
DATABASE(DMDW2) APPLY INFO FROM (DMDW1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4563, 4563, 4563], (RLSN, SLSN, KLSN)[36027, 36027, 36027], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (36027)
#================================================================================#
====================正在注册数据库服务====================
[1] 10:55:10 [SUCCESS] 192.168.137.172:22
Finished to create the service (DmWatcherServicedmdw)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicedmdw.service to /usr/lib/systemd/system/DmWatcherServicedmdw.service.
[1] 10:55:10 [SUCCESS] 192.168.137.172:22
Finished to create the service (DmServicedmdw)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedmdw.service to /usr/lib/systemd/system/DmServicedmdw.service.
[1] 10:55:11 [SUCCESS] 192.168.137.173:22
Finished to create the service (DmWatcherServicedmdw)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicedmdw.service to /usr/lib/systemd/system/DmWatcherServicedmdw.service.
[1] 10:55:11 [SUCCESS] 192.168.137.173:22
Finished to create the service (DmServicedmdw)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedmdw.service to /usr/lib/systemd/system/DmServicedmdw.service.
[1] 10:55:11 [SUCCESS] 192.168.137.172:22
Finished to create the service (DmMonitorServiceconfirm)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmMonitorServiceconfirm.service to /usr/lib/systemd/system/DmMonitorServiceconfirm.service.
====================数据库安装完成,请进行客户端配置,示例如下====================
请在任意节点或客户端,配置 dm_svc.conf 文件
1、32 位的 DM 安装在 Win32 操作平台下,配置文件位于 %SystemRoot%\system32 目录
2、64 位的 DM 安装在 Win64 操作平台下,配置文件位于 %SystemRoot%\system32 目录
3、32 位的 DM 安装在 Win64 操作平台下,配置文件位于 %SystemRoot%\SysWOW64 目录
4、在 Linux 平台下,配置文件位于/etc 目录
文件内容:
# 以#开头的行表示是注释
# 全局配置区
DMDW=(192.168.137.172:5236,192.168.137.173:5236)
TIME_ZONE=(+480) #表示+8:00 时区
LOGIN_ENCRYPT=(0)
DIRECT=(Y)
# 服务配置区
[DMDW]
TIME_ZONE=(+540) #表示+9:00 时区
LOGIN_MODE=(1)
SWITCH_TIME=(3)
SWITCH_INTERVAL=(10)
1.5 达梦数据共享集群DMDSC
共享磁盘
初始化实例
服务自检
安装完成后,检查共享集群状态
安装日志:
[root@dm191 bin]# ./4_one_key_dm_dsc.sh
====================当前服务器存在pssh命令,可以执行pssh====================
default host_ip=192.168.137.191 192.168.137.192 192.168.137.193
default ssh_port=22
default dm_port=5236
===================当前 192.168.137.191 系统CPU为X86架构====================
===================当前 192.168.137.191 系统发行系列为Redhat系====================
===================当前 192.168.137.191 系统发行版本为CentOS====================
===================当前 192.168.137.192 系统CPU为X86架构====================
===================当前 192.168.137.192 系统发行系列为Redhat系====================
===================当前 192.168.137.192 系统发行版本为CentOS====================
===================当前 192.168.137.193 系统CPU为X86架构====================
===================当前 192.168.137.193 系统发行系列为Redhat系====================
===================当前 192.168.137.193 系统发行版本为CentOS====================
====================安装达梦数据库/共享存储集群====================
[1] 15:37:27 [SUCCESS] 192.168.137.191:22
[1] 15:37:27 [SUCCESS] 192.168.137.192:22
[1] 15:37:28 [SUCCESS] 192.168.137.193:22
====================开始停止 192.168.137.191 数据库服务,未初始数据库出现报错,请忽略====================
[1] 15:37:33 [SUCCESS] 192.168.137.191:22
Stopping DmServiceDMSERVER: [ OK ]
[1] 15:37:33 [SUCCESS] 192.168.137.191:22
Stderr: Removed symlink /etc/systemd/system/multi-user.target.wants/DmServiceDMSERVER.service.
====================开始停止 192.168.137.192 数据库服务,未初始数据库出现报错,请忽略====================
[1] 15:37:44 [SUCCESS] 192.168.137.192:22
Stopping DmServiceDMSERVER: [ OK ]
[1] 15:37:44 [SUCCESS] 192.168.137.192:22
Stderr: Removed symlink /etc/systemd/system/multi-user.target.wants/DmServiceDMSERVER.service.
====================开始停止 192.168.137.193 数据库服务,未初始数据库出现报错,请忽略====================
[1] 15:37:54 [SUCCESS] 192.168.137.193:22
Stopping DmServiceDMSERVER: [ OK ]
[1] 15:37:54 [SUCCESS] 192.168.137.193:22
Stderr: Removed symlink /etc/systemd/system/multi-user.target.wants/DmServiceDMSERVER.service.
====================开始创建 192.168.137.191 共享磁盘====================
[1] 15:37:54 [SUCCESS] 192.168.137.191:22
[1] 15:37:55 [SUCCESS] 192.168.137.191:22
[1] 15:37:55 [SUCCESS] 192.168.137.191:22
[1] 15:37:55 [SUCCESS] 192.168.137.191:22
[1] 15:37:55 [SUCCESS] 192.168.137.191:22
====================开始创建 192.168.137.192 共享磁盘====================
[1] 15:37:56 [SUCCESS] 192.168.137.192:22
[1] 15:37:56 [SUCCESS] 192.168.137.192:22
[1] 15:37:56 [SUCCESS] 192.168.137.192:22
[1] 15:37:56 [SUCCESS] 192.168.137.192:22
[1] 15:37:57 [SUCCESS] 192.168.137.192:22
====================开始创建 192.168.137.193 共享磁盘====================
[1] 15:37:57 [SUCCESS] 192.168.137.193:22
[1] 15:37:58 [SUCCESS] 192.168.137.193:22
[1] 15:37:58 [SUCCESS] 192.168.137.193:22
[1] 15:37:58 [SUCCESS] 192.168.137.193:22
[1] 15:37:59 [SUCCESS] 192.168.137.193:22
====================开始创建Dcr配置文件====================
DMASMCMD V8
ASM>create dcrdisk '/dev/raw/raw1' 'dcr'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr
Used time: 00:00:15.089.
ASM>create votedisk '/dev/raw/raw2' 'vote'
[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote
Used time: 00:00:14.722.
ASM>create asmdisk '/dev/raw/raw3' 'LOG0'
[Trace]The ASM initialize asmdisk /dev/raw/raw3 to name DMASMLOG0
Used time: 92.342(ms).
ASM>create asmdisk '/dev/raw/raw4' 'DATA0'
[Trace]The ASM initialize asmdisk /dev/raw/raw4 to name DMASMDATA0
Used time: 92.588(ms).
ASM>init dcrdisk '/dev/raw/raw1' from '/data1/dmdba/dmdbms/config/dmdcr_cfg.ini' identified by '123456'
[Trace]DG 126 alloc one extent for inodes, addr(disk_id, disk_auno, extent_no):(0,0,1).
[Trace]DG 126 allocate 4 extents for file 0xfe000002.
[Trace]DG 126 alloc 4 extents for 0xfe000002, addr(disk_id, disk_auno, extent_no):(0, 0, 2)->(0, 0, 5), need_init = 1.
Used time: 00:00:15.033.
ASM>init votedisk '/dev/raw/raw2' from '/data1/dmdba/dmdbms/config/dmdcr_cfg.ini'
[Trace]DG 125 alloc one extent for inodes, addr(disk_id, disk_auno, extent_no):(0,0,1).
[Trace]DG 125 allocate 4 extents for file 0xfd000002.
[Trace]DG 125 alloc 4 extents for 0xfd000002, addr(disk_id, disk_auno, extent_no):(0, 0, 2)->(0, 0, 5), need_init = 1.
Used time: 00:00:14.806.
[1] 15:39:04 [SUCCESS] 192.168.137.191:22
[1] 15:39:04 [SUCCESS] 192.168.137.192:22
[1] 15:39:05 [SUCCESS] 192.168.137.193:22
[1] 15:39:05 [SUCCESS] 192.168.137.191:22
[1] 15:39:05 [SUCCESS] 192.168.137.192:22
[1] 15:39:05 [SUCCESS] 192.168.137.193:22
[1] 15:39:05 [SUCCESS] 192.168.137.191:22
Finished to create the service (DmCSSServicecss)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicecss.service to /usr/lib/systemd/system/DmCSSServicecss.service.
[1] 15:39:05 [SUCCESS] 192.168.137.191:22
[1] 15:39:06 [SUCCESS] 192.168.137.191:22
[1] 15:39:21 [SUCCESS] 192.168.137.191:22
[1] 15:39:21 [SUCCESS] 192.168.137.192:22
Finished to create the service (DmCSSServicecss)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicecss.service to /usr/lib/systemd/system/DmCSSServicecss.service.
[1] 15:39:21 [SUCCESS] 192.168.137.192:22
[1] 15:39:21 [SUCCESS] 192.168.137.192:22
[1] 15:39:37 [SUCCESS] 192.168.137.192:22
[1] 15:39:37 [SUCCESS] 192.168.137.193:22
Finished to create the service (DmCSSServicecss)
Stderr: Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicecss.service to /usr/lib/systemd/system/DmCSSServicecss.service.
[1] 15:39:37 [SUCCESS] 192.168.137.193:22
[1] 15:39:37 [SUCCESS] 192.168.137.193:22
[1] 15:39:53 [SUCCESS] 192.168.137.193:22
====================开始 CSS、ASM和DB 服务启动后自检====================
SUCCESS 服务器 192.168.137.191 数据库CSS、ASM和DB服务启动完成,耗时:12 秒
SUCCESS 服务器 192.168.137.192 数据库CSS、ASM和DB服务启动完成,耗时:1 秒
SUCCESS 服务器 192.168.137.193 数据库CSS、ASM和DB服务启动完成,耗时:1 秒
====================创建ASM日志及数据磁盘组====================
DMASMTOOL V8
ASM>drop diskgroup "DMDATA"
[code : -11010] ASM disk group[DMDATA] does not exists
ASM>drop diskgroup "DMLOG"
[code : -11010] ASM disk group[DMLOG] does not exists
ASM>create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
Used time: 83.927(ms).
ASM>create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
Used time: 42.223(ms).
ASM>ls -l
+
disk groups total [4]......
NO.1 name: DMLOG
id: 0
au_size: 1.00 MB
extent_size: 4
total_size: 7.81 GB
free_size: 7.80 GB
create_time: 2022-06-02 15:40:18
modify_time: 2022-06-02 15:40:18
NO.2 name: DMDATA
id: 1
au_size: 1.00 MB
extent_size: 4
total_size: 7.81 GB
free_size: 7.80 GB
create_time: 2022-06-02 15:40:18
modify_time: 2022-06-02 15:40:18
NO.3 name: VOTE
id: 125
au_size: 1.00 MB
extent_size: 4
total_size: 3.91 GB
free_size: 3.88 GB
create_time: 2022-06-02 15:38:49
modify_time: 2022-06-02 15:38:49
NO.4 name: DCR
id: 126
au_size: 1.00 MB
extent_size: 4
total_size: 3.91 GB
free_size: 3.88 GB
create_time: 2022-06-02 15:38:34
modify_time: 2022-06-02 15:38:34
Used time: 2.241(ms).
====================开始初始化数据库实例====================
[1] 15:40:19 [SUCCESS] 192.168.137.191:22
[1] 15:40:20 [SUCCESS] 192.168.137.191:22
[1] 15:40:20 [SUCCESS] 192.168.137.192:22
[1] 15:40:20 [SUCCESS] 192.168.137.192:22
[1] 15:40:20 [SUCCESS] 192.168.137.193:22
[1] 15:40:20 [SUCCESS] 192.168.137.193:22
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2023-03-04
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: +DMLOG/log/DSC1_log01.log
log file path: +DMLOG/log/DSC1_log02.log
log file path: +DMLOG/log/DSC2_log01.log
log file path: +DMLOG/log/DSC2_log02.log
log file path: +DMLOG/log/DSC3_log01.log
log file path: +DMLOG/log/DSC3_log02.log
write to dir [+DMDATA/data/DSC].
create dm database success. 2022-06-02 15:40:29
====================同步数据库实例配置到其他服务器====================
[1] 15:40:30 [SUCCESS] 192.168.137.192:22
[1] 15:40:30 [SUCCESS] 192.168.137.192:22
[1] 15:40:30 [SUCCESS] 192.168.137.192:22
[1] 15:40:30 [SUCCESS] 192.168.137.193:22
[1] 15:40:30 [SUCCESS] 192.168.137.193:22
[1] 15:40:30 [SUCCESS] 192.168.137.193:22
====================重启DMDSC数据库服务====================
[1] 15:40:31 [SUCCESS] 192.168.137.191:22
[1] 15:40:38 [SUCCESS] 192.168.137.191:22
[1] 15:40:53 [SUCCESS] 192.168.137.191:22
[1] 15:40:53 [SUCCESS] 192.168.137.192:22
[1] 15:40:59 [SUCCESS] 192.168.137.192:22
[1] 15:41:14 [SUCCESS] 192.168.137.192:22
[1] 15:41:14 [SUCCESS] 192.168.137.193:22
[1] 15:41:21 [SUCCESS] 192.168.137.193:22
[1] 15:41:37 [SUCCESS] 192.168.137.193:22
====================检查DMDSC集群状态====================
====================开始 CSS、ASM和DB 服务启动后自检====================
SUCCESS 服务器 192.168.137.191 数据库CSS、ASM和DB服务启动完成,耗时:90 秒
Server[LOCALHOST:5236]:mode is normal, state is open
login used time : 6.843(ms)
disql V8
EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
------- ----------- -------------------- -------------------- ------------ ---------
DSC1 0 675756 675828 Control Node OK
DSC2 1 680761 680815 Normal Node OK
DSC3 2 684554 684593 Normal Node OK
====================检查是否已完成达梦数据库的安装====================
已完成核心脚本展示
配置文件
更多资料,请查阅官方网站:https://eco.dameng.com