注册
虚拟机搭建DMDSC
专栏/培训园地/ 文章详情 /

虚拟机搭建DMDSC

Talking 2024/02/18 643 0 0
摘要

四、DMDSC

1、环境准备


### 1.1网络

```javascript
A(CentOSB):ens33:192.168.100.103	ens37:192.168.200.103
B(CentOSC):ens33:192.168.100.104	ens34:192.168.200.104

1.2共享磁盘

1.2.1新建磁盘

dcr:2G vote:2G redo:10G data:15G arch:6G 1、图形化添加共享磁盘 2、命令行 //在虚拟机目录下,进行共享磁盘创建,例如:创建2G共享磁盘 D:\Program Files (x86)> .\vmware-vdiskmanager.exe -c -s 30G -a lsilogic -t 2 "D:\Work\WorkLinux\shell_DSC0\shared1.vmdk"

1.2.2修改虚拟机配置文件

编辑“.vmx”结尾文件(使用共享存储的各节点均需要添加) scsi1.sharedBus = "virtual" scsi1:0.deviceType = "disk" disk.locking = "false" diskLib.dataCacheMaxSize = "0" diskLib.dataCacheMaxReadAheadSize = "0" diskLib.dataCacheMinReadAheadSize = "0" diskLib.dataCachePageSize = "4096" diskLib.maxUnsyncedWrites = "0" disk.EnableUUID = "TRUE"

1.2.3分区

使用root用户进入linux进行分区fdisk /dev/sdb n新建分区 p打印查看分区 w写入磁盘并保存 最后使用命令 fdisk -l 或者使用 lsblk ,再次查看一下此时的分区,已经成功分成四个区

1.2.4修改配置文件

使用root用户修改,两台机器都要修改 vim /etc/udev/rules.d/88-dm-asmdevices.rules ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N" ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N" ACTION=="add", KERNEL=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N" ACTION=="add", KERNEL=="sdb4", RUN+="/bin/raw /dev/raw/raw4 %N" ACTION=="add", KERNEL=="raw[1-4]", OWNER="dmdba", GROUP="dinstall", MODE="0660"

1.2.5裸设备绑定

使用root用户修改,两台机器都要修改 udevadm control --reload-rules systemctl restart systemd-udev-trigger.service //udevadm trigger --type=devices --action=change 查看: ll /dev/raw/* 若查看不到就试试重启 reboot/shutdown -r now

2、部署

2.1 配置dmdcr_cfg.ini文件

两节点均配置:/dmdb/dmdata/config/dmdcr_cfg.ini DCR_N_GRP = 3 #磁盘内多少个组 DCR_VTD_PATH = /dev/raw/raw2 #表决磁盘路径 DCR_OGUID = 230101 #消息标识 一般为当天日期 [GRP] DCR_GRP_TYPE = CSS #组类型 DCR_GRP_NAME = GRP_CSS #组名 DCR_GRP_N_EP = 2 #组内节点个数N, 最大值16 DCR_GRP_DSKCHK_CNT = 60 #磁盘心跳时间默认60s [GRP_CSS] DCR_EP_NAME = CSS0 DCR_EP_HOST = 192.168.200.103 #节点ip DCR_EP_PORT = 9836 #节点监听端口号 [GRP_CSS] DCR_EP_NAME = CSS1 DCR_EP_HOST = 192.168.200.104 DCR_EP_PORT = 9837 [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 = 64735 DCR_EP_SHM_SIZE = 128 DCR_EP_HOST = 192.168.200.103 DCR_EP_PORT = 5836 DCR_EP_ASM_LOAD_PATH = /dev/raw [GRP_ASM] DCR_EP_NAME = ASM1 DCR_EP_SHM_KEY = 54736 DCR_EP_SHM_SIZE = 128 DCR_EP_HOST = 192.168.200.104 DCR_EP_PORT = 5837 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 = 7436 [GRP_DSC] DCR_EP_NAME = DSC1 DCR_EP_SEQNO = 1 DCR_EP_PORT = 5236 DCR_CHECK_PORT = 7437

2.2 初始化磁盘

一个节点执行 进入/dmdb/dmdbms/bin/执行:./dmasmcmd 或者:/dmdb/dmdbms/bin/dmasmcmd 然后再ASM下执行: ASM>create dcrdisk '/dev/raw/raw1' 'dcr' ASM>create votedisk '/dev/raw/raw2' 'vote' ASM>create asmdisk '/dev/raw/raw3' 'LOG0' ASM>create asmdisk '/dev/raw/raw4' 'DATA0' ASM>init dcrdisk '/dev/raw/raw1' from '/dmdb/dmdata/config/dmdcr_cfg.ini' identified by '123456' ASM>init votedisk '/dev/raw/raw2' from '/dmdb/dmdata/config/dmdcr_cfg.ini'

2.3 配置dmasvrmal.ini文件

两节点都要 vim /dmdb/dmdata/config/dmasvrmal.ini [MAL_INST1] MAL_INST_NAME = ASM0 MAL_HOST = 192.168.200.103 MAL_PORT = 4836 [MAL_INST2] MAL_INST_NAME = ASM1 MAL_HOST = 192.168.200.104 MAL_PORT = 4837

2.4 配置dmdcr.ini文件

A节点: DMDCR_PATH = /dev/raw/raw1 DMDCR_MAL_PATH =/dmdb/dmdata/config/dmasvrmal.ini DMDCR_SEQNO = 0 DMDCR_ASM_RESTART_INTERVAL = 0 DMDCR_ASM_STARTUP_CMD = /dmdb/dmdbms/bin/dmasmsvr dcr_ini=/dmdb/dmdata/config/dmdcr.ini DMDCR_DB_RESTART_INTERVAL = 0 DMDCR_DB_STARTUP_CMD = /dmdb/dmdbms/bin/dmserver path=/dmdb/dmdata/config/dsc0_config/dm.ini dcr_ini=/dmdb/dmdata/config/dmdcr.ini B节点: DMDCR_PATH = /dev/raw/raw1 DMDCR_MAL_PATH =/dmdb/dmdata/config/dmasvrmal.ini DMDCR_SEQNO = 1 DMDCR_ASM_RESTART_INTERVAL = 0 DMDCR_ASM_STARTUP_CMD = /dmdb/dmdbms/bin/dmasmsvr dcr_ini=/dmdb/dmdata/config/dmdcr.ini DMDCR_DB_RESTART_INTERVAL = 0 DMDCR_DB_STARTUP_CMD = /dmdb/dmdbms/bin/dmserver path=/dmdb/dmdata/config/dsc1_config/dm.ini dcr_ini=/dmdb/dmdata/config/dmdcr.ini

2.5 启动DMCSS、DMASM

节点12均启动: cd /dmdb/bin ./dmcss dcr_ini=/dmdb/dmdata/config/dmdcr.ini ./dmasmsvr dcr_ini=/dmdb/dmdata/config/dmdcr.ini 或者: 注册服务脚本 cp service_template/DmCSSService DmCssService_DSC0 cp service_template/DmASMSvrService DmAsmService_DSC0 vim DmCssService_DSC0 vim DmAsmService_DSC0 ./DmCssService_DSC0 start ./DmAsmService_DSC0 start cp service_template/DmCSSService DmCssService_DSC1 cp service_template/DmASMSvrService DmAsmService_DSC1 vim DmCssService_DSC1 vim DmAsmService_DSC1 ./DmCssService_DSC1 start ./DmAsmService_DSC1 start

2.6 创建DMASM磁盘组

在A机器上启动dmasmtool工具(一台机器上执行即可),创建DMASM磁盘组: 进入dmasmtool交互模式: cd /dmdb/bin ./dmasmtool dcr_ini=/dmdb/dmdata/config/dmdcr.ini 在ASM下运行以下两条命令: (1)创建日志磁盘组:create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3' (2)创建数据磁盘组:create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'

2.7 初始化实例

2.7.1创建dminit.ini文件

仅在A节点执行即可(个人搭建建议LOG_SIZE给小一点比如256,或者共享LOG0盘分大一点) vim /dmdb/dmdata/config/dminit.ini DB_NAME= dsc SYSTEM_PATH= +DMDATA/data SYSTEM= +DMDATA/data/dsc/system.dbf SYSTEM_SIZE= 128 ROLL= +DMDATA/data/dsc/roll.dbf ROLL_SIZE= 128 MAIN= +DMDATA/data/dsc/main.dbf MAIN_SIZE= 128 CTL_PATH= +DMDATA/data/dsc/dm.ctl LOG_SIZE= 1024 DCR_PATH= /dev/raw/raw1 DCR_SEQNO= 0 AUTO_OVERWRITE= 2 PAGE_SIZE = 32 EXTENT_SIZE = 16 [DSC0] CONFIG_PATH= /dmdb/dmdata/config/dsc0_config PORT_NUM = 5236 MAL_HOST= 192.168.200.103 MAL_PORT= 6536 LOG_PATH= +DMLOG/log/DSC0_log1.log LOG_PATH= +DMLOG/log/DSC0_log2.log [DSC1] CONFIG_PATH= /dmdb/dmdata/config/dsc1_config PORT_NUM = 5236 MAL_HOST= 192.168.200.104 MAL_PORT= 6536 LOG_PATH= +DMLOG/log/DSC1_log1.log LOG_PATH= +DMLOG/log/DSC1_log2.log

2.7.2初始化 dminit.ini

在 db0 节点执行初始化 dminit 命令: ./dminit control=/dmdb/dmdata/config/dminit.ini

2.7.3拷贝到db1节点

scp -r /dmdb/dmdata/config/dsc1_config dmdba@192.168.200.104:/dmdb/dmdata/config/

2.8 配置监视器

## A 机器、B 机器配置相同 vi /dmdb/dmdbms/bin/dmcssm.ini CSSM_OGUID = 230101 CSSM_CSS_IP = 192.168.200.103:9836 CSSM_CSS_IP = 192.168.200.104:9837 CSSM_LOG_PATH = /dmdb/dmdata/dmcssm_log CSSM_LOG_FILE_SIZE = 512 CSSM_LOG_SPACE_LIMIT = 2048 //启动 ./dmcssm INI_PATH=/dmdb/dmdbms/bin/dmcssm.ini

2.9 启动数据库服务

前台启动: 进入/dmdb/bin目录启动dsc01和dsc02 ./dmserver path=/dmdb/dmdata/config/dsc0_config/dm.ini dcr_ini=/dmdb/dmdata/config/dmdcr.ini ./dmserver path=/dmdb/dmdata/config/dsc1_config/dm.ini dcr_ini=/dmdb/dmdata/config/dmdcr.ini 或者: cp service_template/DmService ./DmService_DSC0 vim DmService_DSC0 ./DmService_DSC0 start cp service_template/DmService ./DmService_DSC1 vim DmService_DSC1 ./DmService_DSC1 start

补充:修改DSC端口

使 用 DMASMCMD 工 具 export 出 备 份dmdcr_cfg_bak.ini ./dmasmcmd (1)导出 Asm> export dcrdisk '/dev/raw/raw1' to '/dmdb/dmdata/config/edit_dsc0_config/dmdcr_cfg.ini' (2)修改 (3)导入 Asm> import dcrdisk '/dmdb/dmdata/config/edit_dsc0_config/dmdcr_cfg.ini' to '/dev/raw/raw1'
评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服