MySQL主從複製問題解決一例
這是mysql關於主從複製的主庫的配置相關內容:
server-id = 1
log-bin=/mysql_log/binlog/bin-log
slave-skip-errors=1062,1205
max_binlog_size = 500M
binlog_cache_size = 128K
relay-log =/mysql_log/relaylog/relaylog
log-slave-updates
之前搭建的MySQL主從複製出現問題,不能正常同步,檢視日誌,發下有以下錯誤:
120726 13:20:36 Could not use /mysql_log/relaylog/relaylog for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
120726 13:20:36 Failed in open_log() called from init_relay_log_info()
120726 13:20:36 Failed to initialize the master info structure
120726 13:20:36 Could not use /mysql_log/binlog/bin-log for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
120801 17:53:00 Failed to open the relay log '/mysql_log/relaylog/relaylog.036' (relay_log_pos 4)
120801 17:53:00 Could not find target log during relay log initialization
120801 17:53:00 Failed to initialize the master info structure
1、關閉mysql
[root@111_ddb ~]# mysqladmin -p shutdown
Enter password:
[root@111_ddb data]# tail -f /home/mysql/data/111_ddb.err
120801 17:56:57 /usr/local/mysql/libexec/mysqld: Normal shutdown
120801 17:56:58 InnoDB: Starting shutdown...
120801 17:57:30 InnoDB: Shutdown completed
120801 17:57:30 /usr/local/mysql/libexec/mysqld: Shutdown Complete
120801 17:57:30 mysqld ended
2、刪除主庫上關於binlog日誌的記錄檔案,msater.info 和 relay-log.info
[root@111_ddb ~]# cd /home/mysql/data/
[root@111_ddb data]# ls
111_ddb.err 111_ddb-slow.log ddb ibdata1 ib_logfile1 master.info mysql_dd slow.log test
111_ddb.pid adb ib_arch_log_0000000000 ib_logfile0 ib_logfile2 mysql relay-log.info tdb
[root@111_ddb data]# ls *info
master.info relay-log.info
[root@111_ddb data]# ls
111_ddb.err 111_ddb-slow.log ddb ibdata1 ib_logfile1 master.info mysql_dd slow.log test
111_ddb.pid adb ib_arch_log_0000000000 ib_logfile0 ib_logfile2 mysql relay-log.info tdb
[root@111_ddb data]# rm -f master.info relay-log.info
[root@111_ddb data]# cd /mysql_log/binlog/
[root@111_ddb binlog]# ls
bin-log.001 bin-log.index
[root@111_ddb binlog]# rm -f *
[root@111_ddb binlog]# cd ../relaylog/
[root@111_ddb relaylog]# ls
relaylog.001 relaylog.index
[root@111_ddb relaylog]# rm -f *
[root@111_ddb relaylog]# cd ../binlog/
3、開啟mysql
[root@111_ddb ~]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/innodb.cnf --datadir=/home/mysql/data --user=mysql &
[root@111_ddb data]# tail -f /home/mysql/data/111_ddb.err
120801 17:58:21 mysqld started
120801 17:58:23 InnoDB: Started
/usr/local/mysql/libexec/mysqld: ready for connections.
Version: '4.0.26-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
[root@111_ddb binlog]# ll
total 13080
-rw-rw---- 1 mysql mysql 13365795 Aug 1 17:59 bin-log.001
-rw-rw---- 1 mysql mysql 30 Aug 1 17:58 bin-log.index
[root@111_ddb binlog]# ll
total 13828
-rw-rw---- 1 mysql mysql 14132046 Aug 1 17:59 bin-log.001
-rw-rw---- 1 mysql mysql 30 Aug 1 17:58 bin-log.index
[root@111_ddb binlog]# ll
total 15020
-rw-rw---- 1 mysql mysql 15355877 Aug 1 17:59 bin-log.001
-rw-rw---- 1 mysql mysql 30 Aug 1 17:58 bin-log.index
透過日誌和檢視binlog檔案,說明主庫的配置恢復正常
©著作權歸作者所有:來自51CTO部落格作者wangyuqian513的原創作品,如需轉載,請註明出處,否則將追究法律責任
MySQL主從複製
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2041/viewspace-2820782/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql主從複製配置與問題解決MySql
- 如何解決MySQL主從複製太慢的問題MySql
- MySQL主從複製延遲解決方案MySql
- 例項解讀:MySQL並行複製如何解決特定的主從問題?MySql並行
- 高頻面試:如何解決MySQL主從複製延時問題面試MySql
- mysql5.7主從複製,主主複製MySql
- mysql複製--主從複製配置MySql
- MySQL主從複製MySql
- 如何解決MySQL 主從複製資料不一致問題MySql
- mysql的主從複製 原理講解MySql
- MySQL主從複製之GTID複製MySql
- MySQL主從複製原理MySql
- MySQL的主從複製MySql
- mysql--主從複製MySql
- mysql 8.4 主從複製MySql
- mysql主從複製搭建MySql
- MySQL主從複製之半同步複製MySql
- MySQL主從複製之非同步複製MySql非同步
- 深入瞭解MySQL主從複製的原理MySql
- MySQL++:Liunx - MySQL 主從複製MySql
- MySQL(13)---MYSQL主從複製原理MySql
- mysql主從複製(一):一主多從MySql
- windows 下mysql主從複製WindowsMySql
- mysql實現主從複製MySql
- mysql主從延遲複製MySql
- MySQL 主從複製實操MySql
- MYSQL主從複製配置(整理)MySql
- MySQL主從複製歷程MySql
- MySQL-18.主從複製MySql
- Windows Mysql主從複製部署WindowsMySql
- Mysql 傳統主從複製MySql
- MySQL8.0主從複製MySql
- Windows 環境下,MySQL 的主從複製和主主複製WindowsMySql
- windows環境下,Mysql的主從複製和主主複製WindowsMySql
- MySQL 主從複製之多執行緒複製MySql執行緒
- MySQL 主從複製,常見的binlog錯誤及解決方法MySql
- MySQL(14)---Docker搭建MySQL主從複製(一主一從)MySqlDocker
- MYSQL主從複製製作配置方案MySql