我有以下问题。我已经成功设置了主副本(基于行)。它已经运行了2-3个小时。bin-log 旋转后 -> mysql-bin.index 文件在 master 上损坏。
这是显示主日志;
显示主日志\G
*************************** 1. row ***************************
Log_name: mysql-bin.000001
File_size: 27682022
*************************** 2. row ***************************
Log_name: mysqld Ver 5.1.73-5-beget-log for debian-linux-gnu on x86_64 ((LTD BeGet))
File_size: 0
*************************** 3. row ***************************
Log_name: or its affiliates
File_size: 0
*************************** 4. row ***************************
Log_name: or its affiliates. All rights reserved.
File_size: 0
4 rows in set (0.00 sec)
master上mysql的配置文件:
cat /etc/mysql/my.cnf | grep -v -E "^$" | grep -v -E "^#"
[mysqld]
event_scheduler = 1
interactive_timeout = 30
set-variable = wait_timeout=30
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /home/mysql
tmpdir = /home/tmpfs
server_id = 1
log-bin = mysql-bin
binlog-do-db = somedb
binlog-format = row
skip-external-locking
bind-address = 0.0.0.0
default-character-set = UTF8
innodb_file_per_table = 1
max_allowed_packet = 128M
thread_stack = 512K
thread_cache_size = 64
myisam-recover = BACKUP
thread_concurrency = 48
max_user_connections = 100
max_connections = 200
back_log = 500
join_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 8M
sort_buffer_size = 4M
myisam_sort_buffer_size = 512M
query_cache_limit = 4M
query_cache_size = 128M
tmp_table_size = 5000M
max_heap_table_size = 5000M
key_buffer = 128M
max_connect_errors = 65000
max_error_count = 65000
key_buffer_size = 102M
open_files_limit = 1040000
table_open_cache = 10000
table_definition_cache = 100000
mysql-bin.index 文件包含 mysqld --help 的输出
显示从属状态有以下错误:
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 4
Relay_Log_File: mysqld-relay-bin.000003
Relay_Log_Pos: 152
Relay_Master_Log_File: mysql-bin.000002
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
Last_SQL_Errno: 0
Last_SQL_Error:
mysql版本:
mysql -V
mysql Ver 14.14 Distrib 5.1.73, for debian-linux-gnu (x86_64) using readline 5.1
我在错误日志中没有发现任何奇怪的东西。其实我不知道如何调试这个。任何帮助将不胜感激。
好的,回答我自己的问题。这是我们在 MySQL 服务器中发现的一个错误。简单来说,我们有 nagios 检查,看起来像
mysqld --verbose --help 2>&1 >&-
好的,问题来了,标准输出已关闭。mysql 将输出打印到之前打开的索引文件中。
我们为此案例打开了错误: https ://bugs.launchpad.net/percona-server/+bug/1401547
修复很简单,只需删除 >&-,所以我们没有关闭标准输出,但它仍然是奇怪的行为。