- 论坛徽章:
- 0
|
回复 最不爱吃鱼
同步历史数据就以下几个步骤,在做下面几步之前,应该先设置好主从同步,比如建同 ...
飞鸿无痕 发表于 2011-09-22 08:55 ![]()
我是这样做的
主服务器my.cnf
server-id=1
log-bin=log
binlog-do-db=xxxooo
grant all privileges on *.* to 'root'@'192.168.0.171' identified by '123456';
从服务器my.cnf
server-id=2
create database `xxxooo` default character set utf8 collate utf8_general_ci ;
#锁定主服务器的表
flush tables with read lock;
show mater status; #记录log.000数值 post值
mysqldump -uroot -p xxxooo > 备份的sql
unlock tables; 解锁表
#恢复slave的表
mysql -uroot -p xxxooo < 备份的sql
stop slave;
change master to master_host='192.168.0.130', master_user='root', master_password='123456', master_log_file='log.000 ' ,master_log_pos= ;
start slave;
由于主的部分2进制文件我备份到另外一台机器上了,所以不全,另外主还用了innodb引擎,数据都是记录在ibdata里的。
现在mysql报错
110922 10:15:23 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
110922 10:15:23 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file', Error_code: 1236
110922 10:15:23 [Note] Slave I/O thread exiting, read up to log 'log.00048', position 106
110922 10:18:05 [Note] Error reading relay log event: slave SQL thread was killed
110922 10:18:24 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='192.168.0.101', master_port='3306', master_log_file='log.00048', master_log_pos='106'. New state master_host='192.168.0.101', master_port='3306', master_log_file='log.00049', master_log_pos='19863'.
110922 10:18:27 [Note] Slave SQL thread initialized, starting replication in log 'log.00049' at position 19863, relay log './mail-relay-bin.000001' position: 4
110922 10:18:27 [Note] Slave I/O thread: connected to master 'slave@192.168.0.101:3306',replication started in log 'log.00049' at position 19863
110922 10:18:27 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
110922 10:18:27 [fly][ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file', [/fly]Error_code: 1236
110922 10:18:27 [Note] Slave I/O thread exiting, read up to log 'log.00049', position 19863
现在是这样,我晚上的时候访问量少,把站点停掉按照你的方法在试试,先谢过了。 |
|