達夢8MPP叢集(2節點+順序備)linux下部署

站樾007發表於2022-01-26
  1. 安裝前準備

1.1叢集規劃


A機器

B機器

業務IP

192.168.125.148

192.168.125.149

心跳IP

192.168.125.148

192.168.125.149

例項名

MPP1_01

MPP1_02B

MPP1_02

MPP1_01B

例項埠

5236

5237

5236

5237

MAL埠

5336

5337

5336

5337

MAL守護程式埠

5436

5437

5436

5437

守護程式埠

5536

5537

5536

5537

OGUID

45331

45332

45332

45331

守護組

GMPP1_01

GMPP1_02

GMPP1_02

GMPP1_01

安裝目錄

/home/dmdba/dmdbms

例項目錄

/home/dmdba/dmdbms/data/

歸檔上限

51200

確認監視器IP

192.168.125.149

1.2叢集構架


2配置A機器MPP1_01庫

2.1初始化例項

/home/dmdba/dmdbms/bin/dminit PATH=/home/dmdba/dmdbms/data/ DB_NAME=MPP1_01 INSTANCE_NAME=MPP1_01 PORT_NUM=5236 PAGE_SIZE=32 LOG_SIZE=2048

(注:初始化後前臺啟動在關閉才算是完成的初始化)

2.2啟動歸檔、離線備份

啟動歸檔(bin目錄)

./disql SYSDBA/SYSDBA@192.168.125.148:5236

SQL> ALTER DATABASE MOUNT;

SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE ADD ARCHIVELOG 'DEST=/home/dmdba/dmdbms/data/MPP1_01/arch, TYPE=LOCAL, FILE_SIZE=1024, SPACE_LIMIT=51200';

SQL> ALTER DATABASE OPEN;


離線備份

cd /opt/dmdbms/bin

./dmrman

backup database '/home/dmdba/dmdbms/data/MPP1_01/dm.ini' to backup_file_01 backupset '/home/dmdba/dmdbms/data/MPP1_01/bak/backup_file_01'

(注:可以等B機器初始化完成後在拷貝。)

2.3配置dm.ini檔案

PORT_NUM = 5236          #資料庫例項監聽埠,即對外埠,與 dmmal.ini 中 的 MAL_INST_PORT 對應

DW_INACTIVE_INTERVAL = 60  #接收守護程式訊息超時時間

ALTER_MODE_STATUS = 0      #不允許手動方式修改例項模式/狀態/OGUID, 

ENABLE_OFFLINE_TS = 2       #不允許備庫 OFFLINE 表空間

MAL_INI = 1                 #開啟 MAL 系統

ARCH_INI = 1                #開啟歸檔配置

RLOG_SEND_APPLY_MON = 64  #統計最近 64 次的日誌傳送資訊

2.4配置dmarch.ini

ARCH_WAIT_APPLY      = 0        

[ARCHIVE_LOCAL1]

ARCH_TYPE            = LOCAL        

ARCH_DEST            = /home/dmdba/dmdbms/data/MPP1_01/arch        

ARCH_FILE_SIZE       = 1024        

ARCH_SPACE_LIMIT     = 51200        

ARCH_FLUSH_BUF_SIZE  = 0        

[ARCHIVE_REALTIME]

  ARCH_TYPE                = REALTIME  #實時歸檔型別

  ARCH_DEST                = MPP1_01B  #實時歸檔目標例項名

2.5配置dmmal.ini

MAL_CHECK_INTERVAL         = 10  #MAL鏈路檢測時間間隔

MAL_CONN_FAIL_INTERVAL     = 10  #判定MAL鏈路斷開的時間

MAL_TEMP_PATH              = /home/dmdba/dmdbms/data/malpath/MPP1_01/  #臨時檔案目錄

MAL_BUF_SIZE               = 512  #單個MAL快取大小,單位MB

MAL_SYS_BUF_SIZE           = 2048  #MAL總大小限制,單位MB

MAL_COMPRESS_LEVEL         = 0  #MAL訊息壓縮等級,0表示不壓縮


[MAL_INST1]

  MAL_INST_NAME            = MPP1_01  #例項名,和 dm.ini中INSTANCE_NAME一致

  MAL_HOST                 = 192.168.125.148  #MAL系統監聽TCP連線的IP地址

  MAL_PORT                 = 5336  #MAL系統監聽TCP連線的埠

  MAL_INST_HOST            = 192.168.125.148  #例項的對外服務IP地址

  MAL_INST_PORT            = 5236  #例項對外服務埠,和dm.ini中PORT_NUM一致

  MAL_DW_PORT              = 5436  #例項對應的守護程式監聽TCP連線的埠

  MAL_INST_DW_PORT         = 5536  #例項監聽守護程式TCP連線的埠

[MAL_INST2]

  MAL_INST_NAME            = MPP1_01B

  MAL_HOST                 = 192.168.125.149

  MAL_PORT                 = 5337

  MAL_INST_HOST            = 192.168.125.149

  MAL_INST_PORT            = 5237

  MAL_DW_PORT              = 5437

  MAL_INST_DW_PORT         = 5537

[MAL_INST3]

  MAL_INST_NAME            = MPP1_02

  MAL_HOST                 = 192.168.125.149

  MAL_PORT                 = 5336

  MAL_INST_HOST            = 192.168.125.149

  MAL_INST_PORT            = 5236

  MAL_DW_PORT              = 5436

  MAL_INST_DW_PORT         = 5536

[MAL_INST4]

  MAL_INST_NAME            = MPP1_02B

  MAL_HOST                 = 192.168.125.148

  MAL_PORT                 = 5337

  MAL_INST_HOST            = 192.168.125.148

  MAL_INST_PORT            = 5237

  MAL_DW_PORT              = 5437

  MAL_INST_DW_PORT         = 5537


2.6配置dmmpp.ini

ARCH_WAIT_APPLY      = 0        

[ARCHIVE_LOCAL1]

ARCH_TYPE            = LOCAL        

ARCH_DEST            = /home/dmdba/dmdbms/data/MPP1_01/arch        

ARCH_FILE_SIZE       = 1024        

ARCH_SPACE_LIMIT     = 51200        

ARCH_FLUSH_BUF_SIZE  = 0        

[ARCHIVE_REALTIME]

  ARCH_TYPE                = REALTIME  #實時歸檔型別

  ARCH_DEST                = MPP1_01B  #實時歸檔目標例項名

2.7配置dmmpp.ctl

/home/dmdba/dmdbms/bin/dmctlcvt t2c /home/dmdba/dmdbms/data/MPP1_01/dmmpp.ini /home/dmdba/dmdbms/data/MPP1_01/dmmpp.ctl

2.8配置dmwatcher.ini

[GMPP1_01]

  DW_TYPE                  = GLOBAL  #全域性守護型別

  DW_MODE                  = MANUAL  #故障手動切換模式

  DW_ERROR_TIME            = 20  #遠端守護程式故障認定時間

  INST_ERROR_TIME          = 20  #本地例項故障認定時間

  INST_RECOVER_TIME        = 60  #主庫守護程式啟動恢復的間隔時間

  INST_OGUID               = 45331  #守護系統唯一OGUID值

  INST_INI                 = /home/dmdba/dmdbms/data/MPP1_01/dm.ini  #dm.ini檔案路徑

  INST_AUTO_RESTART        = 1  #開啟例項的自動啟動功能

  INST_STARTUP_CMD         = /home/dmdba/dmdbms/bin/dmserver  #命令列方式啟動

  RLOG_SEND_THRESHOLD      = 0  #指定主庫傳送日誌到備庫的時間閾值,預設關閉

  RLOG_APPLY_THRESHOLD     = 0  #指定備庫重演日誌的時間閾值,預設關閉

[GMPP1_02]

  DW_TYPE                  = GLOBAL

  DW_MODE                  = MANUAL

  DW_ERROR_TIME            = 20

  INST_ERROR_TIME          = 20

  INST_RECOVER_TIME        = 60

  INST_OGUID               = 45332

  INST_INI                 = /home/dmdba/dmdbms/data/MPP1_02/dm.ini

  INST_AUTO_RESTART        = 1

  INST_STARTUP_CMD         = /home/dmdba/dmdbms/bin/dmserver

  RLOG_SEND_THRESHOLD      = 0

  RLOG_APPLY_THRESHOLD     = 0


2.9拷貝例項

scp -r /home/dmdba/dmdbms/data/MPP1_01/  dmdba@192.168.125.149:/home/dmdba/dmdbms/data/

(注:MPP1_01後面一定要有/)


2.10註冊服務

註冊例項服務

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -p MPP1_01 -dm_ini /home/dmdba/dmdbms/data/MPP1_01/dm.ini -m mount

註冊守護服務

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -p MPP1_01 -watcher_ini /home/dmdba/dmdbms/data/MPP1_01/dmwatcher.ini

3配置B機器MPP1_02庫

3.1初始化例項

/home/dmdba/dmdbms/bin/dminit PATH=/home/dmdba/dmdbms/data/ DB_NAME=MPP1_01 INSTANCE_NAME=MPP1_01 PORT_NUM=5236 PAGE_SIZE=32 LOG_SIZE=2048

(注:初始化後前臺啟動在關閉才算是完成的初始化)

3.2啟動歸檔、離線備份

啟動歸檔(bin目錄)

./disql SYSDBA/SYSDBA@192.168.125.148:5236

SQL> ALTER DATABASE MOUNT;

SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE ADD ARCHIVELOG 'DEST=/home/dmdba/dmdbms/data/MPP1_01/arch, TYPE=LOCAL, FILE_SIZE=1024, SPACE_LIMIT=51200';

SQL> ALTER DATABASE OPEN;


離線備份

cd /opt/dmdbms/bin

./dmrman

backup database '/home/dmdba/dmdbms/data/MPP1_01/dm.ini' to backup_file_01 backupset '/home/dmdba/dmdbms/data/MPP1_01/bak/backup_file_01'

(注:可以等B機器初始化完成後在拷貝。)

3.3配置dm.ini檔案

PORT_NUM = 5236          #資料庫例項監聽埠,即對外埠,與 dmmal.ini 中 的 MAL_INST_PORT 對應

DW_INACTIVE_INTERVAL = 60  #接收守護程式訊息超時時間

ALTER_MODE_STATUS = 0      #不允許手動方式修改例項模式/狀態/OGUID, 

ENABLE_OFFLINE_TS = 2       #不允許備庫 OFFLINE 表空間

MAL_INI = 1                 #開啟 MAL 系統

ARCH_INI = 1                #開啟歸檔配置

RLOG_SEND_APPLY_MON = 64  #統計最近 64 次的日誌傳送資訊

3.4配置dmarch.ini

ARCH_WAIT_APPLY      = 0        

[ARCHIVE_LOCAL1]

ARCH_TYPE            = LOCAL        

ARCH_DEST            = /home/dmdba/dmdbms/data/MPP1_02/arch        

ARCH_FILE_SIZE       = 1024        

ARCH_SPACE_LIMIT     = 51200        

ARCH_FLUSH_BUF_SIZE  = 0        

[ARCHIVE_REALTIME]

  ARCH_TYPE                = REALTIME  #實時歸檔型別

  ARCH_DEST                = MPP1_02B  #實時歸檔目標例項名

3.5配置dmmal.ini

MAL_CHECK_INTERVAL         = 10  #MAL鏈路檢測時間間隔

MAL_CONN_FAIL_INTERVAL     = 10  #判定MAL鏈路斷開的時間

MAL_TEMP_PATH              = /home/dmdba/dmdbms/data/malpath/MPP1_01/  #臨時檔案目錄

MAL_BUF_SIZE               = 512  #單個MAL快取大小,單位MB

MAL_SYS_BUF_SIZE           = 2048  #MAL總大小限制,單位MB

MAL_COMPRESS_LEVEL         = 0  #MAL訊息壓縮等級,0表示不壓縮


[MAL_INST1]

  MAL_INST_NAME            = MPP1_01  #例項名,和 dm.ini中INSTANCE_NAME一致

  MAL_HOST                 = 192.168.125.148  #MAL系統監聽TCP連線的IP地址

  MAL_PORT                 = 5336  #MAL系統監聽TCP連線的埠

  MAL_INST_HOST            = 192.168.125.148  #例項的對外服務IP地址

  MAL_INST_PORT            = 5236  #例項對外服務埠,和dm.ini中PORT_NUM一致

  MAL_DW_PORT              = 5436  #例項對應的守護程式監聽TCP連線的埠

  MAL_INST_DW_PORT         = 5536  #例項監聽守護程式TCP連線的埠

[MAL_INST2]

  MAL_INST_NAME            = MPP1_01B

  MAL_HOST                 = 192.168.125.149

  MAL_PORT                 = 5337

  MAL_INST_HOST            = 192.168.125.149

  MAL_INST_PORT            = 5237

  MAL_DW_PORT              = 5437

  MAL_INST_DW_PORT         = 5537

[MAL_INST3]

  MAL_INST_NAME            = MPP1_02

  MAL_HOST                 = 192.168.125.149

  MAL_PORT                 = 5336

  MAL_INST_HOST            = 192.168.125.149

  MAL_INST_PORT            = 5236

  MAL_DW_PORT              = 5436

  MAL_INST_DW_PORT         = 5536

[MAL_INST4]

  MAL_INST_NAME            = MPP1_02B

  MAL_HOST                 = 192.168.125.148

  MAL_PORT                 = 5337

  MAL_INST_HOST            = 192.168.125.148

  MAL_INST_PORT            = 5237

  MAL_DW_PORT              = 5437

  MAL_INST_DW_PORT         = 5537


3.6配置dmmpp.ini

[service_name1]

  mpp_seq_no               = 0

  mpp_inst_name            = MPP1_01

[service_name2]

  mpp_seq_no               = 1

  mpp_inst_name            = MPP1_02


3.7配置dmmpp.ctl

/home/dmdbms/bin/dmctlcvt t2c /opt/dmdbms/data/MPP1_02/dmmpp.ini /home/dmdba/dmdbms/data/MPP1_02/dmmpp.ctl

3.8配置dmwatcher.ini

[GMPP1_01]

  DW_TYPE                  = GLOBAL  #全域性守護型別

  DW_MODE                  = MANUAL  #故障手動切換模式

  DW_ERROR_TIME            = 20  #遠端守護程式故障認定時間

  INST_ERROR_TIME          = 20  #本地例項故障認定時間

  INST_RECOVER_TIME        = 60  #主庫守護程式啟動恢復的間隔時間

  INST_OGUID               = 45331  #守護系統唯一OGUID值

  INST_INI                 = /home/dmdba/dmdbms/data/MPP1_01/dm.ini  #dm.ini檔案路徑

  INST_AUTO_RESTART        = 1  #開啟例項的自動啟動功能

  INST_STARTUP_CMD         = /home/dmdba/dmdbms/bin/dmserver  #命令列方式啟動

  RLOG_SEND_THRESHOLD      = 0  #指定主庫傳送日誌到備庫的時間閾值,預設關閉

  RLOG_APPLY_THRESHOLD     = 0  #指定備庫重演日誌的時間閾值,預設關閉

[GMPP1_02]

  DW_TYPE                  = GLOBAL

  DW_MODE                  = MANUAL

  DW_ERROR_TIME            = 20

  INST_ERROR_TIME          = 20

  INST_RECOVER_TIME        = 60

  INST_OGUID               = 45332

  INST_INI                 = /home/dmdba/dmdbms/data/MPP1_02/dm.ini

  INST_AUTO_RESTART        = 1

  INST_STARTUP_CMD         = /home/dmdba/dmdbms/bin/dmserver

  RLOG_SEND_THRESHOLD      = 0

  RLOG_APPLY_THRESHOLD     = 0

3.9拷貝例項

scp -r /home/dmdba/dmdbms/data/MPP1_02/ dmdba@192.168.125.148:/home/dmdba/dmdbms/data/

3.10註冊服務

註冊例項服務

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -p MPP1_02 -dm_ini /home/dmdba/dmdbms/data/MPP1_02/dm.ini -m mount

註冊守護服務

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -p MPP1_02 -watcher_ini /home/dmdba/dmdbms/data/MPP1_02/dmwatcher.ini

4配置B機器MPP1_01B

4.1配置dm.ini

vi /opt/dmdbms/data/MPP1_01/dm.ini

INSTANCE_NAME              = MPP1_01B  #資料庫例項名

PORT_NUM                   = 5237  #資料庫例項監聽埠

4.2配置dmarch.ini

ARCH_WAIT_APPLY      = 0        

[ARCHIVE_LOCAL1]

ARCH_TYPE            = LOCAL        

ARCH_DEST            = /home/dmdba/dmdbms/data/MPP1_01/arch        

ARCH_FILE_SIZE       = 1024        

ARCH_SPACE_LIMIT     = 51200        

ARCH_FLUSH_BUF_SIZE  = 0        

[ARCHIVE_REALTIME]

  ARCH_TYPE                = REALTIME  #實時歸檔型別

  ARCH_DEST                = MPP1_01  #實時歸檔目標例項名

4.3相同配置檔案

包括dmmal.ini、dmmpp.ini、dmmpp.ctl,MPP1_01B和MPP1_01相同。

4.4註冊服務

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -p MPP1_01B -dm_ini /home/dmdba/dmdbms/data/MPP1_01/dm.ini -m mount

4.5離線資料庫還原與恢復

還原

restore database '/home/dmdba/dmdbms/data/MPP1_01/dm.ini' from backupset '/home/dmdba/dmdbms/data/MPP1_01/bak/backup_file_01'

恢復

recover database '/home/dmdba/dmdbms/data/MPP1_01/dm.ini' from backupset '/home/dmdba/dmdbms/data/MPP1_01/bak/backup_file_01'

更新

recover database '/home/dmdba/dmdbms/data/MPP1_01/dm.ini' update db_magic

5配置A機器MPP1_02B

5.1配置dm.ini

vi /home/dmdba/dmdbms/data/MPP1_02/dm.ini

INSTANCE_NAME              = MPP1_02B  #資料庫例項名

PORT_NUM                   = 5237  #資料庫例項監聽埠

5.2配置dmarch.ini

ARCH_WAIT_APPLY      = 0        

[ARCHIVE_LOCAL1]

ARCH_TYPE            = LOCAL        

ARCH_DEST            = /home/dmdba/dmdbms/data/MPP1_02/arch        

ARCH_FILE_SIZE       = 1024        

ARCH_SPACE_LIMIT     = 51200        

ARCH_FLUSH_BUF_SIZE  = 0        

[ARCHIVE_REALTIME]

  ARCH_TYPE                = REALTIME  #實時歸檔型別

  ARCH_DEST                = MPP1_02  #實時歸檔目標例項名

5.3相同配置檔案

包括dmmal.ini、dmmpp.ini、dmmpp.ctl,MPP1_01B和MPP1_01相同。


5.4註冊服務

/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -p MPP1_02B -dm_ini /home/dmdba/dmdbms/data/MPP1_02/dm.ini -m mount


5.5離線資料庫還原與恢復

還原

restore database '/home/dmdba/dmdbms/data/MPP1_02/dm.ini' from backupset '/home/dmdba/dmdbms/data/MPP1_02/bak/backup_file_02'

恢復

recover database '/home/dmdba/dmdbms/data/MPP1_02/dm.ini' from backupset '/home/dmdba/dmdbms/data/MPP1_02/bak/backup_file_02'

更新

recover database '/home/dmdba/dmdbms/data/MPP1_02/dm.ini' update db_magic

6配置監視器

這裡註冊非確認監視器,這裡在B機器上的bin目錄下建立dmmonitor.ini檔案

6.1配置dmmonitor.ini

MON_DW_CONFIRM             = 0  #0為非確認,1為確認

MON_LOG_PATH               = ../log  #監視器日誌檔案存放路徑

MON_LOG_INTERVAL           = 60  #每隔 60s 定時記錄系統資訊到日誌檔案

MON_LOG_FILE_SIZE          = 512  #單個日誌大小,單位MB

MON_LOG_SPACE_LIMIT        = 2048  #日誌上限,單位MB


[GMPP1_01]

  MON_INST_OGUID           = 45331  #組GMPP1_01的唯一OGUID 值

  MON_DW_IP                = 192.168.125.148:5436  #IP對應MAL_HOST,PORT對應MAL_DW_PORT

  MON_DW_IP                = 192.168.125.149:5437

[GMPP1_02]

  MON_INST_OGUID           = 45332  #組GMPP1_02的唯一OGUID 值

  MON_DW_IP                = 192.168.125.149:5436

  MON_DW_IP                = 192.168.125.148:5437

7啟動例項服務並修改引數

7.1啟動例項服務

這裡啟動所有例項服務(按順序)

/home/dmdba/dmdbms/bin/DmServiceMPP1_01 start

/home/dmdba/dmdbms/bin/DmServiceMPP1_02 start

/home/dmdba/dmdbms/bin/DmServiceMPP1_01B start

/home/dmdba/dmdbms/bin/DmServiceMPP1_02B start

7.2修改引數

A機器-MPP1_01

/home/dmdba/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.125.148:5236

SQL> SP_SET_OGUID(45331);

SQL> ALTER DATABASE PRIMARY;


B機器-MPP1_02

/home/dmdba/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.125.149:5236

SQL> SP_SET_OGUID(45332);

SQL> ALTER DATABASE PRIMARY;


A機器-MPP1_02B

/home/dmdba/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.125.148:5237

SQL> SP_SET_OGUID(45332);

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);

SQL> ALTER DATABASE STANDBY;

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);


B機器-MPP1_01B

/home/dmdba/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.125.149:5237

SQL> SP_SET_OGUID(45331);

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);

SQL> ALTER DATABASE STANDBY;

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);

8啟動守護程式

A機器

/home/dmdba/dmdbms/bin/DmWatcherServiceMPP1_01 start

B機器

/home/dmdba/dmdbms/bin/DmWatcherServiceMPP1_02 start

9啟動監視器

由於非確認監視器配置在了B機器,這裡前臺啟動

/home/dmdba/dmdbms/bin/dmmonitor /home/dmdba/dmdbms/bin/dmmonitor.ini

10啟停叢集順序

啟動

A機器: /home/dmdba/dmdbms/bin/DmWatcherServiceMPP1_01 start

B機器: /home/dmdba/dmdbms/bin/DmWatcherServiceMPP1_02 start


停止

A機器: /home/dmdba/dmdbms/bin/DmWatcherServiceMPP1_01 stop

B機器: /home/dmdba/dmdbms/bin/DmWatcherServiceMPP1_02 stop

A機器: /home/dmdba/dmdbms/bin/DmServiceMPP1_01 stop

B機器: /home/dmdba/dmdbms/bin/DmServiceMPP1_02 stop

B機器: /home/dmdba/dmdbms/bin/DmServiceMPP1_01B stop

A機器: /home/dmdba/dmdbms/bin/DmServiceMPP1_02B stop


社群地址:


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70013380/viewspace-2854130/,如需轉載,請註明出處,否則將追究法律責任。

相關文章