前言
達夢DMDSC共享存盤集群是達夢資料庫的高可用技術,可以實作資料庫的負載均衡和故障切換等功能,一個資料庫可以對應多個實體,

一、配置資訊
1.1IP規劃
| 主機名 | 公網IP | 私網IP |
|---|---|---|
| DM8-H1 | 192.168.3.171 | 10.10.10.1 |
| DM8-H2 | 192.168.3.172 | 10.10.10.2 |
1.2磁盤組規劃
| 磁盤 | 大小 | 用途 |
|---|---|---|
| dcr01 | 1g | dcr disk |
| vote01 | 1g | vote disk |
| redo01 | 10g | log disk |
| data01 | 50g | data disk |
| data02 | 50g | data disk |
二、作業系統安裝
note:安裝很簡單,快速帶過









在這里插入圖片描述



三、作業系統配置
3.1依賴包安裝
note:安裝相關gcc開發環境
yum install -y gcc glibc* glibc-devel* libgcc* unixODBC
3.2關閉SElinux
note:中標麒麟默認安裝是關閉狀態
vi /etc/selinux/config
……
SELINUX=disabled
……
3.3關閉防火墻
systemctl stop firewalld
systemctl disable firewalld
3.4修改主機名
vi /etc/hostname
dm8-h1
3.5配置hosts檔案
vi /etc/hosts
192.168.3.171 dm8-h1
192.168.3.172 dm8-h2
3.6創建用戶
groupadd dinstall
useradd -g dinstall dmdba
passwd dmdba
3.7創建目錄
mkdir -p /opt/dm8/dmdbms
chown dmdba.dinstall -R /opt/dm8
chmod 775 -R /opt/dm8
3.8配置環境變數
vi .bash_profile
export DM_HOME=/opt/dm8/dmdbms
export LD_LIBRARY_PATH=$DM_HOME/bin:$LD_LIBRARY_PATH
export PATH=$DM_HOME/bin:$PATH
3.9配置資源限制
vi /etc/security/limits.conf
dmdba hard nofile 65536
dmdba soft nofile 65536
dmdba hard stack 32768
dmdba soft stack 16384
3.10系結裸設備
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdb", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdf", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="raw[1-5]", OWNER="dmdba", GROUP="dinstall", MODE="660"
重啟udev
systemctl restart systemd-udev-trigger.service
查看大小,單位位元組
blockdev --getsize64 /dev/raw/raw1
四、DM軟體安裝
命令列安裝
[dmdba@dm8-h1 ~]$ ./DMInstall.bin -i
Please select the installer's language (E/e:English C/c:Chinese) [E/e]:
Extract install files.........
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31835
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
The max number of open files is too little, suggest to set 65536 or more to number of open files.
Welcome to DM DBMS Installer
Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:
Please Input the Path of the Key File [dm.key]:
Please input the path of key file!
Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:n
Whether to Set The TimeZone? (Y/y:Yes N/n:No) [Y/y]:
TimeZone:
[ 1]: GTM-12=West Date Line
[ 2]: GTM-11=Samoa
[ 3]: GTM-10=Hawaii
[ 4]: GTM-09=Alaska
[ 5]: GTM-08=Pacific(America and Canada)
[ 6]: GTM-07=Arizona
[ 7]: GTM-06=Central(America and Canada)
[ 8]: GTM-05=East(America and Canada)
[ 9]: GTM-04=Atlantic(America and Canada)
[11]: GTM-02=Middle Atlantic
[13]: GTM=Greenwich Mean Time
Please Select the TimeZone [21]:
Installation Type:
1 Typical
2 Server
3 Client
4 Custom
Please Input the number of the Installation Type [1 Typical]:4
1 Server component
2 Client component
2.1 Manager
2.2 Monitor
2.3 DTS
2.4 Console
2.5 Analyzer
2.6 DISQL
3 DM Drivers
4 Manual component
5 DBMS Service
5.1 Realtime Audit Service
5.2 Job Service
5.3 Instance Monitor Service
5.4 Assistant Plug-In Service
Please Input the number of the Installation Type [1 2 3 4 5]:
Require Space: 1075M
Please Input the install path [/home/dmdba/dmdbms]:/opt/dm8/dmdbms
Available Space:85G
Please Confirm the install path(/opt/dm8/dmdbms)? (Y/y:Yes N/n:No) [Y/y]:
Pre-Installation Summary
Installation Location: /opt/dm8/dmdbms
Require Space: 1075M
Available Space: 85G
Version Information:
Expire Date:
Installation Type: Custom
Confirm to Install? (Y/y:Yes N/n:No):y
2021-02-26 12:10:53
[INFO] Installing DM DBMS...
2021-02-26 12:10:54
[INFO] Installing BASE Module...
2021-02-26 12:10:57
[INFO] Installing SERVER Module...
2021-02-26 12:10:57
[INFO] Installing CLIENT Module...
2021-02-26 12:10:59
[INFO] Installing DRIVERS Module...
2021-02-26 12:10:59
[INFO] Installing MANUAL Module...
2021-02-26 12:10:59
[INFO] Installing SERVICE Module...
2021-02-26 12:11:01
[INFO] Move ant log file to log directory.
2021-02-26 12:11:02
[INFO] Installed DM DBMS completely.
Please execute the commands by root:
/opt/dm8/dmdbms/script/root/root_installer.sh
End
運行root腳本
[root@dm8-h1 ~]# /opt/dm8/dmdbms/script/root/root_installer.sh
Move /opt/dm8/dmdbms/bin/dm_svc.conf to /etc
Modify the files' mode of DM Server
五、配置DMASM
5.1配置dmdcr_cfg.ini檔案
創建目錄
mkdir /opt/dm8/dmdbms/data
編輯組態檔
vi /opt/dm8/dmdbms/data/dmdcr_cfg.ini
DCR_N_GRP = 3
DCR_VTD_PATH = /dev/raw/raw2
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.10.10.1
DCR_EP_PORT = 9541
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 10.10.10.2
DCR_EP_PORT = 9542
[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 = 10
DCR_EP_HOST = 10.10.10.1
DCR_EP_PORT = 9641
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP_ASM]
DCR_EP_NAME = ASM1
DCR_EP_SHM_KEY = 93361
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.10.10.2
DCR_EP_PORT = 9642
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 = 5236
DCR_CHECK_PORT = 9741
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9742
5.2磁盤初始化
[dmdba@dm8-h1 data]$ dmasmcmd
DMASMCMD V8
ASM>create dcrdisk '/dev/raw/raw1' 'dcr01'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr01
Used time: 29.813(ms).
ASM>create votedisk '/dev/raw/raw2' 'vote01'
create asmdisk '/dev/raw/raw3' 'REDO01'
create asmdisk '/dev/raw/raw4' 'DATA01'
create asmdisk '/dev/raw/raw5' 'DATA02'[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote01
Used time: 87.007(ms).
ASM>[Trace]The ASM initialize asmdisk /dev/raw/raw3 to name DMASMREDO01
Used time: 471.858(ms).
ASM>[Trace]The ASM initialize asmdisk /dev/raw/raw4 to name DMASMDATA01
Used time: 58.995(ms).
ASM>
[Trace]The ASM initialize asmdisk /dev/raw/raw5 to name DMASMDATA02
Used time: 34.306(ms).
ASM>
ASM>init dcrdisk '/dev/raw/raw1' from '/opt/dm8/dmdbms/data/dmdcr_cfg.ini' identified by 'dm1234'
[Trace]DG 126 allocate 4 extents for file 0xfe000002.
Used time: 00:00:01.071.
ASM>
ASM>init votedisk '/dev/raw/raw2' from '/opt/dm8/dmdbms/data/dmdcr_cfg.ini'
[Trace]DG 125 allocate 4 extents for file 0xfd000002.
Used time: 431.918(ms).
ASM>
5.3配置dmasvrmal.ini檔案
note:所有節點配置
vi /opt/dm8/dmdbms/data/dmasvrmal.ini
------------------------------------------------------------------
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 10.10.10.1
MAL_PORT = 7236
[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 10.10.10.2
MAL_PORT = 7237
5.4配置dmdcr.ini檔案
note:每個節點的序號需要改變
節點一:
vi /opt/dm8/dmdbms/data/dmdcr.ini
-------------------------------------------------------------------------------
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/opt/dm8/dmdbms/data/dmasvrmal.ini
DMDCR_SEQNO = 0
##ASM
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /opt/dm8/dmdbms/bin/dmasmsvr dcr_ini=/opt/dm8/dmdbms/data/dmdcr.ini
##DB
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /opt/dm8/dmdbms/bin/dmserver path=/opt/dm8/dmdbms/data/dsc0_config/dm.ini
節點二:
vi /opt/dm8/dmdbms/data/dmdcr.ini
-------------------------------------------------------------------------------
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/opt/dm8/dmdbms/data/dmasvrmal.ini
DMDCR_SEQNO = 1
##ASM
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /opt/dm8/dmdbms/bin/dmasmsvr dcr_ini=/opt/dm8/dmdbms/data/dmdcr.ini
##DB
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /opt/dm8/dmdbms/bin/dmserver path=/opt/dm8/dmdbms/data/dsc1_config/dm.ini
5.5配置DMCSS和DMASM服務
注冊DMCSS服務
[root@dm8-h1 root]# /opt/dm8/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /opt/dm8/dmdbms/data/dmdcr.ini -p dsc1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicedsc1.service to /usr/lib/systemd/system/DmCSSServicedsc1.service.
Finished to create the service (DmCSSServicedsc1)
[root@dm8-h1 root]# systemctl status DmCSSServicedsc1.service
● DmCSSServicedsc1.service - Dameng CSS Service(DmCSSServicedsc1).
Loaded: loaded (/usr/lib/systemd/system/DmCSSServicedsc1.service; enabled; vendor preset: disabled)
Active: inactive (dead)
啟動DMCSS服務
systemctl start DmCSSServicedsc1.service
注冊DMASM服務
[root@dm8-h1 root]# /opt/dm8/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /opt/dm8/dmdbms/data/dmdcr.ini -p dsc1 -y DmCSSServicedsc1.service
Created symlink from /etc/systemd/system/multi-user.target.wants/DmASMSvrServicedsc1.service to /usr/lib/systemd/system/DmASMSvrServicedsc1.service.
Finished to create the service (DmASMSvrServicedsc1)
[root@dm8-h1 root]# systemctl status DmASMSvrServicedsc1.service
● DmASMSvrServicedsc1.service - Dameng ASM Server Service(DmASMSvrServicedsc1).
Loaded: loaded (/usr/lib/systemd/system/DmASMSvrServicedsc1.service; enabled; vendor preset: disabled)
Active: inactive (dead)
[root@dm8-h1 root]#
啟動DMASM服務
systemctl start DmASMSvrServicedsc1.service
5.7創建DASM磁盤組
note:dmasm服務啟動正常,即可創建磁盤組
dmasmtool DCR_INI=/opt/dm8/dmdbms/data/dmdcr.ini
create diskgroup 'DMREDO' asmdisk '/dev/raw/raw3'
create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
六、配置資料庫
6.1配置dminit.ini檔案
vi /opt/dm8/dmdbms/data/dminit.ini
-------------------------------------------------------------------------------
db_name = wldb
SYSDBA_PWD = dameng1234
SYSAUDITOR_PWD = dameng1234
system_path = +DMDATA/data
system = +DMDATA/wldb/datafile/system.dbf
system_size = 128
roll = +DMDATA/wldb/datafile/roll.dbf
roll_size = 128
main = +DMDATA/wldb/datafile/main.dbf
main_size = 128
ctl_path = +DMDATA/wldb/datafile/dm.ctl
ctl_size = 8
log_size = 256
dcr_path = /dev/raw/raw1
dcr_seqno = 0
auto_overwrite = 1
[DSC0]
config_path = /opt/dm8/dmdbms/data/dsc0_config
port_num = 5236
mal_host = 10.10.10.1
mal_port = 9340
log_path = +DMREDO/wldb/redolog/dsc0_log01.log
log_path = +DMREDO/wldb/redolog/dsc0_log02.log
[DSC1]
config_path = /opt/dm8/dmdbms/data/dsc1_config
port_num = 5236
mal_host = 10.10.10.2
mal_port = 9341
log_path = +DMREDO/wldb/redolog/dsc1_log01.log
log_path = +DMREDO/wldb/redolog/dsc1_log02.log
6.2初始化資料庫
[dmdba@dm8-h1 data]$ dminit control=/opt/dm8/dmdbms/data/dminit.ini
initdb V8
db version: 0x7000b
file dm.key not found, use default license!
License will expire on 2021-09-04
log file path: +DMREDO/wldb/redolog/dsc0_log01.log
log file path: +DMREDO/wldb/redolog/dsc0_log02.log
log file path: +DMREDO/wldb/redolog/dsc1_log01.log
log file path: +DMREDO/wldb/redolog/dsc1_log02.log
write to dir [+DMDATA/data/wldb].
create dm database success. 2021-03-03 12:19:26
6.3啟動資料庫
注冊服務,所有節點
/opt/dm8/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /opt/dm8/dmdbms/data/dsc0_config/dm.ini -dcr_ini /opt/dm8/dmdbms/data/dmdcr.ini -p dsc1 -y DmASMSvrServicedsc1.service
/opt/dm8/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /opt/dm8/dmdbms/data/dsc1_config/dm.ini -dcr_ini /opt/dm8/dmdbms/data/dmdcr.ini -p dsc2 -y DmASMSvrServicedsc2.service
啟動服務,所有節點
systemctl status DmServicedsc1.service
systemctl start DmServicedsc1.service
6.4故障切換測驗
負載均衡配置
vi /etc/dm_svc.conf
TIME_ZONE=(480)
LANGUAGE=(cn)
DSC=(192.168.3.171:5236,192.168.3.172:5236)
連接測驗
disql SYSDBA/dameng1234@DSC
SQL> select * from v$dsc_ep_info;
LINEID EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1 DSC0 0 1491318494 1491319300 Control Node OK
2 DSC1 1 1491518737 1491519046 Normal Node OK
used time: 11.952(ms). Execute id is 1.
SQL> select instance_name from v$instance;
LINEID INSTANCE_NAME
---------- -------------
1 DSC1
used time: 1.407(ms). Execute id is 2.
模擬故障
[root@dm8-h2 ~]# ps -ef | grep dm.ini
dmdba 15410 1 1 12:40 ? 00:00:05 /opt/dm8/dmdbms/bin/dmserver /opt/dm8/dmdbms/data/dsc1_config/dm.ini DCR_INI=/opt/dm8/dmdbms/data/dmdcr.ini -noconsole
root 15858 8828 0 12:46 pts/0 00:00:00 grep --color=auto dm.ini
[root@dm8-h2 ~]# kill -9 15410
[root@dm8-h2 ~]# systemctl status DmServicedsc2.service
● DmServicedsc2.service - Dameng Database Service(DmServicedsc2).
Loaded: loaded (/usr/lib/systemd/system/DmServicedsc2.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Wed 2021-03-03 12:47:26 CST; 58s ago
Process: 15895 ExecStop=/opt/dm8/dmdbms/bin/DmServicedsc2 stop (code=exited, status=0/SUCCESS)
Process: 15376 ExecStart=/opt/dm8/dmdbms/bin/DmServicedsc2 start (code=exited, status=0/SUCCESS)
Main PID: 15410 (code=killed, signal=KILL)
Mar 03 12:40:43 dm8-h2 systemd[1]: Starting Dameng Database Service(DmServicedsc2)....
Mar 03 12:40:45 dm8-h2 DmServicedsc2[15376]: Starting DmServicedsc2: connnect dmasmtool successfully.
Mar 03 12:41:00 dm8-h2 DmServicedsc2[15376]: [11B blob data]
Mar 03 12:41:00 dm8-h2 systemd[1]: Started Dameng Database Service(DmServicedsc2)..
Mar 03 12:47:26 dm8-h2 systemd[1]: DmServicedsc2.service: main process exited, code=killed, status=9/KILL
Mar 03 12:47:26 dm8-h2 DmServicedsc2[15895]: DmServicedsc2 service is stopped.
Mar 03 12:47:26 dm8-h2 systemd[1]: Unit DmServicedsc2.service entered failed state.
Mar 03 12:47:26 dm8-h2 systemd[1]: DmServicedsc2.service failed.
SQL> select instance_name from v$instance;
[-70065]:Connection exception, switch the current connection sucessful.
Server[192.168.3.171:5236]:mode is normal, state is open
SQL> select instance_name from v$instance;
LINEID INSTANCE_NAME
---------- -------------
1 DSC0
used time: 2.304(ms). Execute id is 597.
SQL> select * from v$dsc_ep_info;
LINEID EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1 DSC0 0 1491318494 1491319467 Control Node OK
2 DSC1 1 1491518737 1491519129 Normal Node ERROR
used time: 5.379(ms). Execute id is 598.
SQL>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/278972.html
標籤:其他
