v2.0
- 关于PTK
- 快速入门
- 使用指南
- 使用参考
- 配置文件示例
- 命令介绍
- ptk
- ptk completion
- ptk view-static-config
- ptk init-cluster
- ptk collect
- ptk rec-guc
- ptk cache
- ptk gen-ptkc
- ptk manage
- ptk demo
- ptk meta
- ptk version
- ptk self
- ptk gen-om-xml
- ptk env
- ptk gen-static-config
- ptk cluster
- ptk cluster createdb
- ptk cluster uninstall-compat-tools
- ptk cluster install-compat-tools
- ptk cluster install-mogila
- ptk cluster rename
- ptk cluster throwout
- ptk cluster takeover
- ptk cluster uninstall-cm
- ptk cluster install-cm
- ptk cluster gen-cert-files
- ptk cluster load-cm-vip
- ptk cluster del-kerberos-auth
- ptk cluster add-kerberos-auth
- ptk cluster uninstall-kerberos-server
- ptk cluster install-kerberos-server
- ptk cluster is-in-upgrade
- ptk cluster upgrade-rollback
- ptk cluster upgrade-commit
- ptk cluster upgrade
- ptk cluster demote
- ptk cluster promote
- ptk cluster refresh
- ptk cluster shell
- ptk cluster modify-comment
- ptk cluster show-config
- ptk cluster set-guc
- ptk cluster show-guc
- ptk cluster set-hba
- ptk cluster show-hba
- ptk cluster scale-out
- ptk cluster scale-in
- ptk cluster uninstall-mogha
- ptk cluster install-mogha
- ptk cluster list-plugins
- ptk cluster install-plugin
- ptk cluster inspect
- ptk cluster failover
- ptk cluster switchover
- ptk cluster build
- ptk cluster status
- ptk cluster restart
- ptk cluster stop
- ptk cluster start
- ptk uninstall
- ptk ls
- ptk install
- ptk exec
- ptk template
- ptk encrypt
- ptk checkos
- ptk download
- ptk candidate
- 故障排查
- FAQ
- 发布记录
- 社区
- 附录:YAML语法
主备倒换
出于常规性运维的需要,你可能想要将主库和某个备库进行主备角色的倒换, MogDB 数据库自带的 gs_ctl 工具提供了 switchover
的功能,但 gs_ctl 工具只能在实例所在的用户下执行,为了便于统一集中运维,PTK 也封装了 switchover
的集群操作命令,可以通过 PTK 实现任意实例的主备倒换。
切换命令
-H
或 --host
参数指定实例的 IP
ptk cluster -n <CLUSTER_NAME> switchover -H <IP>
-i
或 --id
参数可以指定实例的 ID (ID 可通过 ptk ls
查看)
ptk cluster -n <CLUSTER_NAME> switchover -i <ID>