简体   繁体   English

可以在13306端口配置mysql Replication,在3306端口正常运行数据库吗?

[英]Can I configure mysql Replication on port 13306 and normal database operation on 3306?

I know Mysql Replication works on 3306, but what I am trying to understand is,我知道 Mysql 复制适用于 3306,但我想了解的是,

is there any way i can keep a) 3306 for normal Mysql Operation and have 13306 for Replication purpose only ?有什么办法可以保留 a) 3306 用于正常的 Mysql 操作,而 13306 仅用于复制目的?

I have a requirment, where We need to setup mysql Repliation over Dynamic IP which means our mysql server will be open to public, so we want to protect our database, and want to open minimum port which only for replication ( we will setup SSL replication)我有一个要求,我们需要通过动态 IP 设置 mysql Repliation,这意味着我们的 mysql 服务器将向公众开放,因此我们要保护我们的数据库,并希望打开仅用于复制的最小端口(我们将设置 SSL 复制)

b) if this is not possible , what other option do I have where we can only apply only changes from master to slave or master to master ? b)如果这是不可能的,我还有什么其他选择,我们只能应用从主到从或从主到主的更改?

can this be done ?可以这样做吗? thanks for sharing any lights or references on this.感谢您分享有关此的任何灯光或参考资料。 Thanks谢谢

MySQL replication normally works over the same port as any other MySQL connection, which is by default 3306 , as you correctly stated. MySQL 复制通常在与任何其他 MySQL 连接相同的端口上工作,默认情况下是3306 ,如您正确所述。

The standard ways to add protection:添加保护的标准方法:

  • system level firewall, allowing traffic to 3306 only from specific host (replication peer)系统级防火墙,仅允许来自特定主机(复制对等)的流量到3306
  • MySQL built-in authorization - eg GRANT REPLICATION SLAVE ON *.* TO 'repl'@'YOUR_TRUSTED_IP'; MySQL 内置授权 - 例如GRANT REPLICATION SLAVE ON *.* TO 'repl'@'YOUR_TRUSTED_IP';
  • Add TLS for data-in-transit protection, as you mentioned.正如您提到的,添加 TLS 以保护传输中的数据。

If you choose to bind MySQL to a different port you will need to update your CHANGE MASTER TO configuration, have a look here .如果您选择将 MySQL 绑定到不同的端口,则需要更新CHANGE MASTER TO配置,请查看 此处

The only way I can think of, that would allow you to restrict the replication traffic itself, in any way, would be through the GRANT REPLICATION SLAVE command, where you could choose that only a particular user@host would have access.我能想到的唯一方法是允许您以任何方式限制复制流量本身,即通过GRANT REPLICATION SLAVE命令,您可以在其中选择只有特定的 user@host 可以访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM