zl624867243 发表于 2015-11-05 16:05

msyql主从不一致,

昨天搞了一晚上主从还是不一致,都重装了mysql也不行,以前搭建主从都很简单的怎么这次老是不成功。mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: 192.168.20.130
                  Master_User: rep
                  Master_Port: 3306
                Connect_Retry: 60
            Master_Log_File: mysql-bin.000012
          Read_Master_Log_Pos: 107
               Relay_Log_File: relay-log.000001
                Relay_Log_Pos: 4
      Relay_Master_Log_File: mysql-bin.000012
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
            Replicate_Do_DB: test
          Replicate_Ignore_DB:
         Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
               Skip_Counter: 1
          Exec_Master_Log_Pos: 107
            Relay_Log_Space: 407
            Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
      Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                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:
Replicate_Ignore_Server_Ids:
             Master_Server_Id: 15
1 row in set (0.00 sec)

ERROR:
No query specifiedMaster的my.cnf如下:
port=3306
socket=/usr/local/mysql/tmp/mysql.sock
default-character-set=utf8


port=3306
socket=/usr/local/mysql/tmp/mysql.sock
no-auto-rehash
default-character-set=utf8
#prompt=\\u@\\d \\R:\\m>


##GENERAL
port=3306
server_id=15
socket=/usr/local/mysql/tmp/mysql.sock
datadir=/data/dbdata/mysqldata
back_log=500
event_scheduler=ON

##INNODB DATA
innodb_file_per_table=1## 不存共享表

innodb_additional_mem_pool_size=20M
innodb_buffer_pool_size=20M
innodb_data_file_path=ibdata1:1G:autoextend
innodb_data_home_dir=/data/dbdata/mysqldata
innodb_read_io_threads=4
innodb_write_io_threads=4
innodb_lock_wait_timeout=120
innodb_adaptive_hash_index = 1
innodb_adaptive_flushing = 1
innodb_thread_concurrency=16
innodb_flush_method=O_DIRECT
innodb_max_dirty_pages_pct = 75
innodb_io_capacity=500
innodb_support_xa=0

##INNODB LOG
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=64M
innodb_log_file_size=512M
innodb_log_files_in_group=3
innodb_log_group_home_dir=/data/dbdata/mysqldata


##MyISAM
key_buffer_size=64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
concurrent_insert = 2

## LOG
sync_binlog=0
binlog_format=mixed
max_binlog_size=1G
log_bin=/data/dbdata/mysqllog/binlog/binlog.bin
log_bin_trust_function_creators=1
expire_logs_days=10
slow_query_log
slow_query_log_file=/data/dbdata/mysqllog/slow-query.log
long_query_time=1
relay-log=/data/dbdata/mysqllog/relay-log/relay-log.bin

##PRIVITE CACHE
read_buffer_size = 4M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
sort_buffer_size = 6M
join_buffer_size = 4M

##CACHE
query_cache_type = 0
query_cache_size = 0
query_cache_limit = 2M
tmp_table_size = 128M
table_open_cache = 5120
thread_cache=8
thread_concurrency=8
open_files_limit=65535

##MAX LIMIT
max_connections=500
max_length_for_sort_data=8096
max_heap_table_size = 64M
max_allowed_packet=60M
max_connect_errors=99999999

##TIME OUT
wait_timeout=300
interactive_timeout=300

##REPLICATE
replicate-ignore-db=mysql
replicate-wild-ignore-table=mysql.%
#binlog-do-db=test

##OTHER
skip-external-locking
skip_name_resolve=1
slave_skip_errors = all


max_allowed_packet=512M
quick
从的my.cnf配置文件如下:
port=3306
socket=/usr/local/mysql/tmp/mysql.sock
default-character-set=utf8


port=3306
socket=/usr/local/mysql/tmp/mysql.sock
no-auto-rehash
default-character-set=utf8
#prompt=\\u@\\d \\R:\\m>


##GENERAL
port=3306
server_id=13
socket=/usr/local/mysql/tmp/mysql.sock
datadir=/data/dbdata/mysqldata
back_log=500
event_scheduler=ON

##INNODB DATA
innodb_file_per_table=1## 不存共享表

innodb_additional_mem_pool_size=20M
innodb_buffer_pool_size=20M
innodb_data_file_path=ibdata1:1G:autoextend
innodb_data_home_dir=/data/dbdata/mysqldata
innodb_read_io_threads=4
innodb_write_io_threads=4
innodb_lock_wait_timeout=120
innodb_adaptive_hash_index = 1
innodb_adaptive_flushing = 1
innodb_thread_concurrency=16
innodb_flush_method=O_DIRECT
innodb_max_dirty_pages_pct = 75
innodb_io_capacity=500
innodb_support_xa=0

##INNODB LOG
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=64M
innodb_log_file_size=512M
innodb_log_files_in_group=3
innodb_log_group_home_dir=/data/dbdata/mysqldata


##MyISAM
key_buffer_size=64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
concurrent_insert = 2

## LOG
sync_binlog=0
binlog_format=mixed
max_binlog_size=1G
log_bin=/data/dbdata/mysqllog/binlog/binlog.bin
log_bin_trust_function_creators=1
expire_logs_days=10
slow_query_log
slow_query_log_file=/data/dbdata/mysqllog/slow-query.log
long_query_time=1
relay-log=/data/dbdata/mysqllog/relay-log/relay-log.bin

##PRIVITE CACHE
read_buffer_size = 4M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
sort_buffer_size = 6M
join_buffer_size = 4M

##CACHE
query_cache_type = 0
query_cache_size = 0
query_cache_limit = 2M
tmp_table_size = 128M
table_open_cache = 5120
thread_cache=8
thread_concurrency=8
open_files_limit=65535

##MAX LIMIT
max_connections=500
max_length_for_sort_data=8096
max_heap_table_size = 64M
max_allowed_packet=60M
max_connect_errors=99999999

##TIME OUT
wait_timeout=300
interactive_timeout=300

##REPLICATE
#replicate-ignore-db=mysql
#replicate-wild-ignore-table=mysql.%
#replicate-do-db=test
replicate-do-db=test

##OTHER
skip-external-locking
skip_name_resolve=1
##slave_skip_errors = all


max_allowed_packet=512M
quick
主的配置:
GRANT REPLICATION SLAVE ON *.* TO 'rep'@'%' IDENTIFIED BY '123456';
show master status;

从的配置如下:
change master to master_host='192.168.20.130',master_user='rep',master_password='123456',master_log_file='mysql-bin.000012',master_log_pos=107;

我flushlog也不行,重启了也不行。都是新装数据库。还有log_file,log_pos 都对,网络都通,授权账号也正确 。

Shell_HAT 发表于 2015-11-05 19:14

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file

看看 binary log index file 里面记录的二进制日志列表和操作系统里面真实的二进制日志列表是否一致

zl624867243 发表于 2015-11-05 22:07

回复 2# Shell_HAT

是一致的,求破?# cat binlog.index
/data/dbdata/mysqllog/binlog/binlog.000001
# pwd
/data/dbdata/mysqllog/binlog/data/dbdata/mysqllog/binlog/binlog.000001
# pwd
/data/dbdata/mysqllog/binlog# ll
总用量 8
-rw-rw----. 1 mysql mysql 107 11月5 22:03 relay-log.000001
-rw-rw----. 1 mysql mysql49 11月5 22:03 relay-log.index
# cat relay-log.index
/data/dbdata/mysqllog/relay-log/relay-log.000001
# pwd
/data/dbdata/mysqllog/relay-log
#

zl624867243 发表于 2015-11-06 08:44

我的好了,把relog注释然后重启

zl624867243 发表于 2015-11-06 08:45

我的好了,把relog注释然后重启

rhino11 发表于 2015-11-06 17:31

注释 ?rm /data/dbdata/mysqllog/relay-log/relay-log.*??

zl624867243 发表于 2015-11-09 17:13

回复 6# rhino11

#relay-log=/opt/data/mysql/relay-log/relay-log.bin


   

rhino11 发表于 2015-11-12 18:04

#relay-log=/opt/data/mysql/relay-log/relay-log.bin

主?从?or Both?

XieXie

shang2010 发表于 2015-11-12 19:46

感觉官方还需要加强,据说新版本有改进的,玩过没

zl624867243 发表于 2015-11-14 10:51

本帖最后由 zl624867243 于 2015-11-14 10:51 编辑

回复 8# rhino11


    我都注释了
页: [1] 2
查看完整版本: msyql主从不一致,