【YashanDB知識庫】ycm託管資料庫時,資料庫非OM安裝無法託管

YashanDB發表於2024-05-13

問題現象
ps -ef | grep yas 檢視無yasom和yasagent程序,且在{資料庫安裝目錄}/om/{資料庫名稱}的目錄下沒有conf、data、log等目錄,確定資料庫不是用yasboot安裝,是用指令碼安裝的
問題的風險及影響
非yasboot安裝,ycm無法完成託管,無法監控
問題影響的版本
不涉及ycm的版本問題
問題發生原因
資料庫版本太舊或安裝資料庫的人沒有按照規範使用yasboot安裝
解決方法及規避方式
將資料庫先託管到yasom中,再託管到ycm中
問題分析和處理過程

點選檢視程式碼
(1)生成配置檔案

-- ip必須是本機ip,install-path不能和安裝的資料庫path重重複

./bin/yasboot package config gen --cluster yasdb -u yashan -p Cod-2024 --ip 192.168.39.70 --install-path /home/yashan/yashandb/yasdb_yasom -t se

  

[yashan@KylinV10 yasdb_yasom]$ ./bin/yasboot package config gen --cluster yasdb -u yashan -p Cod-2024 --ip 192.168.39.70 --install-path /home/yashan/yashandb/yasdb_yasom -t se

192.168.39.70

  192.168.39.70:1688 is already used

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

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

 host0001 | dbg1  | db        | 1-1       | 192.168.39.70:1688 | 192.168.39.70:1689 | 192.168.39.70:1690 | /home/yashan/yashandb/yasdb_yasom/data/yasdb

----------+-------+-----------+-----------+--------------------+--------------------+--------------------+----------------------------------------------
  
Generate config success 

(2)安裝yasom和yasagent

./bin/yasboot package install -i yashandb-22.2.3.0-linux-aarch64.tar.gz -t hosts.toml 

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

checking install profile.toml...

install version: yashandb 22.2.3.0

update host to yasom...

[yashan@KylinV10 yasdb_yasom]$ ps -ef | grep yas

yashan   3945392       1  0 15:04 ?        00:00:25 yasdb open -D /home/yashan/yashandb/yasdb_data

root     3950422 3950243  0 15:37 pts/1    00:00:00 su - yashan

yashan   3950423 3950422  0 15:37 pts/1    00:00:00 -bash

root     3953443 3952376  0 15:49 pts/2    00:00:00 su - yashan

yashan   3953444 3953443  0 15:49 pts/2    00:00:00 -bash

yashan   3955488       1  0 16:05 ?        00:00:00 /home/yashan/yashandb/yasdb_yasom/bin/yasagent --init -c yasdb -l 192.168.39.70:1676 --host-id host0001 -k 564e9e581348c9ae -d

yashan   3955503       1  0 16:06 ?        00:00:00 /home/yashan/yashandb/yasdb_yasom/bin/yasom --init -c yasdb -l 192.168.39.70:1675 -k 564e9e581348c9ae -d

yashan   3955542 3950423  0 16:06 pts/1    00:00:00 ps -ef

yashan   3955543 3950423  0 16:06 pts/1    00:00:00 grep yas

(3)生成託管配置模版

./bin/yasboot package config join-demo -t SE

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

[yashan@KylinV10 yasdb_yasom]$ ll

總用量 221716

drwxrwxr-x 6 yashan yashan        70  5月  4  2023 admin

drwxrwxr-x 3 yashan yashan       220  5月  4  2023 bin

drwxrwxr-x 2 yashan yashan        30  4月 17 16:05 client

drwxrwxr-x 3 yashan yashan       126  4月 17 16:06 conf

-rw-rw-r-- 1 yashan yashan     10974  5月  4  2023 gitmoduleversion.dat

-rw------- 1 yashan yashan       386  4月 17 16:05 hosts.toml

drwxrwxr-x 2 yashan yashan        65  5月  4  2023 include

drwxrwxr-x 3 yashan yashan        17  5月  4  2023 java

-rw-r--r-- 1 yashan yashan       527  4月 17 16:15 join_demo.toml

drwxr-xr-x 2 yashan yashan      4096  5月  4  2023 lib

drwxrwxr-x 2 yashan yashan         6  4月 17 16:06 log

drwxrwxr-x 3 yashan yashan        38  4月 17 15:50 om

drwxrwxr-x 2 yashan yashan       115  5月  4  2023 scripts

-rw------- 1 yashan yashan       549  4月 17 16:05 yasdb.toml

drwxrwxr-x 3 yashan yashan        22  4月 17 15:48 yashandb

-rw-r--r-- 1 yashan yashan 227004643  4月 17 15:46 yashandb-22.2.3.0-linux-aarch64.tar.gz

(4)修改託管配置模版

[yashan@KylinV10 yasdb_yasom]$ cat join_demo.toml

cluster = "tt"

sys_password = "yasdb_123"

yas_type = "SE"

[primary_config]

  manage_ip = "127.0.0.1"

  yasdb_home = "/opt/yasom/yashandb/tt"

  node_path = "/opt/yasom/yashandb/data/tt/db-1-1"

  node_id = "1-1:1" 

[[standby_config]]

  manage_ip = "127.0.0.1"

  yasdb_home = "/opt/yasom/yashandb/tt"

  node_path = "/opt/yasom/yashandb/data/tt/db-1-2"

  node_id = "1-2:1" 

[[standby_config]]

  manage_ip = "127.0.0.1"

  yasdb_home = "/opt/yasom/yashandb/tt"

  node_path = "/opt/yasom/yashandb/data/tt/db-1-3"

  node_id = "1-3:1" 

修改後:

  

[yashan@KylinV10 yasdb_yasom]$ cat join_demo.toml

cluster = "yasdb"

sys_password = "yasdb_123"

yas_type = "SE"
 
[primary_config]

  manage_ip = "192.168.39.70"

  yasdb_home = "/home/yashan/yashandb/yasdb_home"

  node_path = "/home/yashan/yashandb/yasdb_data"

  node_id = "1-1:1"

(5)執行託管

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

the cluster status is as follow:

|key         |value

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

|clusterName |yasdb

|version     |22.2.3.0

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  | 3945392 | open            | normal          | primary       | 0.0.0.0:1688   | /home/yashan/yashandb/yasdb_data

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

Check success

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

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

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

 task | eb0ecf155a0db5e6 | JoinYasdbCluster | -      | yasdb | SUCCESS | 0           | 100      | -  

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

task completed, status: SUCCESS


(6)檢視狀態

yashan@KylinV10 ~]$ yasboot cluster status -c yasdb -d

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

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

 host0001 | db        | 1-1:1  | 3945392 | open            | normal          | primary       | 0.0.0.0:1688   | /home/yashan/yashandb/data/yasdb/db-1-1

----------+-----------+--------+---------+-----------------+-----------------+---------------+----------------+-------------------------------
託管至yasom完成後,再按照流程託管至ycm即可

**經驗總結**
安裝資料庫要按照規範安裝,非規範安裝會導致一系列問題

相關文章