#openGauss #入门 #安装 #数据库 #开源
知识来源:docs-opengauss.osinfra.cn/zh/
3. 使用xml进行安装
安装成功后VIP便会自动绑定到对应的主机上,可以使用cm_ctl show命令查看VIP状态
- 带CM的数据库集群已安装的场景下配置VIP
-
ifconfig提权
-
配置自定义资源文件cm_resource.json
通过cm_ctl res命令新增floatIp资源,仍以上述的xml中的节点情况为例
# 新增VIP资源,res_name为资源名称,资源类型resources_type必须指定为VIP,float_ip表示该自定义VIP资源的虚拟ip
cm_ctl res --add --res_name="VIP_az1" --res_attr="resources_type=VIP,float_ip=10.10.10.100"
cm_ctl res --add --res_name="VIP_az2" --res_attr="resources_type=VIP,float_ip=20.20.20.100"
cm_ctl res --add --res_name="VIP_az3" --res_attr="resources_type=VIP,float_ip=30.30.30.100"
# 编辑各自定义VIP资源VIP_az1、VIP_az2、VIP_az3,添加节点,node_id表示对应的节点id,res_instance_id用于告知CM绑定的DN实例id,需要与对应的DN实例id对应
cm_ctl res --edit --res_name="VIP_az1" --add_inst="node_id=1,res_instance_id=6001" --inst_attr="base_ip=10.10.10.10"
cm_ctl res --edit --res_name="VIP_az1" --add_inst="node_id=2,res_instance_id=6002" --inst_attr="base_ip=10.10.10.11"
cm_ctl res --edit --res_name="VIP_az1" --add_inst="node_id=3,res_instance_id=6003" --inst_attr="base_ip=10.10.10.12"
cm_ctl res --edit --res_name="VIP_az2" --add_inst="node_id=4,res_instance_id=6004" --inst_attr="base_ip=20.20.20.20"
cm_ctl res --edit --res_name="VIP_az2" --add_inst="node_id=5,res_instance_id=6005" --inst_attr="base_ip=20.20.20.21"
cm_ctl res --edit --res_name="VIP_az3" --add_inst="node_id=6,res_instance_id=6006" --inst_attr="base_ip=30.30.30.30"
cm_ctl res --edit --res_name="VIP_az3" --add_inst="node_id=7,res_instance_id=6007" --inst_attr="base_ip=30.30.30.31"
执行完成后,建议使用cm_ctl res --check命令进行检查。自定义资源文件要求每个节点都要有且一致,检查完成没有错误后,需要手动将该文件分发到其他节点,分发完成后需要重启集群才能生效。该配置文件对格式要求比较严格,所以该操作不建议使用直接修改文件的方式配置,建议配置后使用cm_ctl res --check命令进行校验。
执行完成后,在cmdataPath/cm_agent/目录下会生成一个自定义资源配置文件cm_resource.json,示例如下:
{
"resources":
[{"name": "VIP_az1",
"resources_type": "VIP",
"instances":
[{"node_id": 1,
"res_instance_id": 6001,
"inst_attr": "base_ip=10.10.10.10"
},
{"node_id": 2,
"res_instance_id": 6002,
"inst_attr": "base_ip=10.10.10.11"
},
{"node_id": 3,
"res_instance_id": 6003,
"inst_attr": "base_ip=10.10.10.12"
}],
"float_ip": "10.10.10.100"
},
{
"name": "VIP_az2",
"resources_type": "VIP",
"instances":
[{"node_id": 4,
"res_instance_id": 6004,
"inst_attr": "base_ip=20.20.20.20"
},
{"node_id": 5,
"res_instance_id": 6005,
"inst_attr": "base_ip=20.20.20.21"
}],
"float_ip": "20.20.20.100"
},
{
"name": "VIP_az3",
"resources_type": "VIP",
"instances":
[{"node_id": 6,
"res_instance_id": 6006,
"inst_attr": "base_ip=30.30.30.30"
},
{"node_id": 7,
"res_instance_id": 6007,
"inst_attr": "base_ip=30.30.30.31"
}],
"float_ip": "30.30.30.100"
}]
}
#openGauss #入门 #安装 #数据库 #开源