栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

达梦数据库(DM8)规模化一键自动部署

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

达梦数据库(DM8)规模化一键自动部署

简介

达梦数据库集群,一键部署过程的每一个步骤都自动化,脚本自动化部署,可以带来包括效能在内的显著的好处。你可以手工做这些事情,但是很耗时。二者的生产率差异真的很大。一般部署过程涉及到应用、环境和部署流程主要的模型。要实现自动化首先要做的是将需要部署的应用、环境和流程进行建模,所以还是需要一个自动化部署系统来支撑。

1、配置文件

1.1 服务器互信

1.2 设置操作系统环境

1.3 达梦数据库

1.4 达梦数据守护集群DMDataWatch

1.5 达梦数据共享集群DMDSC

2、核心代码

2.1 服务器互信

2.2 设置操作系统环境

2.3 达梦数据库

2.4 达梦数据守护集群DMDataWatch

1.5 达梦数据共享集群DMDSC

3、安装截图

2.1 服务器互信

2.2 设置操作系统环境

2.3 达梦数据库

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     


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

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

共享磁盘

初始化实例

安装完成后,检查共享集群状态

更多资料,请查阅官方网站:https://eco.dameng.com

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/939243.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号