新部署的OM托管数据库

首页    知识库    常见问题    新部署的OM托管数据库

背景

在数据库安装部署默认托管到OM托管的情况下,怎么再次手动托管该套数据库,亦或是手动使用脚本安装的数据库怎么纳入OM管理,很多客户/用户有这类需求。官方文档介绍的是干净环境下部署OM,此篇文章方案可以满足已被OM托管的数据库再次被托管。

 

托管数据库

操作步骤

[yashan@localhost install]$ ./bin/yasboot package config gen --cluster zwsms1 -u yashan -p "Qsc1@#$%" --ip 192.168.33.182,192.168.33.183,192.168.33.184 --port 22 --install-path /data/yashandb/yasdb_home1 --data-path /data/yashandb/yasdb_data1 --db 3 --yas-type SE

192.168.33.184

  192.168.33.184:1676 is already used

  192.168.33.184:1688 is already used

  192.168.33.184:1690 is already used

192.168.33.182

  192.168.33.182:1675 is already used

  192.168.33.182:1676 is already used

  192.168.33.182:1688 is already used

  192.168.33.182:1690 is already used

192.168.33.183

  192.168.33.183:1676 is already used

  192.168.33.183:1688 is already used

  192.168.33.183:1690 is already used

 hostid | group | node_type | node_name | listen_addr | din_addr | replication_addr | data_path

-----------------------------------------------------------------------------------------------------------------------------------------

 host0001 | dbg1 | db | 1-1 | 192.168.33.182:1688 | 192.168.33.182:1689 | 192.168.33.182:1690 | /data/yashandb/yasdb_data1

----------+-------+-----------+-----------+---------------------+---------------------+---------------------+----------------------------

 host0002 | dbg1 | db | 1-2 | 192.168.33.183:1688 | 192.168.33.183:1689 | 192.168.33.183:1690 | /data/yashandb/yasdb_data1

----------+-------+-----------+-----------+---------------------+---------------------+---------------------+----------------------------

 host0003 | dbg1 | db | 1-3 | 192.168.33.184:1688 | 192.168.33.184:1689 | 192.168.33.184:1690 | /data/yashandb/yasdb_data1

----------+-------+-----------+-----------+---------------------+---------------------+---------------------+----------------------------

 

Generate config success

 

----------------------------修改hosts.toml--------------------------------

cluster = "zwsms1"

secret_key = "30268e9f53332005"

 

[om]

  hostid = "host0001"

  [om.config]

    LISTEN_ADDR = "192.168.33.182:1775"

 

[[host]]

  hostid = "host0001"

  user = "yashan"

  password = "Qsc1@#$%"

  ip = "192.168.33.182"

  port = 22

  path = "/data/yashandb/yasdb_home1"

  [host.yasagent]

    [host.yasagent.config]

      LISTEN_ADDR = "192.168.33.182:1776"

 

[[host]]

  hostid = "host0002"

  user = "yashan"

  password = "Qsc1@#$%"

  ip = "192.168.33.183"

  port = 22

  path = "/data/yashandb/yasdb_home1"

  [host.yasagent]

    [host.yasagent.config]

      LISTEN_ADDR = "192.168.33.183:1776"

 

[[host]]

  hostid = "host0003"

  user = "yashan"

  password = "Qsc1@#$%"

  ip = "192.168.33.184"

  port = 22

  path = "/data/yashandb/yasdb_home1"

  [host.yasagent]

    [host.yasagent.config]

      LISTEN_ADDR = "192.168.33.184:1776"

----------------------------修改hosts.toml--------------------------------

 

[yashan@localhost install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-22.2.3.11-linux-aarch64.tar.gz

checking install package...

install version: yashandb 22.2.3.11

host0001 100% [====================================================================] 3s

host0002 100% [====================================================================] 3s

host0003 100% [====================================================================] 3s

update host to yasom...

 

[yashan@localhost install]$ ./bin/yasboot package config join-demo -t SE

----------------------------修改join_demo.toml--------------------------------

cluster = "zwsms1"

sys_password = "Cod-2022"

yas_type = "SE"

 

[primary_config]

  manage_ip = "192.168.33.182"

  yasdb_home = "/data/yashandb/yasdb_home/yashandb/22.2.3.11"

  node_path = "/data/yashandb/yasdb_data/db-1-1"

  node_id = "1-1:1"

 

[[standby_config]]

  manage_ip = "192.168.33.183"

  yasdb_home = "/data/yashandb/yasdb_home/yashandb/22.2.3.11"

  node_path = "/data/yashandb/yasdb_data/db-1-2"

  node_id = "1-2:2"

 

[[standby_config]]

  manage_ip = "192.168.33.184"

  yasdb_home = "/data/yashandb/yasdb_home/yashandb/22.2.3.11"

  node_path = "/data/yashandb/yasdb_data/db-1-3"

  node_id = "1-3:3"

----------------------------修改join_demo.toml--------------------------------

  

  

[yashan@localhost install]$ ./bin/yasboot cluster join -t SE --config join_demo.toml

the cluster status is as follow:

|key |value

|------------+------

|clusterName |zwsms1

|version |22.2.3.11

 

the cluster status is as follow:

 hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path

----------------------------------------------------------------------------------------------------------------------------------------------------

 host0001 | db | 1-1:1 | 96843 | open | normal | primary | 192.168.33.182:1688 | /data/yashandb/yasdb_data/db-1-1

----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+----------------------------------

 host0002 | db | 1-2:2 | 42431 | open | normal | standby | 192.168.33.183:1688 | /data/yashandb/yasdb_data/db-1-2

----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+----------------------------------

 host0003 | db | 1-3:3 | 44904 | open | normal | standby | 192.168.33.184:1688 | /data/yashandb/yasdb_data/db-1-3

----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+----------------------------------

Check success

Are you sure you to add yasdb zwsms1 to yasom[yes/no]: yes

 type | uuid | name | hostid | index | status | return_code | progress | cost

--------------------------------------------------------------------------------------------------------

 task | 1db18694818b45d5 | JoinYasdbCluster | - | zwsms1 | SUCCESS | 0 | 100 | -

------+------------------+------------------+--------+--------+---------+-------------+----------+------

task completed, status: SUCCESS

 

[yashan@localhost install]$ ./bin/yasboot cluster status -c zwsms1 -d

 hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 host0001 | db | 1-1:1 | 96843 | open | normal | primary | 192.168.33.182:1688 | /data/yashandb/yasdb_home1/yashandb/data/zwsms1/db-1-1

----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+--------------------------------------------------------

 host0002 | db | 1-2:2 | 42431 | open | normal | standby | 192.168.33.183:1688 | /data/yashandb/yasdb_home1/yashandb/data/zwsms1/db-1-2

----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+--------------------------------------------------------

 host0003 | db | 1-3:3 | 44904 | open | normal | standby | 192.168.33.184:1688 | /data/yashandb/yasdb_home1/yashandb/data/zwsms1/db-1-3

----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+--------------------------------------------------------

 

总结

指定数据库所在主机部署一套新的OM,托管已运行的数据库,托管成功之后方便数据库升级以及YCM纳管数据库。

浏览量:0