关于 YMatrix
标准集群部署
数据写入
数据迁移
数据查询
运维监控
参考指南
工具指南
数据类型
存储引擎
执行引擎
流计算引擎
灾难恢复
系统配置参数
索引
扩展
SQL 参考
常见问题(FAQ)
本文档介绍了 master/standby 端口修改工具 mxchangeport。
mxchangeport 用于安全地更改 MatrixDB 主节点(以及可选的备节点)的端口。该工作流会执行前置检查、更新元数据目录与配置文件、同步规格定义,并通过受控恢复完成整个过程。若需回滚,系统将执行一个仅用于回滚的步骤,重启复制服务以快速恢复连接。
UpdateSegmentPort 更新端口信息。postgresql.conf:为每个目标实例设置对应端口。defaults.conf:更新 MasterPortBase / StandbyPortBase。cluster.conf:为对应主机设置 PGPort。recover_db_cluster.json:刷新 DBID 到端口的映射关系。postgresql.auto.conf:修补 primary_conninfo 中的端口号。update_bash:刷新 mxadmin 环境变量中的 PGPORT。SaveSpecToEtcd)之前,插入 RestartServicesOnRevert 步骤(正向执行时为空操作;回滚时则重启复制目标服务)。mxstart 和 mxrecover。matrixmgr 数据库端口;重启 mxui/cylinder;在回滚测试中执行探测验证。仅修改主节点端口
mxchangeport run --new-port 6432
同时修改主节点与备节点端口(使用相同端口)
mxchangeport run --new-port 6432 --with-standby
主节点与备节点使用不同端口
mxchangeport run --new-port 6432 --with-standby --standby-port 7432
回滚测试(注入故障以验证回滚机制)
mxchangeport run --new-port 6432 --revert-test
生成初始化 JSON 文件
mxchangeport run --new-port 6432 --with-standby --standby-port 7432 --gen-init > init.json
基于初始化文件生成执行计划并运行
mxchangeport run --init-file init.json --gen-plan > plan.json
mxchangeport run --plan-file plan.json
注意!
当指定--with-standby但未提供--standby-port时,备节点将使用与主节点相同的新端口。