DM8配置讀寫分離叢集
配置讀寫分離叢集
下列機器事先都安裝了DM,安裝路徑為’/dm8’,執行程式儲存在’/dm8/bin’目錄中,資料存放路徑為’/dm8/data’。
各主備庫的例項名建議採用“組名_守護環境_序號”的方式命名,方便按組區分不同例項,注意總長度不能超過16。本示例中組名為“GRP1”,配置為讀寫分離叢集,主庫命名為“JY1”,備庫分別命名為JY2”和“JY3”。
機器名 IP地址 初始狀態 作業系統 dm8rw1 10.10.13.213(對外) 主庫 jy1 redhat 7.8 10.10.13.213(mal對內) dm8rw2 10.10.13.214(對外) 10.10.13.214(mal對內) 備庫 jy2 redhat 7.8 dm8rw3 10.10.13.215(對外) 10.10.13.215(mal對內) 備庫 jy3 redhat 7.8 dm8rw4 10.10.13.216 確認監視器 redhat 7.8 例項名 port_num mal_inst_dw_port mal_host mal_port mal_dw_port jy1 5236 5237 10.10.13.213 5238 5239 jy2 5236 5237 10.10.13.214 5238 5239 jy3 5236 5237 10.10.13.215 5238 5239
安裝DM資料庫軟體
資料準備
在主庫機器上初始化資料庫到目錄/dm8/data:
[dmdba@dm8rw1 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy1 port_num=5236 page_size=8 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/jy/jy01.log log file path: /dm8/data/jy/jy02.log write to dir [/dm8/data/jy]. create dm database success. 2022-01-18 21:10:20
建立DmAPService用於dmrman來執行備份
主庫
[root@dm8rw1 bin]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService) [root@dm8rw1 bin]# service DmAPService start Redirecting to /bin/systemctl start DmAPService.service
備庫jy2
[root@dm8rw2 bin]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService) [root@dm8rw2 bin]# service DmAPService start Redirecting to /bin/systemctl start DmAPService.service
備庫jy3
[root@dm8rw3 bin]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService) [root@dm8rw3 bin]# service DmAPService start Redirecting to /bin/systemctl start DmAPService.service
註冊服務用於啟動資料庫
[root@dm8rw1 bin]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy1 -t dmserver Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy1.service to /usr/lib/systemd/system/DmServicejy1.service. Finished to create the service (DmServicejy1)
正常啟動資料庫並正常關閉
[root@dm8rw1 bin]# service DmServicejy1 start Redirecting to /bin/systemctl start DmServicejy1.service [dmdba@dm8rw1 jy]$ disql SySDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is open login used time : 4.305(ms) disql V8 SQL> select instance_name from v$instance; LINEID INSTANCE_NAME ---------- ------------- 1 JY1 used time: 5.512(ms). Execute id is 53700. [root@dm8rw1 bin]# service DmServicejy1 stop Redirecting to /bin/systemctl stop DmServicejy1.service
備份主庫
1. 正常關閉資料庫
[root@dm8rw1 bin]# service DmServicejy1 stop Redirecting to /bin/systemctl stop DmServicejy1.service
2.使用dmrman來進行冷備份
[dmdba@dm8rw1 jy]$ dmrman CTLSTMT="backup database '/dm8/data/jy/dm.ini' full backupset '/dm8/jy1_full_bak_1'" dmrman V8 backup database '/dm8/data/jy/dm.ini' full backupset '/dm8/jy1_full_bak_1' 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[26788], file_lsn[26788] Processing backupset /dm8/jy1_full_bak_1 [Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00] backup successfully! time used: 00:00:01.468
將主庫的備份複製備庫:
[dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_1 10.10.13.214:/dm8 dmdba@10.10.13.214's password: jy1_full_bak_1.bak 100% 6334KB 24.8MB/s 00:00 jy1_full_bak_1.meta 100% 77KB 4.2MB/s 00:00 [dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_1 10.10.13.215:/dm8 dmdba@10.10.13.215's password: jy1_full_bak_1.bak 100% 6334KB 10.9MB/s 00:00 jy1_full_bak_1.meta 100% 77KB 1.2MB/s 00:00 [dmdba@dm8rw1 dm8]$
建立備庫備庫並恢復
備庫jy2:
[dmdba@dm8rw2 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy2 port_num=5236 page_size=8 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/jy/jy01.log log file path: /dm8/data/jy/jy02.log write to dir [/dm8/data/jy]. create dm database success. 2022-01-18 21:46:05
備庫jy3:
[dmdba@dm8rw3 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy3 port_num=5236 page_size=8 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/jy/jy01.log log file path: /dm8/data/jy/jy02.log write to dir [/dm8/data/jy]. create dm database success. 2022-01-18 21:46:37
恢復備庫
備庫jy2:
[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'" dmrman V8 restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1' file dm.key not found, use default license! Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL [Percent:100.00%][Speed:0.00M/s][Cost:00:00:05][Remaining:00:00:00] restore successfully. time used: 00:00:05.615 [dmdba@dm8rw2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'" dmrman V8 RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1' 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[26788], file_lsn[26788] no log generates while the backupset [/dm8/jy1_full_bak_1] created recover successfully! time used: 345.359(ms) [dmdba@dm8rw2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC" dmrman V8 RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC 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[26788], file_lsn[26788] recover successfully! time used: 00:00:01.066
備庫jy3:
[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'" dmrman V8 restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1' file dm.key not found, use default license! Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL [Percent:100.00%][Speed:0.00M/s][Cost:00:00:06][Remaining:00:00:00] restore successfully. time used: 00:00:06.606 [dmdba@dm8rw3 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'" dmrman V8 RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1' 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[26788], file_lsn[26788] no log generates while the backupset [/dm8/jy1_full_bak_1] created recover successfully! time used: 323.405(ms) [dmdba@dm8rw3 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC" dmrman V8 RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC 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[26788], file_lsn[26788] recover successfully! time used: 00:00:01.069
配置操作
一.主庫
配置dm.ini檔案,配置以下引數
INSTANCE_NAME = jy1 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini檔案
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = jy1 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.213 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.213 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = jy2 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.214 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.214 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = jy3 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.215 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.215 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8rw1 jy]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = jy1 MAL_HOST = 10.10.13.213 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.213 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = jy2 MAL_HOST = 10.10.13.214 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.214 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = jy3 MAL_HOST = 10.10.13.215 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.215 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名。當前例項jy1是主庫,需要向即時備庫jy2/jy3同步資料,因此即時歸檔的ARCH_DEST分別配置為jy2和jy3。
[ARCHIVE_TIMELY1] ARCH_TYPE = TIMELY #即時歸檔型別 ARCH_DEST = jy2 #即時歸檔目標例項名 [ARCHIVE_TIMELY2] ARCH_TYPE = TIMELY #即時歸檔型別 ARCH_DEST = jy3 #即時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL #本地歸檔型別 ARCH_DEST = /dm8/arch #本地歸檔檔案存放路徑 ARCH_FILE_SIZE = 128 #單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 #單位Mb,0表示無限制,範圍1024~4294967294M [dmdba@dm8rw1 jy]$ vi dmarch.ini [ARCHIVE_TIMELY1] ARCH_TYPE = TIMELY ARCH_DEST = jy2 [ARCHIVE_TIMELY2] ARCH_TYPE = TIMELY ARCH_DEST = jy3 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP1] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 222222 #守護系統唯一OGUID值 INST_INI = /dm8/data/jy/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8rw1 jy]$ vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 222222 INST_INI = /dm8/data/jy/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
配置備庫jy2
配置dm.ini檔案,配置以下引數
INSTANCE_NAME = jy2 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini檔案
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = jy1 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.213 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.213 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = jy2 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.214 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.214 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = jy3 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.215 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.215 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8rw2 jy]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = jy1 MAL_HOST = 10.10.13.213 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.213 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = jy2 MAL_HOST = 10.10.13.214 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.214 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = jy3 MAL_HOST = 10.10.13.215 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.215 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名
當前例項jy2是備庫,守護系統配置完成後,可能在各種故障處理中,jy2切換為新的主庫,正常情況下,jy1會切換為新的備庫,需要向jy1和jy3同步資料,因此即時歸檔的ARCH_DEST分別配置為jy1和jy3。
[dmdba@dm8rw2 jy]$ vi dmarch.ini [ARCHIVE_TIMELY1] ARCH_TYPE = TIMELY ARCH_DEST = jy1 [ARCHIVE_TIMELY2] ARCH_TYPE = TIMELY ARCH_DEST = jy3 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP1] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 222222 #守護系統唯一OGUID值 INST_INI = /dm8/data/jy/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8rw2 jy]$ vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 222222 INST_INI = /dm8/data/jy/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
配置備庫jy3
配置dm.ini檔案,配置以下引數
INSTANCE_NAME = jy3 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini檔案
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = jy1 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.213 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.213 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = jy2 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.214 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.214 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = jy3 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.215 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.215 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8rw3 jy]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = jy1 MAL_HOST = 10.10.13.213 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.213 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = jy2 MAL_HOST = 10.10.13.214 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.214 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = jy3 MAL_HOST = 10.10.13.215 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.215 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名
當前例項jy3是備庫,守護系統配置完成後,可能在各種故障處理中,jy3切換為新的主庫,正常情況下,jy1會切換為新的備庫,需要向jy1和jy2同步資料,因此即時歸檔的ARCH_DEST分別配置為jy1和jy2。
[dmdba@dm215 jy]$ vi dmarch.ini [ARCHIVE_TIMELY1] ARCH_TYPE = TIMELY ARCH_DEST = jy1 [ARCHIVE_TIMELY2] ARCH_TYPE = TIMELY ARCH_DEST = jy2 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP1] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 222222 #守護系統唯一OGUID值 INST_INI = /dm8/data/jy/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8rw3 jy]$ vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 222222 INST_INI = /dm8/data/jy/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
二:
主庫啟動到mount狀態設定oguid
[dmdba@dm8rw1 ~]$ dmserver /dm8/data/jy/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 file lsn: 25300 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. [dmdba@dm8rw1 jy]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 3.177(ms) disql V8 SQL> sp_set_oguid(222222); DMSQL executed successfully used time: 66.753(ms). Execute id is 0. SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 26788 26788 used time: 3.112(ms). Execute id is 1. SQL> select permanent_magic; LINEID PERMANENT_MAGIC ---------- --------------- 1 518889968 used time: 1.941(ms). Execute id is 2.
備庫jy2啟動到mount狀態設定oguid
[dmdba@dm8rw2 ~]$ dmserver /dm8/data/jy/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 file lsn: 26788 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. [dmdba@dm8rw2 jy]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 5.278(ms) disql V8 SQL> sp_set_oguid(222222); DMSQL executed successfully used time: 114.383(ms). Execute id is 0. SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 26788 26788 used time: 19.022(ms). Execute id is 1. SQL> select permanent_magic; LINEID PERMANENT_MAGIC ---------- --------------- 1 518889968 used time: 1.356(ms). Execute id is 2.
備庫jy3啟動到mount狀態設定oguid
[dmdba@dm8rw3 ~]$ dmserver /dm8/data/jy/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 file lsn: 26788 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. [dmdba@dm8rw3 jy]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 5.145(ms) disql V8 SQL> sp_set_oguid(222222); DMSQL executed successfully used time: 110.938(ms). Execute id is 0. SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 26788 26788 used time: 14.513(ms). Execute id is 1. SQL> select permanent_magic; LINEID PERMANENT_MAGIC ---------- --------------- 1 518889968 used time: 1.549(ms). Execute id is 2.
備庫jy2註冊服務用於啟動資料庫
[root@dm8rw2 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy2 -t dmserver Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy2.service to /usr/lib/systemd/system/DmServicejy2.service. Finished to create the service (DmServicejy2)
備庫jy3註冊服務用於啟動資料庫
[root@dm8rw3 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy3 -t dmserver Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy3.service to /usr/lib/systemd/system/DmServicejy3.service. Finished to create the service (DmServicejy3)
三:
主庫以primary開啟
[dmdba@dm8rw1 jy]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 2.961(ms) disql V8 SQL> alter database primary; executed successfully used time: 58.207(ms). Execute id is 0.
備庫jy2以standby 開啟
[dmdba@dm8rw2 jy]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 2.221(ms) disql V8 SQL> alter database standby; executed successfully used time: 145.716(ms). Execute id is 0.
備庫jy3以standby 開啟
[dmdba@dm8rw3 jy]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 2.978(ms) disql V8 SQL> alter database standby; executed successfully used time: 72.982(ms). Execute id is 0.
啟動命令列工具DIsql,登入備庫修改資料庫為Standby模式如果當前資料庫不是normal模式,需要先修改dm.ini中ALTER_MODE_STATUS值為1,允許修改資料庫模式,修改Standby模式成功後再改回為0。如果是normal模式,請忽略下面的第1步和第3步。
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); ----第1步 SQL>alter database standby; ----第2步 SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0); ----第3步
四:
啟動守護程式
啟動各個主備庫上的守護程式:
主庫
[dmdba@dm8rw1 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini DMWATCHER[4.0] V8 DMWATCHER[4.0] IS READY show 2022-01-18 22:23:19 --------------------------------------------------------------------------- GROUP_NAME TYPE MODE OGUID MPP_FLAG AUTO_RESTART DW_STATUS DW_SUB_STATUS DW_CTL_STATUS GRP1 GLOBAL AUTO 222222 FALSE TRUE RECOVERY WAIT_SEND_ARCH VALID INST_OK NAME SVR_MODE SYS_STATUS RTYPE FSEQ FLSN CSEQ CLSN DW_STAT_FLAG OK JY1 PRIMARY OPEN TIMELY 4205 28044 4205 28044 4 ---------------------------------------------------------------------------
備庫jy2
[dmdba@dm8rw2 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini DMWATCHER[4.0] V8 DMWATCHER[4.0] IS READY show 2022-01-18 22:23:28 --------------------------------------------------------------------------- GROUP_NAME TYPE MODE OGUID MPP_FLAG AUTO_RESTART DW_STATUS DW_SUB_STATUS DW_CTL_STATUS GRP1 GLOBAL AUTO 222222 FALSE TRUE OPEN SUB_STATE_START VALID INST_OK NAME SVR_MODE SYS_STATUS RTYPE FSEQ FLSN CSEQ CLSN DW_STAT_FLAG OK JY2 STANDBY OPEN TIMELY 4204 28044 4204 28044 0 DATABASE(JY2) APPLY INFO: REDOS_PARALLEL_NUM (1) DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4205, 4205, 4205], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (28044) ---------------------------------------------------------------------------
備庫jy3
[dmdba@dm8rw3 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini DMWATCHER[4.0] V8 DMWATCHER[4.0] IS READY show 2022-01-18 22:23:35 --------------------------------------------------------------------------- GROUP_NAME TYPE MODE OGUID MPP_FLAG AUTO_RESTART DW_STATUS DW_SUB_STATUS DW_CTL_STATUS GRP1 GLOBAL AUTO 222222 FALSE TRUE OPEN SUB_STATE_START VALID INST_OK NAME SVR_MODE SYS_STATUS RTYPE FSEQ FLSN CSEQ CLSN DW_STAT_FLAG OK JY3 STANDBY OPEN TIMELY 4204 28044 4204 28044 0 DATABASE(JY3) APPLY INFO: REDOS_PARALLEL_NUM (1) DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4205, 4205, 4205], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (28044) ---------------------------------------------------------------------------
也可以註冊守護程式服務來進行啟動
主庫
[root@dm8rw1 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/jy/dmwatcher.ini -p jy1 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicejy1.service to /usr/lib/systemd/system/DmWatcherServicejy1.service. Finished to create the service (DmWatcherServicejy1) [root@dm8rw1 ~]# service DmWatcherServicejy1 start Redirecting to /bin/systemctl start DmWatcherServicejy1.service
備庫1
[root@dm8rw2 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/jy/dmwatcher.ini -p jy2 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicejy2.service to /usr/lib/systemd/system/DmWatcherServicejy2.service. Finished to create the service (DmWatcherServicejy2) [root@dm8rw2 ~]# service DmWatcherServicejy2 start Redirecting to /bin/systemctl start DmWatcherServicejy2.service
備庫2
[root@dm8rw3 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/jy/dmwatcher.ini -p jy3 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicejy3.service to /usr/lib/systemd/system/DmWatcherServicejy3.service. Finished to create the service (DmWatcherServicejy3) [root@dm8rw3 ~]# service DmWatcherServicejy3 start Redirecting to /bin/systemctl start DmWatcherServicejy3.service
配置監視器
由於主庫和即時備庫的守護程式配置為自動切換模式,因此這裡選擇配置確認監視器。和普通監視器相比,確認監視器除了相同的命令支援外,在主庫發生故障時,能夠自動通知即時備庫接管為新的主庫,具有自動故障處理的功能。
修改dmmonitor.ini配置確認監視器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置項保持一致。
MON_DW_CONFIRM = 1 #確認監視器模式 MON_LOG_PATH = /dm8/data/log #監視器日誌檔案存放路徑 MON_LOG_INTERVAL = 60 #每隔60s定時記錄系統資訊到日誌檔案 MON_LOG_FILE_SIZE = 32 #每個日誌檔案最大32M MON_LOG_SPACE_LIMIT = 0 #不限定日誌檔案總佔用空間 [GRP1] MON_INST_OGUID = 222222 #組GRP1的唯一OGUID值 #以下配置為監視器到組GRP1的守護程式的連線資訊,以“IP:PORT”的形式配置 #IP對應dmmal.ini中的MAL_HOST,PORT對應dmmal.ini中的MAL_DW_PORT MON_DW_IP = 10.10.13.213:5238 MON_DW_IP = 10.10.13.214:5238 MON_DW_IP = 10.10.13.215:5238 [dmdba@dm216 data]$ vi dmmonitor.ini MON_DW_CONFIRM = 1 MON_LOG_PATH = /dm8/data/log MON_LOG_INTERVAL = 60 MON_LOG_FILE_SIZE = 32 MON_LOG_SPACE_LIMIT = 0 [GRP1] MON_INST_OGUID = 222222 MON_DW_IP = 10.10.13.213:5238 MON_DW_IP = 10.10.13.214:5238 MON_DW_IP = 10.10.13.215:5238
啟動監視器:
[dmdba@dm8rw4 data]$ dmmonitor /dm8/data/dmmonitor.ini [monitor] 2022-01-18 22:28:01: DMMONITOR[4.0] V8 [monitor] 2022-01-18 22:28:02: DMMONITOR[4.0] IS READY. [monitor] 2022-01-18 22:28:02: Received message from(JY1) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-18 22:28:02 OPEN OK JY1 OPEN PRIMARY VALID 3 28044 28044 [monitor] 2022-01-18 22:28:02: Received message from(JY3) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-18 22:28:02 OPEN OK JY3 OPEN STANDBY VALID 3 28044 28044 [monitor] 2022-01-18 22:28:02: Received message from(JY2) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-18 22:28:02 OPEN OK JY2 OPEN STANDBY VALID 3 28044 28044 show 2022-01-18 22:28:11 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 222222 TRUE AUTO FALSE < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.213 5239 2022-01-18 22:28:10 GLOBAL VALID OPEN JY1 OK 1 1 OPEN PRIMARY DSC_OPEN TIMELY 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 10.10.13.213 5236 OK JY1 OPEN PRIMARY 0 0 TIMELY VALID 4207 28044 4207 28044 NONE < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.214 5239 2022-01-18 22:28:10 GLOBAL VALID OPEN JY2 OK 1 1 OPEN STANDBY DSC_OPEN TIMELY 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 10.10.13.214 5236 OK JY2 OPEN STANDBY 0 0 TIMELY VALID 4204 28044 4204 28044 NONE DATABASE(JY2) APPLY INFO FROM (JY1), REDOS_PARALLEL_NUM (1): DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4207, 4207, 4207], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (28044) < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.215 5239 2022-01-18 22:28:10 GLOBAL VALID OPEN JY3 OK 1 1 OPEN STANDBY DSC_OPEN TIMELY 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 10.10.13.215 5236 OK JY3 OPEN STANDBY 0 0 TIMELY VALID 4204 28044 4204 28044 NONE DATABASE(JY3) APPLY INFO FROM (JY1), REDOS_PARALLEL_NUM (1): DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4207, 4207, 4207], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (28044) #================================================================================#
測試資料同步
主庫:
SQL> create table test(id number(10)); executed successfully used time: 198.382(ms). Execute id is 103. SQL> insert into test values(1); affect rows 1 SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 29574 29574 used time: 0.350(ms). Execute id is 501. used time: 1.182(ms). Execute id is 104. SQL> commit; executed successfully used time: 12.799(ms). Execute id is 105.
備庫jy2:
SQL> select * from test; LINEID ID ---------- -- 1 1 used time: 2.615(ms). Execute id is 202. SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 29574 29574 used time: 5.798(ms). Execute id is 0.
備庫jy3:
SQL> select * from test; LINEID ID ---------- -- 1 1 used time: 2.691(ms). Execute id is 202. SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 29574 29574 used time: 5.949(ms). Execute id is 0.
介面說明
DM多種客戶端介面都支援讀寫分離叢集連線設定,以下說明客戶端連線伺服器時如何設定讀寫分離屬性,詳細可參考《DM8程式設計師手冊》。4
JDBC介面
在JDBC連線串中增加了兩個連線屬性:
n rwSeparate 是否使用讀寫分離系統,預設0;取值(0不使用,1使用)。
n rwPercent 分發到主庫的事務佔主備庫總事務的百分比,有效值0~100,預設值25。
dm.jdbc.driver.DmDriver
jdbc:dm://192.168.0.206:5236?rwSeparate=1&rwPercent=10
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2878839/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DM8配置讀寫分離叢集V4.0
- DM8動態增加讀寫分離叢集節點
- DM7搭建讀寫分離叢集
- discuz 配置讀寫分離(主寫從讀)
- 搭建Redis哨兵叢集並使用RedisTemplate實現讀寫分離Redis
- 淺談高效能資料庫叢集——讀寫分離資料庫
- docker+mysql叢集+讀寫分離+mycat管理+垂直分庫+負載均衡DockerMySql負載
- Mysql讀寫分離叢集的搭建且與MyCat進行整合MySql
- ShardingSphere(七) 讀寫分離配置,實現分庫讀寫操作
- 配置\清除 MySQL 主從 讀寫分離MySql
- 搭建Redis“主-從-從”模式叢集並使用 RedisTemplate 實現讀寫分離Redis模式
- 搭建Redis簡易叢集實現主從複製和讀寫分離Redis
- 安裝Centos7 、 Mysql8 叢集,實現讀寫分離 高可用(五)-- MyCat配置詳解CentOSMySql
- DM8搭建MPP叢集
- 搭建基於springmvc,ibatis的工程實現讀寫分離,配置分離SpringMVCBAT
- 在 Istio 中實現 Redis 叢集的資料分片、讀寫分離和流量映象Redis
- KingbaseES V8R6叢集運維案例之---license禁用讀寫分離模組運維
- shardingjdbc + jpa 完成讀寫分離配置及資料分片JDBC
- KunlunBase 讀寫分離方案
- Redis的讀寫分離Redis
- Laravel讀寫分離原理Laravel
- MyCat分庫分表、讀寫分離
- 資料讀寫壓力大,讀寫分離
- 資料庫讀寫分離資料庫
- 讀寫分離 & 分庫分表 & 深度分頁
- StoneDB 讀寫分離實踐方案
- MySQL 讀寫分離的好處MySql
- mysql優化之讀寫分離MySql優化
- ProxySQL實現MySQL讀寫分離MySql
- 探究MySQL MGR的讀寫分離MySql
- 【Cetus】Cetus-讀寫分離版
- 位元組面試:什麼是讀寫分離?讀寫分離的底層如何實現?面試
- Mycat2+Mysql一主一從實現讀寫分離配置MySql
- proxysql配置讀寫分離策略和權重調整一例SQL
- Spring Boot + Mybatis 多資料來源配置實現讀寫分離Spring BootMyBatis
- Docker實現Mariadb分庫分表、讀寫分離Docker
- mysql讀寫分離的最佳實踐MySql
- MySQL 官宣:支援讀寫分離了!!MySql