一、环境准备
硬件:两台相同配置机器、2G 内存、20G 本地磁盘、2 块网卡
操作系统:Red Hat Enterprise Linux Server release 7.2 (Maipo)
数据库版本:disql V8.1-1-66-20.03.10-118926-ENT
网络配置:
DSC01:网卡1 192.168.73.* 网卡2 10.0.0.101
DSC02:网卡1 192.168.73.* 网卡2 10.0.0.102
二、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld.service
vim /etc/selinux/config 修改SELINUX=disable
三、在两个节点安装数据库
四、创建共享磁盘
先在cmd创建共享磁盘
语句如下:
vmware-vdiskmanager.exe -c -s 10000Mb -a lsilogic -t 2 "F:\XN\DMDSC1\sharedisk.vmdk"--找到你安装虚拟机的位置。
注意:必须到虚拟机的目录下创建。然后到两台虚拟机下的.vmx用文本编辑器加入
disk.locking="false"
diskLib.dataCacheMaxSize="0"
scsi1.present ="TRUE"
scsi1.virtualDev ="lsilogic"
scsi1:0.present="TRUE"
scsi1:0.fileName=" E:\DSCXN\DSC01\sharedisk.vmdk"
然后手动在两台虚拟机下加入共享磁盘
五、创建DMDSC配置文件的目录
mkdir /home/dmdba/data
六、划分裸磁盘
1. 在共享磁盘上裸设备划分
1) 输入fdisk /dev/sdb
2) 依次输入 n –>p-> 1 ->回车-> +100M-> 回车,完成第一块磁盘划分
3) 依次输入 n –>p-> 1 ->回车-> +100M-> 回车,完成第二块磁盘划分
4) 依次输入 n –>p-> 1 ->回车-> + 2048M -> 回车,完成第三块磁盘划分
5) 依次输入n –>p->4 ->回车->回车->回车,完成第四块磁盘划分
[root@localhost bin]# fdisk -l
Disk /dev/sdb: 10.5 GB, 10485760000 bytes, 20480000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x8cf818d4
Device Boot Start End Blocks Id System
Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0006f656
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 20971519 9972736 8e Linux LVM
Disk /dev/mapper/rhel-root: 9093 MB, 9093251072 bytes, 17760256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/rhel-swap: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@localhost bin]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20479999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20479999, default 20479999): +100M
Partition 1 of type Linux and of size 100 MiB is set
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (206848-20479999, default 206848):
Using default value 206848
Last sector, +sectors or +size{K,M,G} (206848-20479999, default 20479999): +100M
Partition 2 of type Linux and of size 100 MiB is set
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (411648-20479999, default 411648):
Using default value 411648
Last sector, +sectors or +size{K,M,G} (411648-20479999, default 20479999): +2048M
Partition 3 of type Linux and of size 2 GiB is set
Command (m for help): n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): p
Selected partition 4
First sector (4605952-20479999, default 4605952):
Using default value 4605952
Last sector, +sectors or +size{K,M,G} (4605952-20479999, default 20479999):
Using default value 20479999
Partition 4 of type Linux and of size 7.6 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
6) 编辑/etc/udev/rules.d/70-persistent-ipoib.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"
最后执行start_udev,完成裸设备绑定
/sbin/udevadm trigger --type=devices --action=change
或者/sbin/udevadm control --reload
如果没有生效,重启系统 reboot
ls /dev/raw
7) 可以通过blockdev --getsize64 /dev/raw/raw1命令查看裸设备大小
七、配置
1.准备dmdcr_cfg.ini配置文件(两个节点)
文件保存到/home/dmdba/data,内容如下
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.73.20
DCR_EP_PORT = 9341
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 192.168.73.21
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.73.20
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.73.21
DCR_EP_PORT = 9351
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 = 9741
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT=5236
DCR_CHECK_PORT = 9742
2.使用dmasmcmd工具初始化
可以将初始化内容放于txt文件,脚本文件必须以“#asm script file”开头,然后执行,文件内容如下:
#asm script file
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/data/dmdcr_cfg.ini'identified by 'abcd'
init votedisk '/dev/raw/raw2' from '/home/data/dmdcr_cfg.ini'
执行语句
./ dmasmcmd script_file=asmcmd.txt
3. 准备DMASM的MAL配置文件(命名为dmasvrmal.ini),保存到/home/dmdba/data,两个节点都一样的配置文件
[MAL_INST1]
MAL_INST_NAME=ASM0
MAL_HOST=192.168.73.20
MAL_PORT=7236
[MAL_INST2]
MAL_INST_NAME=ASM1
MAL_HOST=192.168.73.21
MAL_PORT=7237
4.准备dmdcr.ini配置文件,保存到/home/dmdba/data目录下面
DMASM 的两个节点分别配置 dmdcr.ini,dmdcr_path 相同,dmasvrmal.ini 文 件内容也相同,dmdcr_seqo分别为0和1。
节点1:
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH= /home/dmdba/data/dmasvrmal.ini #dmasmsvr使用的MAL配置文件路径
DMDCR_SEQNO =0
#ASM重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL =0
DMDCR_ASM_STARTUP_CMD =/opt/dmdbms/bin/dmasmsvr dcr_ini=/home/dmdba/data/dmdcr.ini
#DB重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL=0
DMDCR_DB_STARTUP_CMD =/opt/dmdbms/bin/dmserver path=/home/dmdba/data/dsc0_config/dm.ini dcr_ini=/home/dmdba/data/dmdcr.ini
节点2:
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH= /home/dmdba/data/dmasvrmal.ini #dmasmsvr使用的MAL配置文件路径
DMDCR_SEQNO =1
#ASM重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL =0
DMDCR_ASM_STARTUP_CMD =/opt/dmdbms/bin/dmasmsvr dcr_ini=/home/dmdba/data/dmdcr.ini
#DB重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL=0
DMDCR_DB_STARTUP_CMD =/opt/dmdbms/bin/dmserver path=/home/dmdba/data/dsc1_config/dm.ini dcr_ini=/home/dmdba/data/dmdcr.ini
5.启动DMCSS、DMASM服务(两个节点)
[dmdba@localhost bin]$ ./dmcss dcr_ini=/home/dmdba/data/dmdcr.ini
DMCSS V8
DMCSS IS READY
[CSS]: 设置EP CSS0[0]为控制节点
[dmdba@localhost bin]$ ./dmasmsvr dcr_ini=/home/dmdba/data/dmdcr.ini
ASM SELF EPNO:0
DMASMSVR V8
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 Control Node EPNO:0
6.在一个节点使用dmasmtool工具创建DMASM磁盘
./dmasmtool DCR_INI=/home/dmdba/data/dmdcr.ini
ASM>create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
Used time: 804.734(ms).
ASM>create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
Used time: 00:00:02.945.
ASM>
#创建日志磁盘组 create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
#创建数据磁盘组 create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
7.准备dminit.ini配置文件,保存到/home/dmdba/data目录
#cat 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
ctl_size = 8
log_size = 256
dcr_path = /dev/raw/raw1 #dcr磁盘路径,目前不支持asm,只能是裸设备
dcr_seqno = 0
auto_overwrite = 1
[DSC0]
#inst_name跟dmdcr_cfg.ini中DB类型group中DCR_EP_NAME对应
config_path = /home/dmdba/data/dsc0_config
port_num = 5236
mal_host = 192.168.73.20
mal_port = 9340
log_path = +DMLOG/log/dsc0_log01.log
log_path = +DMLOG/log/dsc0_log02.log
[DSC1]
#inst_name跟dmdcr_cfg.ini中DB类型group中DCR_EP_NAME对应
config_path = /home/dmdba/data/dsc1_config
port_num = 5236
mal_host = 192.168.73.21
mal_port = 9341
log_path = +DMLOG/log/dsc1_log01.log
log_path = +DMLOG/log/dsc1_log02.log
8.初始化数据库
./dminit control=/home/dmdba/data/dminit.ini
然后将dsc1_config拷贝到节点2相应的目录下:
scp -r dsc1_config [email protected]:/home/dmdba/data/
9.启动数据库
./dmserver /home/dmdba/data/dsc0_config/dm.ini dcr_ini=/home/dmdba/data/dmdcr.ini
./dmserver /home/dmdba/data/dsc1_config/dm.ini dcr_ini=/home/dmdba/data/dmdcr.ini
10.登录disql
[dmdba@localhost bin]$ ./disql SYSDBA/SYSDBA
服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间: 29.446(毫秒)
disql V8
SQL>
11.以上步骤已经完成搭建了,但是因为每启动服务就开一个窗口,现在设置后台启动脚本。
后台启动脚本放于bin目录下的service_templatel里
编辑DmCSSService
INI_PATH=/home/dmdba/data/dmdcr.ini --修改这里的路径。
编辑DmASMSvrService
INI_PATH=/home/dmdba/data/dmdcr.ini
编辑DmService
INI_PATH=/home/dmdba/data/dsc0_config/dm.ini
DCR_INI_PATH=/home/dmdba/data/dmdcr.ini
12.后台启动服务
七、总结。