mysql主从同步问题解决汇总
问题:ERROR 1201 (HY000): Could not initialize master info structure; more error messa
1、出现错误提示、
Slave I/O: error connecting to master 'backup@192.168.1.x:3306' - retry-time: 60 retries: 86400, Error_code: 1045 |
解决方法
从服务器上删除掉所有的二进制日志文件,包括一个数据目录下的master.info文件和hostname-relay-bin开头的文件。
master.info::记录了Mysql主服务器上的日志文件和记录位置、连接的密码。
2、出现错误提示
Error reading packet from server: File '/home/mysql/mysqlLog/log.000001' not found (Errcode: 2) ( server_errno=29) |
解决方案:
由于主服务器运行了一段时间,产生了二进制文件,而slave是从log.000001开始读取的,删除主机二进制文件,包括log.index文件。
3、错误提示如下
Slave SQL: Error 'Table 'xxxx' doesn't exist' on query. Default database: 't591'. Query: 'INSERT INTO `xxxx`(type,post_id,browsenum) SELECT type,post_id,browsenum FROM xxxx WHERE hitdate='20090209'', Error_code: 1146 |
解决方法
由于slave没有此table表,添加这个表,使用slave start 就可以继续同步。
4、错误提示如下
Error 'Duplicate entry '1' for key 1' on query. Default database: 'movivi1'. Query: 'INSERT INTO `v1vid0_user_samename` VALUES(null,1,'123','11','4545','123')' Error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' on query. Default database: 'club'. Query: 'INSERT INTO club.point_process ( GIVEID, GETID, POINT, CREATETIME, DEMO ) VALUES ( 0, 4971112, 5, '2010-12-19 16:29:28',' 1 row in set (0.00 sec) |
Mysql > Slave status\G;
显示:Slave_SQL_Running 为 NO
解决方法:
Mysql > stop slave;
Mysql > set global sql_slave_skip_counter =1 ;
Mysql > start slave;
5、错误提示如下
# show slave status\G;
Master_Log_File: mysql-bin.000029 Read_Master_Log_Pos: 3154083 Relay_Log_File: c7-relay-bin.000178 Relay_Log_Pos: 633 Relay_Master_Log_File: mysql-bin.000025 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: club Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1594 Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Skip_Counter: 0 Exec_Master_Log_Pos: 1010663436 |
这个问题原因是,主数据库突然停止或问题终止,更改了mysql-bin.xxx日志,slave服务器找不到这个文件,需要找到同步的点和日志文件,然后chage master即可。
解决方法:
change master to master_host='211.103.156.198', master_user='同步帐号', master_password='同步密码', master_port=3306, master_log_file='mysql-bin.000025', master_log_pos=; |
6、错误提示如下
Error 'Unknown column 'qdir' in 'field list'' on query. Default database: 'club'. Query: 'insert into club.question_del (id, pid, ques_name, givepoint, title, subject, subject_pid, createtime, approve, did, status, intime, order_d, endtime,banzhu_uid,banzhu_uname,del_cause,qdir) select id, pid, ques_name, givepoint, title, subject, subject_pid, createtime, approve, did, status, intime, order_d, endtime,'1521859','admin0523','无意义回复',qdir from club.question where id=7330212' 1 row in set (0.00 sec) |
这个错误就说club.question_del 表里面没有qdir这个字段 造成的加上就可以了~!
在主的mysql : 里面查询 Desc club.question_del;
在 错误的从服务器上执行 : alter table question_del add qdir varchar(30) not null;
7、错误提示如下
Slave_IO_Running: NO |
这个错误就是IO 进程没连接上 ,想办法连接上把 把与主的POS 号和文件一定要对,然后重新加载下数据。具体步骤:
slave stop;
change master to master_host='IP地址',master_user='club',master_password='mima ',master_log_file='mysqld-bin.000048',MASTER_LOG_POS=396549485;
注:master_log_file='mysqld-bin.000048',MASTER_LOG_POS=396549485;是从主的上面查出 来的 :show master status\G;
LOAD DATA FROM MASTER;
load data from master;
slave start;
mysql主从同步问题解决汇总的更多相关文章
- Mysql主从同步问题汇总
data-1-1主机是master,data-1-2是slave Last_IO_Errno: 1236 slave查看show slave status\G; 显示Last_IO_Errno: 12 ...
- MySQL主从同步异常问题解决Client requested master to start replication from position > file size
MySQL主从同步异常问题解决Client requested master to start replication from position > file size 一.问题描述 MySQ ...
- MySQL主从同步、读写分离配置步骤、问题解决笔记
MySQL主从同步.读写分离配置步骤.问题解决笔记 根据要求配置MySQL主从备份.读写分离,结合网上的文档,对搭建的步骤和出现的问题以及解决的过程做了如下笔记: 现在使用的两台服务器已经 ...
- mysql主从同步(3)-percona-toolkit工具(数据一致性监测、延迟监控)使用梳理
转自:http://www.cnblogs.com/kevingrace/p/6261091.html 在mysql工作中接触最多的就是mysql replication mysql在复制方面还是会有 ...
- nagios系列(七)nagios通过自定义脚本的方式监控mysql主从同步
nagios监控mysql主从同步 起因:nagios可能监控到mysql服务的运行情况,但确不能监控mysql的主从复制是否正常:有时候,同步已经停止,但管理人员却不知道. 登陆mysql从服务器, ...
- Mysql 主从同步原理简析
在开始讲述原理的情况下,我们先来做个知识汇总,究竟什么是主从,为什么要搞主从,可以怎么实现主从,mysql主从同步的原理1.什么是主从其实主从这个概念非常简单主机就是我们平常主要用来读写的服务,我们称 ...
- zabbix3.0.4监控mysql主从同步
zabbix3.0.4监控mysql主从同步 1.监控mysql主从同步原理: 执行一个命令 mysql -u zabbix -pzabbix -e 'show slave status\G' 我们在 ...
- MySQL主从同步几个文件
MySQL主从同步: M锁表 M导出S导入 M解锁 M建同步帐号 S获取点位:产生master.info S开启同步 3306: mysql-bin.0000x mysql-bin.index ...
- 监控mysql主从同步状态脚本
监控mysql主从同步状态脚本 示例一: cat check_mysql_health #!/bin/sh slave_is=($(mysql -S /tmp/mysql3307.sock -uroo ...
随机推荐
- 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。
错误:已超过传入消息(65536)的最大消息大小配额.若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性. 或者 错误:反序列化操作“GetAllUserData ...
- 设计模式--建造者(Builder)模式
将一个复杂的构建与其表示相分离,使得同样的构建过程可以创建不同的表示 --<设计模 ...
- Worm.Win32.DownLoader.ns病毒主进程新式输入法注入分析(IME Inject)
1.病毒会在system32目录生成一个以tmp结尾的随机数命名的文件. 2.然后挂钩HOOK本进程空间的imm32.dll导出的ImmLoadLayout函数和ntdll.dll导出的ZwQuery ...
- C#语言各种集合介绍
集合,表示可以通过遍历每个元素来访问的一组对象(特别是可使用foreach循环访问)一个集合包括多个元素,即有一个集合类对象和N个元素对象 因为任何集合类都实现了IEnumerable接口,所以任何集 ...
- 2. npm 的使用
NPM是随同NodeJS一起安装的包管理工具,能解决NodeJS代码部署上的很多问题,常见的使用场景有以下几种: 允许用户从NPM服务器下载别人编写的第三方包到本地使用. 允许用户从NPM服务器下载并 ...
- saltstack学习笔记1 --安装
salt官网:http://docs.saltstack.cn/zh_CN/latest/ 安装教程: - http://docs.saltstack.cn/zh_CN/latest/topics/i ...
- SQL数据库基础(六)
子查询,又叫做嵌套查询. 将一个查询语句做为一个结果集供其他SQL语句使用,就像使用普通的表一样,被当作结果集的查询语句被称为子查询. 子查询有两种类型: 一种是只返回一个单值的子查询,这时它可以用在 ...
- js中的排序
不靠谱的sort() 众所周知,js中的sort()排序是按字母表顺序排序的,这就导致如下现象: var a = [9,60,111,55,8,7777]; a.sort(); alert(a); / ...
- android Adapter剖析理解
UI控件都是跟Adapter(适配器)打交道的 Adapter: 是用来帮助控件填充数据的中间桥梁 (在开发中大多数Textview控件的内容是依靠数据库传递并显示的如:新闻类) Adapter: 将 ...
- 为什么要选择Sublime Text3?
为什么要选择Sublime Text3? Sublime Text3 自动保存,打开图片 跨平台启动快!!!!多行游标,太好用. 插件,简直选不过来. 代码片段 VIM兼容模式 菜单栏基础功能介绍 F ...