反向隧道手动工作,不适用于复制 [英] Reverse tunnel works manually, not for replication

查看:94
本文介绍了反向隧道手动工作,不适用于复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 MASTER mysql 服务器在本地网络上,我有一个新的远程从站(即在互联网上).由于 MASTER 没有可访问的 IP,我从文档中收集到我应该建立反向隧道.我执行这个:

My MASTER mysql server is on a local network, and I have a new slave which is remote (i.e. on the internet). As MASTER does not have an accessible IP, I gathered from the docs that I should establish a reverse tunnel. I execute this:

ssh -f -N -T -R 7777:localhost:3306 user@slave.slave.com

ssh -f -N -T -R 7777:localhost:3306 user@slave.slave.com

在 MASTER 上.连接似乎有效 - 我可以去从站并连接用 mysql 到 MASTER 没有问题.但出于某种原因,复制确实不开始.MASTER 已经可以毫无问题地复制到另外两个从站 - 那里的配置似乎是正确的.

on the MASTER. The connection seems to work - I can go to the slave and connect with mysql to the MASTER without problem. For some reason though, replication does not start. MASTER is already replicating to two other slaves without problems - seems the configuration is correct there.

我在从服务器上启动复制:

I initiated replication on the slave as:

CHANGE MASTER TO MASTER_HOST='127.0.0.1', 
                 MASTER_PORT=7777,
                 MASTER_USER='my_repl', 
                 MASTER_PASSWORD='xxxxx', 
                 MASTER_LOG_FILE='mysql-bin.nnnnn', 
                 MASTER_LOG_POS=mm;

SLAVE STATUS 报告 mysql 尝试连接到远程,但从未成功:

SLAVE STATUS reports mysql trying to connect to the remote, but never succeeding:

error connecting to master 'my_repl@127.0.0.1:7777' - retry-time: 60  retries: 86400

谁能建议如何诊断这个问题?

Can anyone suggest how to diagnose this problem?

顺便说一句:操作系统是 Linux.

BTW: OS is Linux.

推荐答案

抱歉...我没有意识到我必须将 127.0.0.1 定义为新用户知识产权.

My apologies... I didn't realize I had to define a new user with 127.0.0.1 as IP.

所以,内网"连接使用

replication_user@machine_name 

作为id,通过反向隧道的连接使用

as id, the connection which comes through the reverse tunnel uses

replication_user@127.0.0.1 

作为 ID.两者都必须分别向 mysql 声明.原始消息中的其余信息是有效的 - 也许这有助于某人...

as id. Both have to be declared to mysql separately. The rest of the info in the original message is valid - maybe this helps someone...

您好,约翰

PS:忘了说了 - 我使用 tcpdump 远程调试了这个(MASTER 和 SLAVE 对我来说都是远程的):

PS: Forgot to mention - I debugged this remotely (both MASTER and SLAVE are remote to me) using tcpdump:

tcpdump -i lo 'tcp port 7777'

在 SLAVE 端,和

on the SLAVE side, and

tcpdump -i lo 'tcp port 3306'

在 MASTER 上(当然,当流量很大时,这不是很有用).

on the MASTER (of course that would not be very useful when there is much traffic).

这篇关于反向隧道手动工作,不适用于复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆