pt-table-sync,关于主机名的奇怪问题 [英] pt-table-sync, Strange Issues regarding Hostname

查看:189
本文介绍了pt-table-sync,关于主机名的奇怪问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行pt-table-sync以重新同步MYSQL主从复制. 我有两个运行Debian 5的VPS系统,复制正在运行,没有任何问题.

I am trying to run pt-table-sync to re-synchronise a MYSQL Master-Slave replication. I have two VPS Systems which are running Debian 5, and the replication is running without any issues.

我遇到的问题是,当我在MASTER服务器上运行pt-table-sync时,它始终无法连接到SLAVE服务器.我正在运行以下命令:
pt-table-sync --dry-run --sync-to-master h ='从属服务器的IP',u ='用户',p ='密码'
返回:
不允许主机我的网站地址"通过以下地址连接到该MySQL服务器:

The problem I have is that when I run pt-table-sync on the MASTER server, it keeps failing to connect to the SLAVE server. I am running the following command:
pt-table-sync --dry-run --sync-to-master h='ip of slave server',u='user',p='password'
Which returns:
Host 'my website address' is not allowed to connect to this MySQL server at ...

但是,如果我尝试从主服务器远程连接到从属mysql服务器:
mysql -h'从属服务器的IP'-u'用户'-p'密码'

However, if I try to connect to the slave mysql server remotely from the master server:
mysql -h 'ip of slave server' -u 'user' -p'password'

然后我没有任何问题,并且可以正常访问数据库.

Then I have no issues whatsoever, and can access the database fine.

在我的从属服务器上,我尝试调整MASTER连接到它时使用的mysql用户帐户,调整主机,甚至将它们暂时设置为"any"以查看它是否可以工作.

On my slave server I have tried adjusting the mysql user account that the MASTER uses when connecting to it, adjusting the hosts, and even setting them to 'any' temporarily to see whether it would work.

我还发现奇怪的是,根据我发出的确切pt-table-sync命令,计算机的主机名似乎已更改.例如:

What I also found strange is that depending on the exact pt-table-sync command I issue, the Host name of the machine seemed to change. For example:

pt-table-sync --dry-run --sync-to-master h ='从属服务器的IP',u ='用户',p ='密码'
->不允许主机我的网站地址"连接到位于...的MySQL服务器.

pt-table-sync --dry-run --sync-to-master h='ip of slave server',u='user',p='password'
--> Host 'my website address' is not allowed to connect to this MySQL server at ...

pt-table-sync --dry-run --sync-to-master'从属服务器的IP'
->拒绝访问用户'root'@''my VPS name''(使用密码:NO)

pt-table-sync --dry-run --sync-to-master 'ip of slave server'
--> Access denied for user 'root'@''my VPS name'' (using password: NO)

我不确定为什么要根据两个命令提供不同的主机"名称?有什么想法为什么当我可以直接远程连接到mysql时为什么会失败?

I am unsure why it is providing different 'Host' names depending on the two commands? Any ideas why this would be failing when I can connect directly to mysql remotely?

推荐答案

我有一个类似的问题,这是由于两台服务器上MySQL根用户的密码不同所致.在两端设置相同的密码后,一切开始正常工作.

I had a similar problem, caused by different passwords for the MySQL root user on both servers. After I set an identical password on both ends everything started working.

这篇关于pt-table-sync,关于主机名的奇怪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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