使用共享磁盘搭建DSC集群

上一篇使用虚拟机创建共享磁盘,这次使用共享磁盘搭建DSC集群##

1.进行裸设备划分

输入 fdisk /dev/sdb
依次输入 n → p → 1 →回车→ +100M →回车,完成第一块磁盘划分
依次输入 n → p → 2 →回车→ +100M →回车,完成第二块磁盘划分
依次输入 n → p → 3 →回车→ +3000M →回车,完成第三块磁盘划分
依次输入 n → p → 4 →回车→回车→回车,完成第四块磁盘划分
w保存配置并退出

(这里1-4分区其实对应是DCR、vote、日志、数据分区)


image.png

2.使用 FDISK -L 查看分区后的结果。

3.编辑/etc/udev/rules.d/60-raw.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="660"

4.使用以下命令完成裸设备绑定

partprobe  /deb/sdb
centos 6命令 
 start_udev
Centos7:
systemctl restart systemd-udevd  
systemctl restart systemd-udev-trigger.service 
可以通过 blockdev --getsize64 /dev/raw/raw1 命令查看裸设备大小

5.配置dmdcr_cfg.ini(可以只在一个节点配置)

注:按照前面的规划所有的配置文件都放在/home/dmdba/dmdbms/config目录下,注意asm组的DCR_EP_PORT不同,DB组的DCR_CHECK_PORT端口不同

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          = 192.168.255.11 
  DCR_EP_PORT          = 9341 
[GRP_CSS] 
  DCR_EP_NAME          = CSS1 
  DCR_EP_HOST          = 192.168.255.12 
  DCR_EP_PORT          = 9343   
  
[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          = 192.168.255.11 
  DCR_EP_PORT          = 9349 
  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          = 192.168.255.12 
  DCR_EP_PORT          = 9351 
  DCR_EP_ASM_LOAD_PATH = /dev/raw 
   
[GRP] 
  DCR_GRP_TYPE         = DB 
  DCR_GRP_NAME         = GRP_RAC 
  DCR_GRP_N_EP         = 2  
  DCR_GRP_DSKCHK_CNT   = 60 
[GRP_RAC] 
  DCR_EP_NAME          = RAC0 
  DCR_EP_SEQNO         = 0   
  DCR_EP_PORT          = 5236
  DCR_CHECK_PORT       = 9741 
[GRP_RAC] 
  DCR_EP_NAME          = RAC1 
  DCR_EP_SEQNO         = 1  
  DCR_EP_PORT          = 5236
  DCR_CHECK_PORT       = 9742

6. 初始化磁盘组

在其中一个节点上启动dmasmcmd工具,依次输入以下命令:
cd /home/dmdba/dmdbms/dmdbms/bin
./dmasmcmd
依次输入以下命令(只需在一个节点执行即可)

create dcrdisk '/dev/raw/raw1' 'dcr'

create votedisk '/dev/raw/raw2' 'vote'

create asmdisk '/dev/raw/raw3' 'LOG0'

create asmdisk '/dev/raw/raw4' 'DATA0'

init dcrdisk '/dev/raw/raw1' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini' identified by 'abcd'

init votedisk '/dev/raw/raw2' from '/home/dmdba/dmdbms/config/dmdcr_cfg.ini'

7.配置dmasvrmal.ini文件 (两节点配置)

新建dmasvrmal.ini配置文件,两个节点都要配置,内容完全一样,保存到/home/dmdba/dmdbms/config目录下

[MAL_INST1]
    MAL_INST_NAME              = ASM0
    MAL_HOST                    = 192.168.255.11
    MAL_PORT                    = 7236
[MAL_INST2]
    MAL_INST_NAME              = ASM1
    MAL_HOST                    = 192.168.255.12
    MAL_PORT                    = 7237

8 配置dmdcr.ini文件 (两节点都要配置)

DMASM的两个节点分别配置dmdcr.ini,dmdcr_path相同,dmasvrmal.ini文件内容也相同,dmdcr_seqo分别为0和1。

节点192.168.255.11:

DMDCR_PATH     = /dev/raw/raw1
DMDCR_MAL_PATH = /home/dmdba/dmdbms/config/dmasvrmal.ini  
DMDCR_SEQNO   = 0

#DMDCR_ASM_RESTART_INTERVAL = 30
#DMDCR_ASM_STARTUP_CMD = service DmASMSvrService start

#DMDCR_DB_RESTART_INTERVAL = 60
#DMDCR_DB_STARTUP_CMD = service DmServiceRAC0 start
Centos7
DMDCR_PATH     = /dev/raw/raw1
DMDCR_MAL_PATH = /home/dmdba/dmdbms/config/dmasvrmal.ini  
DMDCR_SEQNO   = 0
DMDCR_ASM_RESTART_INTERVAL = 30
DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/dmdbms/bin/DmASMSvrService_RAC0 start
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD =/home/dmdba/dmdbms/dmdbms/bin/DmService_RAC0 start

节点192.168.255.12:

DMDCR_PATH     = /dev/raw/raw1
DMDCR_MAL_PATH = /home/dmdba/dmdbms/config/dmasvrmal.ini  
DMDCR_SEQNO   = 1

#DMDCR_ASM_RESTART_INTERVAL = 30
#DMDCR_ASM_STARTUP_CMD = service DmASMSvrService start

#DMDCR_DB_RESTART_INTERVAL = 60
#DMDCR_DB_STARTUP_CMD = service DmServiceRAC1 start
Centos7
DMDCR_PATH     = /dev/raw/raw1
DMDCR_MAL_PATH = /home/dmdba/dmdbms/config/dmasvrmal.ini
DMDCR_SEQNO   = 1
DMDCR_ASM_RESTART_INTERVAL = 30
DMDCR_ASM_STARTUP_CMD =/home/dmdba/dmdbms/dmdbms/bin/DmASMSvrService_RAC1 start
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD =/home/dmdba/dmdbms/dmdbms/bin/DmService_RAC1 start

注:配置过程中dmdcr.ini中先不将ASM服务和DMSERVER自动拉起,配置过程中先手动启动DMCSS、DMASM、DMSERVER服务,待所有配置都完成后,再修改dmdcr.ini将ASM服务和DMSERVER服务配置成自动拉起。

启动DMCSS、DMASM服务
在192.168.255.11、192.168.255.12节点分别前台启动dmcss、dmasmsvr程序,方便查看启动信息。
[/home/dmdbms/bin]# ./dmcss DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini
dmcss V7.1.5.132-Build(2016.11.09-74913)ENT
设置CSS[0]为主CSS
[ASM]: 设置EP[0]为主EP
[ASM]: 设置命令[START NOTIFY], 目标节点[0], 命令序号[2]
[ASM]: 设置命令[EP START], 目标节点[0], 命令序号[3]
[ASM]: 设置命令[NONE], 目标节点[0], 命令序号[0]
[ASM]: 设置命令[EP START], 目标节点[1], 命令序号[9]
[ASM]: 设置命令[NONE], 目标节点[1], 命令序号[0]
[ASM]: 设置命令[EP OPEN], 目标节点[0], 命令序号[12]
[ASM]: 设置命令[EP OPEN], 目标节点[1], 命令序号[13]
[ASM]: 设置命令[NONE], 目标节点[0], 命令序号[0]
[ASM]: 设置命令[NONE], 目标节点[1], 命令序号[0]
[ASM]: 设置命令[EP REAL OPEN], 目标节点[0], 命令序号[15]
[ASM]: 设置命令[EP REAL OPEN], 目标节点[1], 命令序号[16]
[ASM]: 设置命令[NONE], 目标节点[0], 命令序号[0]
[ASM]: 设置命令[NONE], 目标节点[1], 命令序号[0]

[/home/dmdbms/bin]# ./dmasmsvr DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini
DMASMSVR V7.1.5.132-Build(2016.11.09-74913)ENT
ASM SELF EPNO:0
dmasmsvr task worker thread startup
the ASM server is Ready.
check css cmd: START NOTIFY, cmd_seq: 2
check css cmd: EP START, cmd_seq: 3
ASM MASTER EPNO:0

9 创建DMASM磁盘组(一个节点执行)

选择ASM的主节点(一般是先启动ASM服务的节点),启动dmasmtool工具,输入下列语句创建DMASM磁盘组:
[/home/dmdbms/bin]# ./dmasmtool DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini

创建日志磁盘组,10s

create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'

创建数据磁盘组

create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'

[dmdba@dmrac02bin]$./dmasmtool DCR_INI=/home/dmdba/dmdbms/config/dmdcr.ini
dmasmtool V7.1.5.132-Build(2016.11.09-74913)ENT
ASM>create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
Used time: 00:00:10.393.
ASM>create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
Used time: 00:50:46.934.

10 配置dminit.ini文件,可在一台机器上创建并初始化

准备dminit.ini配置文件,保存到/home/dmdba/dmdbms/config目录,根据实际情况设置初始化参数,如页大小等
db_name = rac
system_path = +DMDATA/data
system = +DMDATA/data/rac/system.dbf
system_size = 128
roll = +DMDATA/data/rac/roll.dbf
roll_size = 128
main = +DMDATA/data/rac/main.dbf
main_size = 128
ctl_path = +DMDATA/data/rac/dm.ctl
ctl_size = 8
log_size = 2048
dcr_path = /dev/raw/raw1
dcr_seqno = 0
auto_overwrite = 1
PAGE_SIZE = 16

[RAC0]
config_path = /home/dmdba/dmdbms/config/rac0_config
port_num = 5236
mal_host = 192.168.255.11
mal_port = 9340
log_path = +DMLOG/log/rac0_log01.log
log_path = +DMLOG/log/rac0_log02.log
[RAC1]
config_path = /home/dmdba/dmdbms/config/rac1_config
port_num = 5236
mal_host = 192.168.255.12
mal_port = 9341
log_path = +DMLOG/log/rac1_log01.log
log_path = +DMLOG/log/rac1_log02.log

11 初始化数据库

选择其中一个节点,如192.168.255.11,启动dminit工具初始化数据库。dminit执行完成后,会在config_path目录(/home/dmdba/dmdbms/config/rac0_config和rac1_config)下生成配置文件dm.ini和dmmal.ini。
./dminit control=/home/dmdba/dmdbms/config/dminit.ini

屏幕打印如下:
[/home/dmdbms/bin]#./dminit control=/home/dmdba/dmdbms/config/dminit.ini
V7.1.5.132-Build(2016.11.09-74913)ENT
db version: 0x70009
file dm.key not found, use default license!
License will expire on 2017-06-08
log file path: +DMLOG/log/rac0_log01.log
log file path: +DMLOG/log/rac0_log02.log
log file path: +DMLOG/log/rac1_log01.log
log file path: +DMLOG/log/rac1_log02.log
write to dir [+DMDATA/data/rac].
create dm database success. 2016-06-23 15:23:13

注:初始化数据库完成之后,将192.168.0.100节点上生成的rac1_config文件拷贝到192.168.0.101的/home/dmdba/dmdbms/config目录下,然后将192.168.0.100上/home/dmdba/dmdbms/config目录下的rac1_config文件夹删掉。

12 配置远程归档

先将两个节点上的dm.ini中的ARCH_INI设置为1,然后配置dmarch.ini文件

节点192.168.0.100:放在/home/dmdba/dmdbms/config/rac0_config目录下

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/dmdbms/arch_0
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 40960
[ARCH_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC1
ARCH_INCOMING_PATH =/home/dmdba/dmdbms/arch_0_remote
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 40960

节点192.168.0.101:放在/home/dmdba/dmdbms/config/rac1_config目录下
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/dmdbms/arch_1
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 40960
[ARCH_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC0
ARCH_INCOMING_PATH =/home/dmdba/dmdbms/arch_1_remote
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 40960

13 启动DMSERVER服务

192.168.255.11节点:
./dmserver /home/dmdba/dmdbms/config/rac0_config/dm.ini dcr_ini=/home/dmdba/dmdbms/config/dmdcr.ini

192.168.255.12节点:
./dmserver /home/dmdba/dmdbms/config/rac1_config/dm.ini dcr_ini=/home/dmdba/dmdbms/config/dmdcr.ini

14 设置后台启动脚本

在正式生产环境下,要求所有的服务采用后台启动的方式进行,需要准备以下三个后台启动脚本:DMCSS后台服务脚本,DMASM后台服务启动脚本,数据库实例DMSERVER后台启动脚本。
首先以root用户创建后台启动脚本:
cd /home/dmdba/dmdbms/dmdbms/script/root
创建CSS服务:
./dm_service_installer.sh -t dmcss -p _RAC0 -i /home/dmdba/dmdbms/config/dmdcr.ini
创建DMASM服务:
./dm_service_installer.sh -t dmasmsvr -p _RAC0 -i /home/dmdba/dmdbms/config/dmdcr.ini -y DmCSSService_RAC0
创建DMSERVER服务:
./dm_service_installer.sh -t dmserver -p _RAC0 -i /home/dmdba/dmdbms/config/rac0_config/dm.ini -d /home/dmdba/dmdbms/config/dmdcr.ini -y DmASMSvrService_RAC0
之后修改数据库服务属组;
或者:直接使用/home/dmdba/dmdbms/dmdbms/bin/service_template
cp DmCSSService ../DmCSSService_RAC0
vi ../DmCSSService_RACO
INI_PATH="/home/dmdba/dmdbms/config/dmdcr.ini"

cp DmASMSvrService DmASMSvrService_RAC0
vi ../DmASMSvrService_RAC0
INI_PATH="/home/dmdba/dmdbms/config/dmdcr.ini"

cp DmService DmService_RAC0
vi DmService_RAC0
INI_PATH="/home/dmdba/dmdbms/config/rac0_config/dm.ini"
DCR_INI_PATH="/home/dmdba/dmdbms/config/dmdcr.ini"

15 配置监视器

可以在第三台独立的机器上配置监视器,查看DMRAC集群的整体运行情况,编辑一个dmcssm.ini文件,放在dm7安装目录的bin目录下,内容如下:
CSSM_OGUID = 63635
CSSM_CSS_IP = 192.168.0.100:9341
CSSM_CSS_IP = 192.168.0.101:9343
CSSM_LOG_PATH = ../log
CSSM_LOG_FILE_SIZE = 32
CSSM_LOG_SPACE_LIMIT = 0
启动监视器
./dmcssm INI_PATH=dmcssm.ini

后期若想要CSS将ASM和实例直接拉起,需要将dmdcr.ini下注释的行取消注释
DMDCR_ASM_RESTART_INTERVAL = 30
DMDCR_ASM_STARTUP_CMD = service DmASMSvrServiceRAC1 start

DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = service DmServiceRAC1 start

16 监视器命令

help 显示帮助信息
show [group_name] 显示指定的组信息,如果没有指定 group_name,则显示所有组信息
show config 显示 dmdcr_cfg.ini 的配置信息
show monitor 显示当前连接到主 CSS 的所有监视器信息
css startup 打开所有活动 CSS 的监控功能
css stop 关闭所有活动 CSS 的监控功能
set group_name auto restart on 打开指定组的自动拉起功能
set group_name auto restart off 关闭指定组的自动拉起功能
open force group_name 强制 open 指定的 ASM 或 DB 组
ep startup group_name 启动指定的 ASM 或 DB 组
ep stop group_name 退出指定的 ASM 或 DB 组
ep break group_name 主 CSS 监控关闭的情况下,对指定的组做故障处理
ep recover group_name 主 CSS 监控关闭的情况下,对指定的组做故障恢复
ep halt group_name.ep_name 强制退出指定组中的指定节点
exit 退出监视器

你可能感兴趣的:(使用共享磁盘搭建DSC集群)