我正在尝试在 2 个 vps 之间配置 sql 组复制,一个是非 AWS Lightsail 实例并充当主要实例。
但是,我似乎无法让 Lightsail 实例正常工作。它在主服务器上启动没有问题,但是当我尝试在 Lightsail 服务器上启动组复制时
START GROUP_REPLICATION;
ERROR 2013 (HY000): Lost connection to MySQL server during query
(超时设置为 20)
端口 3306 和 33061 在 ufw 中的两个服务器上都是开放的,也在 AWS Lightsail 的防火墙上开放。
Lightsail 上的 my.cnf 看起来像这样
# Shared replication group configuration
loose-group_replication_group_name = "<uuid>"
loose-group_replication_ip_whitelist = "<primary_static_public_ip>,<lightsail_static_public_ip>"
loose-group_replication_group_seeds = "<primary_static_public_ip>:33061,<lightsail_static_public_ip>:33061"
# Single or Multi-primary mode? Uncomment these two lines
# for multi-primary mode, where any host can accept writes
loose-group_replication_single_primary_mode = OFF
loose-group_replication_enforce_update_everywhere_checks = ON
# Host specific replication configuration
server_id = 2
bind-address = "0.0.0.0"
report_host = "<lightsail_static_public_ip>"
loose-group_replication_local_address = "<lightsail_static_public_ip>:33061"
在主节点上,我只使用主节点的地址并将 Lightsail 公共地址列入白名单。我无法弄清楚为什么它拒绝连接。
mysql -h
但是,我可以使用命令和复制用户名从 Lightsail 连接到主节点。