目录
1.配置DCR初始化文件(两个节点都要执行,使用dmdba用户)
9.注册DMCSS与DMASM服务:(root用户,2个节点执行)
前言
DM数据库共享存储集群DSC部署(vmware环境)
一、配置规划
DMDSC1 | 192.168.125.239 | 10.10.10.81 |
DMDSC2 | 192.168.125.240 | 10.10.10.82 |
共享存储环境:
dcr disk | 2g*1 |
voting disk | 2g*1 |
log disk | 3g*1 |
datadisk1 | 3g*1 |
datadisk2 | 3g*1 |
实例名:dmdsc1/dmds2
操作系统:CENTOS 7.6
系统组:dmdba:dinstall
二、配置共享存储
1.节点1新增磁盘
注:记录磁盘信息
2.节点2新增共享磁盘
3.两台虚拟机的vmx文件增加以下内容并重启
diskLib.dataCacheMaxSize=0
diskLib.dataCacheMaxReadAheadSize=0
diskLib.dataCacheMinReadAheadSize=0
diskLib.dataCachePageSize=4096
diskLib.maxUnsyncedWrites = "0"
disk.locking = "FALSE"
scsi0:1.SharedBus="Virtual"
scsi0:2.SharedBus="Virtual"
scsi0:3.SharedBus="Virtual"
scsi0:4.SharedBus="Virtual"
scsi0:5.SharedBus="Virtual"
4.虚拟机检查磁盘
fdisk -l /dev/sdb |grep "Disk /dev/sd"
fdisk -l /dev/sdc |grep "Disk /dev/sd"
fdisk -l /dev/sdd |grep "Disk /dev/sd"
fdisk -l /dev/sde |grep "Disk /dev/sd"
fdisk -l /dev/sdf| grep "Disk /dev/sd"
5.配置绑定规则
for i in b c d e f;
do
echo "KERNEL==\"sd?\",SUBSYSTEM==\"block\",PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\",SYMLINK+=\"dm-disk$i\",OWNER=\"dmdba\",GROUP=\"dinstall\",MODE=\"0660\""
done
例1:
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c298baa207754195d43b56608c8d",SYMLINK+="dm-dcrdisk",OWNER="dmdba",GROUP="dinstall",MODE="0660"
将输出结果放入:
vi /etc/udev/rules.d/99-dm-devices.rules
6.加载绑定规则:
/sbin/udevadm control --reload-rules
/sbin/udevadm trigger --type=devices --action=change
查看对应的共享盘及权限
ls -lsa /dev/dm*
ls -lsa /dev/sd*
7.配置raw裸设备
vi /etc/rc.d/rc.local
sleep 1
#dcrdisk
raw /dev/raw/raw1 /dev/dm-dcrdisk
#votingdisk
raw /dev/raw/raw2 /dev/dm-votedisk
#logdisk
raw /dev/raw/raw3 /dev/dm-logdisk
#datadisk
raw /dev/raw/raw4 /dev/dm-datadisk1
raw /dev/raw/raw5 /dev/dm-datadisk2
sleep 2
#chown+chmod
chown dmdba:dinstall /dev/raw/raw1
chown dmdba:dinstall /dev/raw/raw2
chown dmdba:dinstall /dev/raw/raw3
chown dmdba:dinstall /dev/raw/raw4
chown dmdba:dinstall /dev/raw/raw5
chmod 660 /dev/raw/raw1
chmod 660 /dev/raw/raw2
chmod 660 /dev/raw/raw3
chmod 660 /dev/raw/raw4
chmod 660 /dev/raw/raw5
touch /var/lock/subsys/local
#必须放在最后一行,否则开机不会自动映射raw设备
chmod u+x /etc/rc.d/rc.local
8.重启虚拟机后检查绑定状态
ls -lsa /dev/raw/raw*
ls -lsa /dev/dm*
raw -qa
三、操作系统配置
1.创建用户和组
groupadd dinstall
useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
passwd dmdba
2.创建目录并授权
mkdir /dm8
mkdir /dmdata
mkdir /dmarch
mkdir /dmbak
chown -R /dm8
chown -R /dmdata
chown -R /dmarch
chown -R /dmbak
3.修改用户资源限制
vim /etc/security/limits.conf
添加:
dmdba soft core unlimited
dmdba hard core unlimited
dmdba soft nofile 65536
dmdba hard nofile 65536
dmdba soft nproc 65536
dmdba hard nproc 65536
dmdba soft stack 65536
dmdba hard stack 65536
4.添加环境变量
vi /home/dmdba/.bash_profile
添加:
export DM_HOME=/dm8
export PATH=$PATH:$DM_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DM_HOME/bin
5.关闭防火墙
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
6.关闭selinux
echo "SELINUX=disabled">/etc/selinux/config
echo "SELINUXTYPE=targeted" >> /etc/selinux/config
cat /etc/selinux/config
setenforce 0
四、数据库安装
1.上传挂载安装镜像
mount -o loop dm8_20200930_x86_rh6_64_ent_8.1.1.134.iso /mnt
su - dmdba
cd /mnt
./DMInstall.bin –i
安装结束后会提示
请以root系统用户执行命令:
/dm8/script/root/root_installer.sh
安装结束
2.注册DMAP服务
切换到root用户
[root@dmdb01 dmtest]# /dm8/script/root/root_installer.sh
##创建并启动DmAPService服务
DmAP是数据库备份恢复需要依赖的一个服务
启动数据库:
su - dmdba
cd /dm8/bin
./DmAPService start
关闭数据库:
./DmAPService stop
查看服务进程:
ps -ef|grep dmap
3.初始化数据库实例
使用dmdba用户,进入bin目录
restore database '/dmdata/dmrw/dm.ini' from backupset '/dmbak/bakfull';
recover database '/dmdata/dmrw/dm.ini' from backupset '/dmbak/bakfull';
recover database '/dmdata/dmrw/dm.ini' update db_magic;
五、DSC集群配置
1.配置DCR初始化文件(两个节点都要执行,使用dmdba用户)
Vi /dmdata/dmdsc/dmdcr_cfg.ini
DCR_N_GRP= 3
DCR_VTD_PATH= /dev/raw/raw2
DCR_OGUID= 63635
[GRP]
DCR_GRP_TYPE= CSS
DCR_GRP_NAME= dmcss
DCR_GRP_N_EP= 2
DCR_GRP_DSKCHK_CNT= 60
[dmcss]
DCR_EP_NAME= dmcss1
DCR_EP_HOST= 10.10.10.81
DCR_EP_PORT= 9341
[dmcss]
DCR_EP_NAME= dmcss2
DCR_EP_HOST= 10.10.10.82
DCR_EP_PORT= 9341
[GRP]
DCR_GRP_TYPE= ASM
DCR_GRP_NAME= dmasm
DCR_GRP_N_EP= 2
DCR_GRP_DSKCHK_CNT= 60
[dmasm]
DCR_EP_NAME= dmasm1
DCR_EP_SHM_KEY= 93360
DCR_EP_SHM_SIZE= 10
DCR_EP_HOST= 10.10.10.81
DCR_EP_PORT= 9351
DCR_EP_ASM_LOAD_PATH= /dev/raw
[dmasm]
DCR_EP_NAME= dmasm2
DCR_EP_SHM_KEY= 93361
DCR_EP_SHM_SIZE= 10
DCR_EP_HOST= 10.10.10.82
DCR_EP_PORT= 9351
DCR_EP_ASM_LOAD_PATH= /dev/raw
[GRP]
DCR_GRP_TYPE= DB
DCR_GRP_NAME= dmdsc
DCR_GRP_N_EP= 2
DCR_GRP_DSKCHK_CNT= 60
[dmdsc]
DCR_EP_NAME= dmdsc1
DCR_EP_SEQNO= 0
DCR_EP_PORT= 5236
DCR_CHECK_PORT= 9741
[dmdsc]
DCR_EP_NAME= dmdsc2
DCR_EP_SEQNO= 1
DCR_EP_PORT= 5236
DCR_CHECK_PORT= 9742
2.创建ASM磁盘(只需在主节点,使用dmdba用户)
dmasmcmd
create dcrdisk ‘/dev/raw/raw1’ ‘dcr’
create votedisk ‘/dev/raw/raw2’ ‘vote’
create asmdisk ‘/dev/raw/raw3’ ‘log’
create asmdisk ‘/dev/raw/raw4’ ‘datadisk1’
create asmdisk ‘/dev/raw/raw5’ ‘datadisk2’
初始化
init dcrdisk '/dev/raw/raw1' from '/dmdata/dmdsc/dmdcr_cfg.ini' identified by 'dmdsc'
init votedisk '/dev/raw/raw2' from '/dmdata/dmdsc/dmdcr_cfg.ini'
3.配置ASM的MAL系统配置文件(两节点,内容相同)
vi /dmdata/dmdsc/dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME =dmasm1
MAL_HOST =10.10.10.81
MAL_PORT = 7236
[MAL_INST2]
MAL_INST_NAME =dmasm2
MAL_HOST =10.10.10.82
MAL_PORT = 7236
4.配置DCR启动配置文件
节点1:
vi /dmdata/dmdsc/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dmdata/dmdsc/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0 #ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL=10
DMDCR_ASM_STARTUP_CMD =/dm8/dmdba/dmdbms/bin/dmasmsvr dcr_ini=/dmdata/dmdsc/dmdcr.ini #DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL= 30
DMDCR_DB_STARTUP_CMD = /dm8/dmdba/dmdbms/bin/dmserver path=/dmdata/dmdsc/dmdsc1/dm.ini dcr_ini=/dmdata/dmdsc/dmdcr.ini
节点2:
vi /dmdata/dmdsc/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dmdata/dmdsc/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 1 #ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL=10
DMDCR_ASM_STARTUP_CMD = /dm8/dmdba/dmdbms/bin/dmasmsvr dcr_ini=/dmdata/dmdsc/dmdcr.ini #DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL= 30
DMDCR_DB_STARTUP_CMD = /dm8/dmdba/dmdbms/bin/dmserver path=/dmdata/dmdsc/dmdsc2/dm.ini dcr_ini=/dmdata/dmdsc/dmdcr.ini
5.启动DMCSS服务(两个节点启动,使用dmdba用户)
cd /dm8/dmdba/dmdbms/bin
./dmcss dcr_ini=/dmdata/dmdsc/dmdcr.ini
(此时未生成dm.ini文件,会提示open ini file /dmdata/dmdsc/dmdsc1/dm.ini failed!)
6.创建ASM磁盘组
asm启动后,节点1使用dmdba用户启动dmasmtool工具:
./dmasmtool dcr_ini=/dmdata/dmdsc/dmdcr.ini
create diskgroup 'dglog' asmdisk '/dev/raw/raw3'
create diskgroup 'dgdata01' asmdisk '/dev/raw/raw4'
-- alter diskgroup 'dgdata01' add asmdisk '/dev/raw/raw5'
7.初始化共享集群数据库实例
配置dminit控制文件,2节点配置一样,使用dmdba用户执行
vi /dmdata/dmdsc/dminit.ini
db_name =dmdsc
system_path= +dgdata01/data
system =+dgdata01/data/dmdsc/system.dbf
system_size= 128
roll =+dgdata01/data/dmdsc/roll.dbf
roll_size= 128
main =+dgdata01/data/dmdsc/main.dbf
main_size= 128
ctl_path= +dgdata01/data/dmdsc/dm.ctl
ctl_size= 8
log_size= 256
#dcr磁盘路径,目前不支持asm,只能是裸设备
dcr_path= /dev/raw/raw1
dcr_seqno= 0
auto_overwrite= 1
[dmdsc1]
#inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME对应
config_path= /dmdata/dmdsc/dmdsc1
port_num= 5236
mal_host =10.10.10.81
mal_port= 9236
log_path= +dglog/log/dmdsc1_log01.log
log_path= +dglog/log/dmdsc1_log02.log
[dmdsc2]
#inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME对应
config_path= /dmdata/dmdsc/dmdsc2
port_num= 5236
mal_host= 10.10.10.82
mal_port= 9236
log_path= +dglog/log/dmdsc2_log01.log
log_path =+dglog/log/dmdsc2_log02.log
初始化实例:(节点1使用dmdba用户执行)
./dminit control=/dmdata/dmdsc/dminit.ini
将生成的dsc2文件夹拷贝至节点2:
scp -r dsc2 192.168.125.240:/dmdata/dmdsc/
8.观察两个节点的css窗口日志,检查集群状态
9.注册DMCSS与DMASM服务:(root用户,2个节点执行)
cd /dm8/dmdba/dmdbms/script/root
节点1:
./dm_service_installer.sh -t dmcss -dcr_ini /dmdata/dmdsc/dmdcr.ini -p dmdsc1
./dm_service_installer.sh -t dmasmsvr -dcr_ini /dmdata/dmdsc/dmdcr.ini -p dmdsc2 -y DmCSSServicedmdsc1
节点2:
./dm_service_installer.sh -t dmcss -dcr_ini /dmdata/dmdsc/dmdcr.ini -p dmdsc2
./dm_service_installer.sh -t dmasmsvr -dcr_ini /dmdata/dmdsc/dmdcr.ini -p dmdsc2 -y DmCSSServicedmdsc2
关闭前台启动css,服务方式启动css
Systemctl start DmCSSServicedmcss1
Systemctl start DmCSSServicedmcss2
六、配置监视器
vi /dmdata/dmdsc/dmcssmonitor.ini
#和 dmdcr_cfg.ini 中的 DCR_OGUID 保持一致
CSSM_OGUID = 63635
#配置所有 CSS 的连接信息,
#和 dmdcr_cfg.ini 中 CSS 配置项的 DCR_EP_HOST 和 DCR_EP_PORT 保持一致
CSSM_CSS_IP = 10.10.10.81:9341
CSSM_CSS_IP = 10.10.10.82:9341
CSSM_LOG_PATH =/dm8/dmdba/dmdbms/log #监视器日志文件存放路径
CSSM_LOG_FILE_SIZE = 32 #每个日志文件最大 32 MB
CSSM_LOG_SPACE_LIMIT = 0 #不限定日志文件总占用空间
./dmcssm ini_path=/dmdata/dmdsc/dmcssmonitor.ini
总结
更多资讯请上达梦技术社区了解:https://eco.dameng.com