达梦8透明分布式部署(TDD)
一部署准备
dsc的分布式数据库tdd准备机器至少5台(两台存节点,一台目录和日志节点,两台存储节点)磁盘可用空间大于500g,万兆网卡(实在没有可以用千兆代替)64核 256g内存
确保防火墙都已经关闭,存储都已经自动挂载。
准备五台服务器(aa:aa:aa.180-aa:aa:aa.184)
其中180和181作为存储节点,182作为日志和目录节点,183和184作为计算节点
二开始部署
1部署存储节点
180
cd /opt/dmdbms/bin
./dmdssinit path=/home/dmdba/ddfs inst=SS1 port=35300 REGION_SIZE=2 DBF_SIZE=102400 RLOG_SIZE=10240
启动dss服务
./dmdss path=/home/dmdba/ddfs/SS1/dss.ini
181
./dmdssinit path=/home/dmdba/ddfs inst=SS2 port=35300 REGION_SIZE=2 DBF_SIZE=102400 RLOG_SIZE=10240
启动dss服务
./dmdss path=/home/dmdba/ddfs/SS2/dss.ini
cd /opt/dmdbms/bin
注意如果需要测试性能需要调整dss.ini参数
2初始化目录库和日志服务
1初始化后台库
182
cd /opt/dmdbms/bin
./dminit path=/home/dmdba/ddfs db_name=dcs_db instance_name=DCS_DB port_num=35200
启动后台库
./dmserver /home/dmdba/ddfs/dcs_db/dm.ini
2初始化tdd环境
cd /opt/dmdbm/bin
./disql SYSDBA/SYSDBA:35200
SP_DFS_DCS_INIT(1);
3启动ddfs系统服务
./dmdcs server=aa:aa:aa.182:35200
4 添加容灾域
cd /opt/dmdbms/bin
./dmdcstool host=aa:aa:aa.182 port_num=3333
add micro fault domain fd1
add micro fault domain fd2
add micro storage server SS1 ('aa:aa:aa.180' : 35300) in fd1
add micro storage server SS2 ('aa:aa:aa.181' : 35300) in fd2
alter storage server refresh size
alter storage server open
add group grp1
add rlog server "DRS" ('aa:aa:aa.182' : 3332) group grp1
5 配置drs.ini 并启动日志服务
vi /opt/drs.ini
INSTANCE_NAME = DRS #实例名,默认 DRS
SYSTEM_PATH = /opt/ddfs/drs #系统路径
PORT_NUM = 3332 #DRS 对外提供服务的监听端口,默认 3334
DCS_IP = aa:aa:aa.182 #依赖的 DCS 的 IP
DCS_PORT = 3333 #依赖的 DCS 的端口
MEMORY_POOL = 100 #使用的内存池大小,单位 M
TASK_THREAD_NUM = 10 #任务线程数
LOCAL_ARCH_PATH = /opt/ddfs/larch #本地归档目录
cd /opt/dmdbms/bin
./dmdrs path=/opt/drs.ini
3初始化计算节点
1创建目录
cd /opt/dmdbms/bin
./dmdcstool host=aa:aa:aa.82 port_num=3333
create dir '/dameng/dsc/asmdisks'
2 配置相关配置文件 dmdcr_cfg.ini 和dmdfs.ini
vi /opt/dmdcr_cfg.ini
DCR_N_GRP = 2
DCR_VTD_PATH = $/dameng/dsc/asmdisks/vtd.asm
DCR_OGUID = 63635
[GRP]
DCR_GRP_TYPE = CSS
DCR_GRP_NAME = GRP_CSS
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 10
[GRP_CSS]
DCR_EP_NAME = CSS0
DCR_EP_HOST = aa:aa:aa.183
DCR_EP_PORT = 35641
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = aa:aa:aa.184
DCR_EP_PORT = 35642
[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = GRP_DSC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 10
[GRP_DSC]
DCR_EP_NAME = DSC0
DCR_EP_PORT = 5240#数据库端口
DCR_CHECK_PORT = 35657
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_PORT = 5241
DCR_CHECK_PORT = 35658
vi /opt/dmdfs.ini
DFS_HOST = aa:aa:aa.82
DFS_PORT = 3332
DFS_COPY_NUM = 2
3初始化ddfs文件系统
cd /opt/dmdbms/bin
./dmasmcmd dfs_ini=/opt/dmdfs.ini
create emptyfile '/home/dmdba/ddfs/dsc/asmdisks/dcr.asm' size 32
create emptyfile '/home/dmdba/ddfs/dsc/asmdisks/vtd.asm' size 32
create dcrdisk '/home/dmdba/ddfs/dsc/asmdisks/dcr.asm' 'dcr' 32
create votedisk '/home/dmdba/ddfs/dsc/asmdisks/vtd.asm' 'vtd' 32
init dcrdisk'/home/dmdba/ddfs/dsc/asmdisks/dcr.asm'from'/opt/dmdcr_cfg.ini'identified by 'hust4400'
init votedisk '/home/dmdba/ddfs/dsc/asmdisks/vtd.asm' from '/opt/dmdcr_cfg.ini'
init ddfsdcr '$/dameng/dsc/asmdisks/dcr.asm' from '/home/dmdba/ddfs/dsc/asmdisks/dcr.asm'
init ddfsvtd '$/dameng/dsc/asmdisks/vtd.asm' from '/home/dmdba/ddfs/dsc/asmdisks/vtd.asm'
路径根据实际情况定
4初始化计算节点
配置dminit.ini 并在任意节点初始化计算节点
183
vi /opt/dminit.ini
db_name = dsc
system_path = /home/dmdba/ddfs/dsc
system = $/dameng/dsc/system.dbf
system_size = 128
roll = $/dameng/dsc/roll.dbf
roll_size = 128
main = $/dameng/dcs/main.dbf
main_size = 128
ctl_path = $/dameng/dsc/dm.ctl
ctl_size = 8
log_size = 256
dcr_path = $/dameng/dsc/asmdisks/dcr.asm
dcr_seqno = 0
auto_overwrite = 1
page_size = 8
extent_size = 32
CASE_SENSITIVE =0
UNICODE_FLAG =1
dfs_db_name = db_dsc
share_flag = 1
dfs_flag = 1
dfs_path = $/dameng #数据文件存放在分布式系统里的路径
dfs_host = aa:aa:aa.182 #DRS的IP地址
dfs_port = 3332 #与drs.ini的port_num一致
dfs_copy_num = 2 #前端库的副本数
[dsc0]
config_path = / home/dmdba/ddfs/dsc/dsc0
port_num = 35610
mal_host = aa:aa:aa.183
mal_port = 35620
[dsc1]
config_path = /home/dmdba/ddfs/dsc/dsc1
port_num = 35611
mal_host = aa:aa:aa.184
mal_port = 35621
cd /opt/dmdbms/bin
./dminit control=/opt/dminit.ini
初始化完成后,需要把183下面/home/dmdba/ddfs下面的dsc复制到184上的/home/dmdba/ddfs下面
同时在183下添加dmdcr0.ini
vi /opt/dmdcr1.ini
DMDCR_PATH = $/dameng/dsc/asmdisks/dcr.asm
DMDCR_SEQNO = 0
184上添加dmdcr1.ini和dmdfs.ini
DMDCR_PATH = $/dameng/dsc/asmdisks/dcr.asm
DMDCR_SEQNO = 1
vi /opt/dmdfs.ini
DFS_HOST = aa:aa:aa.182
DFS_PORT = 3332
DFS_COPY_NUM = 2
5添加计算节点归档
cd /opt/dmdbms/bin
./dmdcstool host=aa:aa:aa.182 port_num=3333
add data server dsc0 group grp1 database db_dsc arch_dir '/home/dmdba/ddfs/dsc/arch_dsc0'
add data server dsc1 group grp1 database db_dsc arch_dir '/home/dmdba/ddfs/dsc/arch_dsc1'
6启动计算节点
183
cd /opt/dmdbms/bin
./dmcss dcr_ini=/opt/dmdcr0.ini dfs_ini=/opt/dmdfs.ini
184
cd /opt/dmdbms/bin
./dmcss dcr_ini=/opt/dmdcr1.ini dfs_ini=/opt/dmdfs.ini
183
cd /opt/dmdbms/bin
./dmserver /home/dmdba/ddfs/dsc/dsc0/dm.ini dcr_ini=/opt/dmdcr0.ini
184
cd /opt/dmdbms/bin
./dmserver /home/dmdba/ddfs/dsc/dsc1/dm.ini dcr_ini=/opt/dmdcr1.ini
初次启动计算节点可能需要二到三分钟,需要耐心等待。
此时搭建DMTDD已经完成可以正常使用了
使用方式和单机基本一样(可以通过在/etc/下部署服务名连接分布式集群)
注意
创建表空间和普通单机有区别
在库运行过程中,可以添加使用 DMTDD 存储文件的表空间。添加表空间的 SQL 语法进
行了调整:
CREATE TABLESPACE ts_name DATAFILE path SIZE size [COPY copy_num] [MICRO|GREAT]
COPY copy_num:当路径是 DMTDD 路径时,该参数指定文件的副本数。可以省略,
缺省值为 dmdfs.ini 中 DFS_COPY_NUM 的值。
MICRO|GREAT:当路径是 DMTDD 路径时,该参数指定文件采用的区大小策略。可以
省略,缺省值为 GREAT。
本部署实例是微区例如:
CREATE TABLESPACE TS1 DATAFILE '$/dameng/ts1.dbf' size 1024 copy 2 micro;