【YashanDB 知识库】YCP 高可用部署离线升级 -rpc 升级详细步骤
- 2024-12-17 广东
本文字数:8794 字
阅读完需:约 29 分钟
本文内容来自 YashanDB 官网,原文内容请见:https://www.yashandb.com/newsinfo/7686586.html?templateId=1718516
以 23.2.4.100 版本升级到 23.2.11.100 版本为例
升级前先对 YCP 主备节点执行备份
1、主节点执行
/opt/ycm/ycm/scripts/backup.sh -n ycm -i /opt/ycm/ycm -c yashandb -y /data1/dugg/yasdb_home/yashandb/23.2.2.100 --cata-log /data1/dugg/yasdb_home/yashandb/23.2.2.100/catalog --addr 192.168.3.102:3675 -k 0d09e5d01100dc76 -u sys -p Cod-2022
[dugg@localhost upgrade]$ /opt/ycm/ycm/scripts/backup.sh -n ycm -i /opt/ycm/ycm -c yashandb -y /data1/dugg/yasdb_home/yashandb/23.2.2.100 --cata-log /data1/dugg/yasdb_home/yashandb/23.2.2.100/catalog --addr 192.168.3.102:3675 -k 0d09e5d01100dc76 -u sys -p Cod-2022
backup ycm, tag: 20240926-153611...
[backup db] exec yasbak deploy
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
-------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 739908 | open | normal | primary | 192.168.3.102:3688 | /data1/dugg/yasdb_data/db-1-1
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
host0002 | db | 1-2:2 | 658538 | open | normal | standby | 192.168.3.105:3688 | /data1/dugg/yasdb_data/db-1-2
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
host0003 | db | 1-3:3 | 647339 | open | normal | standby | 192.168.3.106:3688 | /data1/dugg/yasdb_data/db-1-3
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
cluster:yashandb deploy yasbak succeed
[backup db] exec yasbak run backup database
connecting to yasdb node: 192.168.3.106:3688
backup 192.168.3.106:3688 succeed
[backup db] backup yashandb success
[backup dir] cp data/cert
[backup dir] cp data/yasdbpasswd.ini
[backup dir] cp etc
[backup dir] cp loki/loki-local-config.yaml
[backup dir] cp loki/loki-rules.yaml.bak
[backup dir] cp loki/rules
[backup dir] cp loki/tmp_rules
[backup dir] cp monit/conf
[backup dir] cp monit/data/conf
[backup dir] cp monit/data/monitrc
[backup dir] cp prometheus-2.28.1/prometheus.yml
[backup dir] cp prometheus-2.28.1/rules.yml
[backup dir] cp promtail/positions.yaml
[backup dir] cp promtail/promtail-local-config.yaml
[backup dir] cp static
[backup dir] cp yashandb_exporter/yashandb-metrics.yml
[backup dir] cp yashandb_exporter/yashandb-targets.yml
[backup dir] cp yas-hcs-api/conf
[backup dir] tar /opt/ycm/ycm/bak/ycm-20240926-153611.tar.gz
[backup dir] backup ycm success
[clear old backup] back up file is less than three, skip remove
back up success, backup set in /opt/ycm/ycm/bak/ycm-20240926-153611.tar.gz
2、第一个备节点执行
/opt/ycm/ycm/scripts/backup.sh -n ycm -i /opt/ycm/ycm -c yashandb -y /data1/dugg/yasdb_home/yashandb/23.2.2.100 --cata-log /data1/dugg/yasdb_home/yashandb/23.2.2.100/catalog --addr 192.168.3.102:3675 -k 0d09e5d01100dc76 -u sys -p Cod-2022
[dugg@controller upgrade]$ /opt/ycm/ycm/scripts/backup.sh -n ycm -i /opt/ycm/ycm -c yashandb -y /data1/dugg/yasdb_home/yashandb/23.2.2.100 --cata-log /data1/dugg/yasdb_home/yashandb/23.2.2.100/catalog --addr 192.168.3.102:3675 -k 0d09e5d01100dc76 -u sys -p Cod-2022
backup ycm, tag: 20240926-153650...
[backup db] exec yasbak deploy
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
-------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 739908 | open | normal | primary | 192.168.3.102:3688 | /data1/dugg/yasdb_data/db-1-1
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
host0002 | db | 1-2:2 | 658538 | open | normal | standby | 192.168.3.105:3688 | /data1/dugg/yasdb_data/db-1-2
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
host0003 | db | 1-3:3 | 647339 | open | normal | standby | 192.168.3.106:3688 | /data1/dugg/yasdb_data/db-1-3
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
cluster:yashandb deploy yasbak succeed
[backup db] exec yasbak run backup database
connecting to yasdb node: 192.168.3.106:3688
backup 192.168.3.106:3688 succeed
[backup db] backup yashandb success
[backup dir] cp data/cert
[backup dir] cp data/yasdbpasswd.ini
[backup dir] cp etc
[backup dir] cp loki/loki-local-config.yaml
[backup dir] cp loki/loki-rules.yaml.bak
[backup dir] cp loki/rules
[backup dir] cp loki/tmp_rules
[backup dir] cp monit/conf
[backup dir] cp monit/data/conf
[backup dir] cp monit/data/monitrc
[backup dir] cp prometheus-2.28.1/prometheus.yml
[backup dir] cp prometheus-2.28.1/rules.yml
[backup dir] cp promtail/positions.yaml
[backup dir] cp promtail/promtail-local-config.yaml
[backup dir] cp static
[backup dir] cp yashandb_exporter/yashandb-metrics.yml
[backup dir] cp yashandb_exporter/yashandb-targets.yml
[backup dir] cp yas-hcs-api/conf
[backup dir] tar /opt/ycm/ycm/bak/ycm-20240926-153650.tar.gz
[backup dir] backup ycm success
[clear old backup] back up file is less than three, skip remove
back up success, backup set in /opt/ycm/ycm/bak/ycm-20240926-153650.tar.gz
3、第二个备节点执行
/opt/ycm/ycm/scripts/backup.sh -n ycm -i /opt/ycm/ycm -c yashandb -y /data1/dugg/yasdb_home/yashandb/23.2.2.100 --cata-log /data1/dugg/yasdb_home/yashandb/23.2.2.100/catalog --addr 192.168.3.102:3675 -k 0d09e5d01100dc76 -u sys -p Cod-2022
[dugg@host106 upgrade]$ /opt/ycm/ycm/scripts/backup.sh -n ycm -i /opt/ycm/ycm -c yashandb -y /data1/dugg/yasdb_home/yashandb/23.2.2.100 --cata-log /data1/dugg/yasdb_home/yashandb/23.2.2.100/catalog --addr 192.168.3.102:3675 -k 0d09e5d01100dc76 -u sys -p Cod-2022
backup ycm, tag: 20240926-153703...
[backup db] exec yasbak deploy
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
-------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 739908 | open | normal | primary | 192.168.3.102:3688 | /data1/dugg/yasdb_data/db-1-1
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
host0002 | db | 1-2:2 | 658538 | open | normal | standby | 192.168.3.105:3688 | /data1/dugg/yasdb_data/db-1-2
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
host0003 | db | 1-3:3 | 647339 | open | normal | standby | 192.168.3.106:3688 | /data1/dugg/yasdb_data/db-1-3
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+-------------------------------
cluster:yashandb deploy yasbak succeed
[backup db] exec yasbak run backup database
connecting to yasdb node: 192.168.3.106:3688
backup 192.168.3.106:3688 succeed
[backup db] backup yashandb success
[backup dir] cp data/cert
[backup dir] cp data/yasdbpasswd.ini
[backup dir] cp etc
[backup dir] cp loki/loki-local-config.yaml
[backup dir] cp loki/loki-rules.yaml.bak
[backup dir] cp loki/rules
[backup dir] cp loki/tmp_rules
[backup dir] cp monit/conf
[backup dir] cp monit/data/conf
[backup dir] cp monit/data/monitrc
[backup dir] cp prometheus-2.28.1/prometheus.yml
[backup dir] cp prometheus-2.28.1/rules.yml
[backup dir] cp promtail/positions.yaml
[backup dir] cp promtail/promtail-local-config.yaml
[backup dir] cp static
[backup dir] cp yashandb_exporter/yashandb-metrics.yml
[backup dir] cp yashandb_exporter/yashandb-targets.yml
[backup dir] cp yas-hcs-api/conf
[backup dir] tar /opt/ycm/ycm/bak/ycm-20240926-153703.tar.gz
[backup dir] backup ycm success
[clear old backup] back up file is less than three, skip remove
back up success, backup set in /opt/ycm/ycm/bak/ycm-20240926-153703.tar.gz
升级主节点
1、解压安装包、三个节点都解压
[dugg@localhost upgrade]$ tar -zxvf yashandb-cloud-platform-23.2.11.100-linux-x86_64.tar.gz
2、生成被托管服务器的配置文件
sudo ./scripts/yasadm host gen -i /opt/ycm --rpc-port 9072
sudo ./scripts/yasadm host gen -i /opt/ycm --rpc-port 9072
-i, --install-dir 管理平台的安装路径
--rpc-port 管理平台服务器的升级RPC端口,用于RPC升级方式,默认为9072
[dugg@localhost upgrade]$ cd ycm
[dugg@localhost ycm]$ sudo ./scripts/yasadm host gen -i /opt/ycm --rpc-port 9072
command executed successfully
[dugg@localhost ycm]$ ll
total 24308
drwxrwxr-x. 3 dugg dugg 79 Sep 18 17:19 etc
drwxrwxr-x. 2 dugg dugg 10 Sep 18 17:19 log
drwxrwxr-x. 2 dugg dugg 4096 Sep 18 17:19 packages
drwxrwxr-x. 3 dugg dugg 67 Sep 18 17:19 scripts
drwxrwxr-x. 5 dugg dugg 4096 Sep 18 17:19 static
-rw-r--r--. 1 root root 1123 Sep 26 15:38 ycm_host.toml
-rwxrwxr-x. 1 dugg dugg 24875776 Sep 18 17:19 ycm-init
3、执行升级命令
sudo ./scripts/yasadm upgrade -i /opt/ycm -t ycm_host.toml --imp-exp-install-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100 --rpc --role primary
sudo ./scripts/yasadm upgrade -i /opt/ycm -t ycm_host.toml --imp-exp-install-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100 --rpc --role primary
-i, --install-dir 管理平台的安装路径
-t, --toml 被托管服务器信息的配置文件
--imp-exp-install-dir 安装有imp和exp的yashandb客户端路径,用于备份平台后端yashandb的数据
--role primary 升级主YCP
--plugin-package 可选,其它CPU架构的系统安装包,如果平台同时管理了x86_64和aarch64主机,该参数必填
[dugg@localhost ycm]$ ./scripts/yasadm upgrade -i /opt/ycm -t ycm_host.toml --imp-exp-install-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100 --rpc --role primary --plugin-package /home/dugg/install/yashandb-cloud-platform-23.2.11.100-linux-aarch64.tar.gz
2024/09/26 16:21:56 upgrade check success
2024/09/26 16:21:56 [HOST INFO]:
HostId: host-750a9921, ManageIp: 192.168.3.105, HostName: controller
HostId: host-be7ed325, ManageIp: 192.168.3.106, HostName: host106
HostId: host-8db9f906, ManageIp: 192.168.3.102, HostName: localhost.localdomain
HostId: host-4f679140, ManageIp: 192.168.8.4, HostName: localhost.localdomain
HostId: host-5a28f120, ManageIp: 192.168.24.59, HostName: k8s-24.59
HostId: host-caaa2e41, ManageIp: 192.168.24.49, HostName: k8s-24.49
HostId: host-c42d7e89, ManageIp: 192.168.24.48, HostName: k8s-24.48
Are you sure to upgrade YCP? [yes/no]
yes
yes
2024/09/26 16:22:00 genertate upgrade backup config success
2024/09/26 16:22:04 deploy host host-750a9921 upgrade agent success
2024/09/26 16:22:05 deploy host host-be7ed325 upgrade agent success
2024/09/26 16:22:07 deploy host host-8db9f906 upgrade agent success
2024/09/26 16:22:08 deploy host host-4f679140 upgrade agent success
2024/09/26 16:22:10 deploy host host-5a28f120 upgrade agent success
2024/09/26 16:22:11 deploy host host-caaa2e41 upgrade agent success
2024/09/26 16:22:12 deploy host host-c42d7e89 upgrade agent success
2024/09/26 16:22:13 deploy upgrade agent success
2024/09/26 16:22:13 upgrade 23.2.4.100 to 23.2.11.100 begin
2024/09/26 16:22:13 create upgrade record in yashandb success
2024/09/26 16:22:14 [host-4f679140] stop ycm-agent process success
2024/09/26 16:22:14 [host-c42d7e89] stop ycm-agent process success
2024/09/26 16:22:14 [host-caaa2e41] stop ycm-agent process success
2024/09/26 16:22:14 [host-be7ed325] stop ycm-agent process success
2024/09/26 16:22:14 [host-8db9f906] stop ycm-agent process success
2024/09/26 16:22:14 [host-750a9921] stop ycm-agent process success
2024/09/26 16:22:14 [host-5a28f120] stop ycm-agent process success
[WARN]: /opt/ycm/ycm/scripts/yas-hc-api.sh does not exist, skip operate
2024/09/26 16:22:30 stop ycm process success
2024/09/26 16:22:30 stop all ycm/ycm-agent process success
2024/09/26 16:22:33 backup ycm success
2024/09/26 16:22:33 backup ycm-agent host-750a9921 success
2024/09/26 16:22:34 backup ycm-agent host-be7ed325 success
2024/09/26 16:22:35 backup ycm-agent host-8db9f906 success
2024/09/26 16:22:35 backup ycm-agent host-4f679140 success
2024/09/26 16:22:35 backup ycm-agent host-5a28f120 success
2024/09/26 16:22:36 backup ycm-agent host-caaa2e41 success
2024/09/26 16:22:36 backup ycm-agent host-c42d7e89 success
2024/09/26 16:22:36 backup all ycm/ycm-agent success
2024/09/26 16:22:44 install ycm upgrade package success
2024/09/26 16:22:47 install ycm-agent host-750a9921 upgrade package success
2024/09/26 16:22:51 install ycm-agent host-be7ed325 upgrade package success
2024/09/26 16:22:55 install ycm-agent host-8db9f906 upgrade package success
2024/09/26 16:23:00 install ycm-agent host-4f679140 upgrade package success
2024/09/26 16:23:02 install ycm-agent host-5a28f120 upgrade package success
2024/09/26 16:23:05 install ycm-agent host-caaa2e41 upgrade package success
2024/09/26 16:23:09 install ycm-agent host-c42d7e89 upgrade package success
2024/09/26 16:23:09 install all ycm/ycm-agent upgrade package success
2024/09/26 16:23:10 replace ycm/ycm-agent dir and file success
2024/09/26 16:23:10 exec upgrade sql success
2024/09/26 16:23:10 add default data success
2024/09/26 16:23:10 update config file ycm.yaml success
2024/09/26 16:23:10 update backup strategy in db success
2024/09/26 16:23:10 upgrade metadata success
2024/09/26 16:23:21 [host-c42d7e89] start ycm-agent process success
2024/09/26 16:23:21 [host-caaa2e41] start ycm-agent process success
2024/09/26 16:23:21 [host-4f679140] start ycm-agent process success
2024/09/26 16:23:21 [host-8db9f906] start ycm-agent process success
2024/09/26 16:23:21 [host-be7ed325] start ycm-agent process success
2024/09/26 16:23:21 [host-5a28f120] start ycm-agent process success
2024/09/26 16:23:21 [host-750a9921] start ycm-agent process success
2024/09/26 16:23:21 start ycm process success
2024/09/26 16:23:21 update host kernel arch success
2024/09/26 16:23:21 update upgrade status in yashandb success
2024/09/26 16:23:21 update upgrade stauts in config success
2024/09/26 16:23:21 upgrade success
2024/09/26 16:23:30 uncompleted upgrade instances:
instId: ycp0002; ListenIp: 0.0.0.0; electionIp: 192.168.3.105; port: 9010
instId: ycp0003; ListenIp: 0.0.0.0; electionIp: 192.168.3.106; port: 9010
command executed successfully
升级备节点
1、第一个备节点
sudo ./scripts/yasadm upgrade -i /opt/ycm --lib-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100/lib --role standy
[dugg@controller ycm]$ sudo ./scripts/yasadm upgrade -i /opt/ycm --lib-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100/lib --role standby
2024/09/26 16:51:37 [HOST INFO]:
Are you sure to upgrade YCP? [yes/no]
yes
yes
2024/09/26 16:51:40 genertate upgrade backup config success
2024/09/26 16:51:40 upgrade 23.2.4.100 to 23.2.11.100 begin
2024/09/26 16:51:40 create upgrade record in yashandb success
[WARN]: /opt/ycm/ycm/scripts/yas-hc-api.sh does not exist, skip operate
2024/09/26 16:51:41 stop ycm process success
2024/09/26 16:51:41 backup ycm success
2024/09/26 16:51:46 install ycm upgrade package success
2024/09/26 16:51:46 replace ycm dir and file success
2024/09/26 16:51:46 update config file ycm.yaml success
2024/09/26 16:51:54 start ycm process success
2024/09/26 16:51:54 update upgrade status in yashandb success
2024/09/26 16:51:54 update upgrade stauts in config success
2024/09/26 16:51:54 upgrade success
2024/09/26 16:51:54 uncompleted upgrade instances:
instId: ycp0003; ListenIp: 0.0.0.0; electionIp: 192.168.3.106; port: 9010
command executed successfully
2、第二个备节点
sudo ./scripts/yasadm upgrade -i /opt/ycm --lib-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100 --role standy
[dugg@host106 ycm]$ sudo ./scripts/yasadm upgrade -i /opt/ycm --lib-dir /data1/dugg/yasdb_home/yashandb/23.2.2.100/lib --role standby
2024/09/26 16:52:19 [HOST INFO]:
Are you sure to upgrade YCP? [yes/no]
yes
yes
2024/09/26 16:52:21 genertate upgrade backup config success
2024/09/26 16:52:21 upgrade 23.2.4.100 to 23.2.11.100 begin
2024/09/26 16:52:21 create upgrade record in yashandb success
[WARN]: /opt/ycm/ycm/scripts/yas-hc-api.sh does not exist, skip operate
2024/09/26 16:52:22 stop ycm process success
2024/09/26 16:52:22 backup ycm success
2024/09/26 16:52:27 install ycm upgrade package success
2024/09/26 16:52:27 replace ycm dir and file success
2024/09/26 16:52:27 update config file ycm.yaml success
2024/09/26 16:52:35 start ycm process success
2024/09/26 16:52:35 update upgrade status in yashandb success
2024/09/26 16:52:35 update upgrade stauts in config success
2024/09/26 16:52:35 upgrade success
command executed successfully
3、查看升级后版本
cat /opt/ycm/ycm/etc/upgrade/version.toml
[dugg@host106 upgrade]$ cat /opt/ycm/ycm/etc/upgrade/version.toml
version = "23.2.11.100"
[[upgrade]]
source_version = ["23.1.2.100"]
path = "23.1.2.100"
[[upgrade]]
source_version = ["23.1.3.100", "23.1.4.1"]
path = "23.1.3.100"
[[upgrade]]
source_version = ["23.1.4.2", "23.1.4.3", "23.2.1.100", "23.2.1.103", "23.2.1.104", "23.2.1.105", "23.2.2.100", "23.2.3.100", "23.2.4.100", "23.2.5.100", "23.2.6.100", "23.2.7.100", "23.2.8.100", "23.2.8.101", "23.2.9.100", "23.2.10.100"]
版权声明: 本文为 InfoQ 作者【YashanDB】的原创文章。
原文链接:【http://xie.infoq.cn/article/d6048108804ca71934979b421】。文章转载请联系作者。
YashanDB
全自研国产新型大数据管理系统 2022-02-15 加入
还未添加个人简介
评论