- 浏览: 243358 次
最新评论
刚配置的MySQL主从,在从机上看到
点击(此处)折叠或打开
mysql> SHOW slave STATUS \\G
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 172.17.210.199
Master_User: my
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: masters-bin.000003
Read_Master_Log_Pos: 1224
Relay_Log_File: testmysql-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: masters-bin.000003
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
看日志有很多:
点击(此处)折叠或打开
141010 0:02:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 1, Error_code: 2003
141010 0:03:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 2, Error_code: 2003
141010 0:04:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 3, Error_code: 2003
141010 0:05:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 4, Error_code: 2003
141010 0:06:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 5, Error_code: 2003
141010 0:07:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 6, Error_code: 2003
解决方法:
导致lave_IO_Running 为connecting 的原因主要有以下 3 个方面:
1、网络不通
2、密码不对
3、pos不对
解决步骤:
1、对于第一个问题,一般情况下都是可以排除的,也是最容易排除的。
2、在主库上修改用来复制的用户的密码。
3、 在做chang to 的时候注意log_pos 是否跟此时主机的一样。在主机上 show master status \G ;可以查看到
mysql> show master status \G;
*************************** 1. row ***************************
File: masters-bin.000003
Position: 2392
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
ERROR:
No query specified
从机上面执行change to 的正确
CHANGE MASTER TO
MASTER_HOST='172.17.210.199',
MASTER_USER='my',
MASTER_PASSWORD='123456',
MASTER_LOG_FILE='masters-bin.000003',
MASTER_LOG_POS= 2392;
我的问题,就是主机的防火墙没有关闭
====================================================================
由于主服务器异外重启, 导致从报错, 错误如下:
show slave status错误:
mysql> show slave status\G
Master_Log_File: mysql-bin.000288
Read_Master_Log_Pos: 627806304
Relay_Log_File: mysql-relay-bin.000990
Relay_Log_Pos: 627806457
Relay_Master_Log_File: mysql-bin.000288
Slave_IO_Running: No
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: 627806304
Relay_Log_Space: 627806663
......
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log:
'Client requested master to start replication from impossible position'
mysql错误日志:
tail /data/mysql/mysql-error.log
111010 17:35:49 [ERROR] Error reading packet from server: Client requested master
to start replication from impossible position ( server_errno=1236)
111010 17:35:49 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data
from binary log: 'Client requested master to start replication from impossible
position', Error_code: 1236
111010 17:35:49 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000288',
position 627806304
按照习惯, 先尝试必改position位置.
mysql> stop slave;
mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625751;
mysql> start slave;
错误依旧, 接下来登陆到主服务器查看binlog日志.
先按照错误点的标记去主服务器日志中查找:
[root@db1 ~]# mysqlbinlog --start-position=627655136 /data/mysql/binlog/mysql-bin.000288
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#111010 13:31:19 server id 4 end_log_pos 106 Start: binlog v 4, server v 5.1.45-log
created 111010 13:31:19
# Warning: this binlog is either in use or was not closed properly.
BINLOG '
F1aTTg8EAAAAZgAAAGoAAAABAAQANS4xLjQ1LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
'/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
没有看到这个位置.
[root@db1 ~]# mysqlbinlog /data/mysql/binlog/mysql-bin.000288 > test.txt
less text.txt
看最后一部分
# at 627625495
#111010 16:35:46 server id 1 end_log_pos 627625631 Query thread_id=45613333
exec_time=32758 error_code=0
SET TIMESTAMP=1318289746/*!*/;
delete from freeshipping_bef_update where part='AR-4006WLM' and code=''
/*!*/;
# at 627625631
#111010 16:35:46 server id 1 end_log_pos 627625751 Query thread_id=45613333
exec_time=32758 error_code=0
SET TIMESTAMP=1318289746/*!*/;
delete from shippingFee_special where part='AR-4006WLM'
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
找到最接近错误标记627655136的一个position是627625631.
再回到slave机器上change master, 将postion指向这个位置.
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625631;
Query OK, 0 rows affected (0.06 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
再次查看
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Host: 192.168.21.105
Master_User: rep
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: mysql-bin.000289
Read_Master_Log_Pos: 25433767
Relay_Log_File: mysql-relay-bin.000003
Relay_Log_Pos: 630
Relay_Master_Log_File: mysql-bin.000289
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
主从同步正常了, 同样的方法修复其它slave机器.
点击(此处)折叠或打开
mysql> SHOW slave STATUS \\G
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 172.17.210.199
Master_User: my
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: masters-bin.000003
Read_Master_Log_Pos: 1224
Relay_Log_File: testmysql-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: masters-bin.000003
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
看日志有很多:
点击(此处)折叠或打开
141010 0:02:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 1, Error_code: 2003
141010 0:03:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 2, Error_code: 2003
141010 0:04:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 3, Error_code: 2003
141010 0:05:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 4, Error_code: 2003
141010 0:06:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 5, Error_code: 2003
141010 0:07:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 6, Error_code: 2003
解决方法:
导致lave_IO_Running 为connecting 的原因主要有以下 3 个方面:
1、网络不通
2、密码不对
3、pos不对
解决步骤:
1、对于第一个问题,一般情况下都是可以排除的,也是最容易排除的。
2、在主库上修改用来复制的用户的密码。
3、 在做chang to 的时候注意log_pos 是否跟此时主机的一样。在主机上 show master status \G ;可以查看到
mysql> show master status \G;
*************************** 1. row ***************************
File: masters-bin.000003
Position: 2392
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
ERROR:
No query specified
从机上面执行change to 的正确
CHANGE MASTER TO
MASTER_HOST='172.17.210.199',
MASTER_USER='my',
MASTER_PASSWORD='123456',
MASTER_LOG_FILE='masters-bin.000003',
MASTER_LOG_POS= 2392;
我的问题,就是主机的防火墙没有关闭
====================================================================
由于主服务器异外重启, 导致从报错, 错误如下:
show slave status错误:
mysql> show slave status\G
Master_Log_File: mysql-bin.000288
Read_Master_Log_Pos: 627806304
Relay_Log_File: mysql-relay-bin.000990
Relay_Log_Pos: 627806457
Relay_Master_Log_File: mysql-bin.000288
Slave_IO_Running: No
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: 627806304
Relay_Log_Space: 627806663
......
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log:
'Client requested master to start replication from impossible position'
mysql错误日志:
tail /data/mysql/mysql-error.log
111010 17:35:49 [ERROR] Error reading packet from server: Client requested master
to start replication from impossible position ( server_errno=1236)
111010 17:35:49 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data
from binary log: 'Client requested master to start replication from impossible
position', Error_code: 1236
111010 17:35:49 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000288',
position 627806304
按照习惯, 先尝试必改position位置.
mysql> stop slave;
mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625751;
mysql> start slave;
错误依旧, 接下来登陆到主服务器查看binlog日志.
先按照错误点的标记去主服务器日志中查找:
[root@db1 ~]# mysqlbinlog --start-position=627655136 /data/mysql/binlog/mysql-bin.000288
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#111010 13:31:19 server id 4 end_log_pos 106 Start: binlog v 4, server v 5.1.45-log
created 111010 13:31:19
# Warning: this binlog is either in use or was not closed properly.
BINLOG '
F1aTTg8EAAAAZgAAAGoAAAABAAQANS4xLjQ1LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
'/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
没有看到这个位置.
[root@db1 ~]# mysqlbinlog /data/mysql/binlog/mysql-bin.000288 > test.txt
less text.txt
看最后一部分
# at 627625495
#111010 16:35:46 server id 1 end_log_pos 627625631 Query thread_id=45613333
exec_time=32758 error_code=0
SET TIMESTAMP=1318289746/*!*/;
delete from freeshipping_bef_update where part='AR-4006WLM' and code=''
/*!*/;
# at 627625631
#111010 16:35:46 server id 1 end_log_pos 627625751 Query thread_id=45613333
exec_time=32758 error_code=0
SET TIMESTAMP=1318289746/*!*/;
delete from shippingFee_special where part='AR-4006WLM'
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
找到最接近错误标记627655136的一个position是627625631.
再回到slave机器上change master, 将postion指向这个位置.
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625631;
Query OK, 0 rows affected (0.06 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
再次查看
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Host: 192.168.21.105
Master_User: rep
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: mysql-bin.000289
Read_Master_Log_Pos: 25433767
Relay_Log_File: mysql-relay-bin.000003
Relay_Log_Pos: 630
Relay_Master_Log_File: mysql-bin.000289
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
主从同步正常了, 同样的方法修复其它slave机器.
发表评论
-
mysql设置外键约束on delete cascade on update cascade
2016-12-09 16:27 3733mysql设置外键约束on delet ... -
mysql权限管理(实例)
2016-05-10 17:21 1514mysql权限管理实例 本文并没有很详细的介绍对具体的对象授 ... -
mysql简单的碎片清理脚本
2016-05-10 16:52 1496mysql简单的碎片清理脚本 #!/bin/bash date ... -
mysql qpress压缩备份恢复
2016-05-03 16:30 6963说明: 1.前面博客已经介绍过gzip压缩方法,备份正常,但后 ... -
mysql xtrabackup在线搭建主从
2016-04-11 14:59 1951使用xtrabackup进行在线的主从搭建: [root@m ... -
mysql xtrabackup在线备份还原(全备+增备)
2016-04-11 14:47 1053工具安装: [root@mysqlserver var]# t ... -
mysql主库清理数据,从库保留
2016-04-01 15:26 1298因为业务需要,想在mysql主库清理一些数据,但从库想要保留, ... -
oracle,postgresql,mysql一些使用上的区别记录
2015-12-16 11:38 01.限制行数: select * from ta where ... -
数据库调优分享-mysql
2015-12-16 10:02 951数据库调优分享------参考一本mysql资料书 日常的困 ... -
mysql 安装-tina
2015-12-08 17:32 0mysql安装-tina 1、准备安装程序(http://ww ... -
mysqldump 只导入数据或只导结构
2015-12-22 10:36 2719[size=small]mysqldump只导出数据或只导出表 ... -
mysql server has gone away
2015-12-10 09:26 877mysql server has gone away,他的意思 ... -
mysql optimize 清理碎片
2015-12-09 09:26 1206---定期清理脚本 0 1 * * 4 root /root ... -
mysql binlog
2015-12-10 09:26 1345mysqld在每个二进制日志 ... -
mysql远程连接设置
2015-12-10 09:25 1008远程连接mysql数据库: 连接上以后,通过这台跳转服务器远 ... -
Last_SQL_Error: Error 'Duplicate entry '1' for key 'PRIMARY''
2015-12-10 09:25 1720[size=small]-实际遇到的问题: Last_SQL ... -
MySQL常用函数
2015-02-05 10:34 537一、字符串类 1、left(str, length) 从左开始 ... -
MySQL触发器简介
2015-02-05 10:33 899一、触发器基本语法 CREATE TRIGGER trigge ... -
MySQL主从切换
2015-02-05 10:32 505环境: 原主库:192.168.10.197 ---新 ... -
MySQL主从搭建
2015-02-05 10:31 795环境简介 master(主):192.168.12.101 s ...
相关推荐
// COMMENT: Corresponding to the slave configuration routine. This function // initialises the master reader IC. The function is additional // to the standard configuration "M500PcdConfig". // char ...
master与slave之间的连接可以是简单的点对点连接,也可以是复杂的交通矩阵,涉及到总线仲裁机制。无论连接多么复杂,总有master向slave传输数据的过程。 #### 2. 数据交换与信号组合 在某些情况下,数据需要在既是...
Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work. 首先检查:mysql> show variables like ‘server_id...
- "not master and slaveok=false"错误提示表明MongoDB集群的主从复制配置存在问题,需要调整复制配置。 通过熟悉这些常见问题和解决方案,可以更有效地管理和维护MongoDB数据库系统,确保其稳定运行。在实际操作中...
在这个“i2s_master_slave_vhdl.rar”压缩包中,包含的是用VHDL语言实现的I2S主从模式的代码,同时也有一个Verilog版本的I2S slave模块,这对于理解和设计嵌入式音频系统非常有帮助。 首先,我们要理解I2S总线的...
3. **I/O线程**:从服务器上的I/O线程接收binlog事件,并将其存储在本地的中继日志(relay log)中。 4. **SQL线程**:从服务器的SQL线程读取中继日志中的事件,并在本地数据库上执行这些操作,保持数据同步。 三...
【标题】"master-slave-i-o-keypad-lcd-master_arduino_" 涉及的是一个基于Arduino的主从式I/O、键盘和LCD显示的项目。这个项目的主要目的是通过Arduino来构建一个主从通信系统,其中主设备控制从设备,从设备接收...
**I2C总线协议详解** ...这份"I2C-verilog-(非常详细的i2c学习心得)_代码分析_i2c-slaveverilong_Master/Slave_v"资料正是这样一个宝贵的资源,帮助开发者深入理解I2C通信机制,并提升Verilog编程能力。
LG Smart I/O系列可编程逻辑控制器(PLC)是自动化控制领域的高科技产品,主要用于工业自动化领域,提供灵活的I/O控制解决方案。它支持多种通讯接口和协议,如Profibus-DP、DeviceNet和Modbus等,能够有效地实现设备...
说明:keepalived一键部署master和slave节点 Usage: bash op.sh build master Deploy the master keepalived server. bash op.sh clear master Remove the master keepalived server. bash op.sh start master ...
这个实验项目名为“基于FPGA的I2C实验”,通过Verilog硬件描述语言实现了I2C协议的主(Master)和从(Slave)模式,同时提供了详细的代码分析和验证过程。 1. Verilog HDL(硬件描述语言):Verilog是用于描述数字...
Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs This error generally occur when we clone the master to slaver. Delete auto.cnf of mysql, and then ...
/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/root/.pub': 没有那个文件或目录 (to install the contents of '/root/.pub' anyway, look at the -f option) 解决方法 [root@hadoop1 sbin]# ssh-keygen ...
标题中的"Modbus-Master-Slave-for-Arduino-master.zip_Master/Slave_arduino"指出这是一个关于Arduino平台的Modbus主从通信库。Modbus是一种广泛使用的工业通信协议,允许不同设备之间交换数据,尤其在自动化系统中...
也可在主机上创建一个Modbus I/O服务器,并将该服务器作为 Modbus Master设备,与Modbus Slave设备进行通信。 (DSC模块)关于Modbus设备的连接和交互,请参考labview\examples\lvdsc\IO Servers\...
SPI Slave select output is disabled,use P4.7 as the Select Slave signal //bit2:FLSB=0. SPI Transfer the MSB first //bit1:SPO=1. SPI Sample data on the rising edge of the clock */ }
【Slave4j与Hi快速开发框架详解】 Slave4j是一个辅助开发者快速构建企业级应用的框架,它简化了项目的初始化和基础代码的生成工作。通过简单的步骤,开发者可以在Eclipse或Myeclipse环境中快速集成Slave4j,提高...
标题“Master_slave_multi_machine.rar_Master-slave_Master/Slave_multi m”暗示了我们正在讨论的焦点是关于主从结构在多机器环境中的应用。 描述“主从多机通信系统问题研究建模及其实性研究”表明我们将深入探讨...
ActiveMQ支持多种高可用的主从配置模式,包括Shared File System Master/Slave、JDBC Master/Slave和Replicated LevelDB Store。文章主要介绍了使用JDBC Master/Slave模式来实现ActiveMQ的高可用配置。 在JDBC ...