2016-08-04 65 views
0

嗨,我們有mysql主從複製,master是mysql 5.6,slave是mysql 5.7,master在master後面是245000,我怎麼讓它趕上更快。現在複製10萬秒需要6個多小時。Mysql seconds_behind master很高

我的奴隸公羊是128 GB。以下是my.cnf

[mysqld] 

    # Remove leading # and set to the amount of RAM for the most important data 
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 
    innodb_buffer_pool_size = 110G 

# Remove leading # to turn on a very important data integrity option: logging 
# changes to the binary log between backups. 
# log_bin 

# These are commonly set, remove the # and set as required. 
basedir   = /usr/local/mysql 
datadir   = /disk1/mysqldata 
port = 3306 
#server_id = 3 
socket = /var/run/mysqld/mysqld.sock 
user=mysql 
log_error    = /var/log/mysql/error.log 
# Remove leading # to set options mainly useful for reporting servers. 
# The server defaults are faster for transactions and fast SELECTs. 
# Adjust sizes as needed, experiment to find the optimal values. 
join_buffer_size = 256M 
sort_buffer_size = 128M 
read_rnd_buffer_size = 2M 

#copied from old config 
#key_buffer    = 16M 
max_allowed_packet  = 256M 
thread_stack   = 192K 
thread_cache_size  = 8 
query_cache_limit  = 1M 
#disabling query_cache_size and type, for replication purpose, need to enable it when going live 
query_cache_size  = 0 
#query_cache_size  = 64M 
#query_cache_type = 1 
query_cache_type = OFF 
#GroupBy 
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
enforce-gtid-consistency 
gtid-mode = ON 
log_slave_updates=0 
slave_transaction_retries = 100 
#replication related changes 
server-id    = 2 
relay-log    = /disk1/mysqllog/mysql-relay-bin.log 
log_bin     = /disk1/mysqllog/binlog/mysql-bin.log 
binlog_do_db   = brandmanagement 
#replicate_wild_do_table=brandmanagement.% 
replicate-wild-ignore-table=brandmanagement.t\_gnip\_data\_recent 
replicate-wild-ignore-table=brandmanagement.t\_gnip\_data 
replicate-wild-ignore-table=brandmanagement.t\_fb\_rt\_data 
replicate-wild-ignore-table=brandmanagement.t\_keyword\_tweets 
replicate-wild-ignore-table=brandmanagement.t\_gnip\_data\_old 
replicate-wild-ignore-table=brandmanagement.t\_gnip\_data\_new 
binlog_format=row 
report-host=10.125.133.220 
report-port=3306 
#sync-master-info=1 
read-only=1 
net_read_timeout = 7200 
net_write_timeout = 7200 
innodb_flush_log_at_trx_commit = 2 
sync_binlog=0 
sync_relay_log_info=0 
max_relay_log_size=268435456 

回答

0

很多可能的解決方案。但我會用最簡單的一個。你有足夠的網絡帶寬來發送網絡上的所有變化嗎?您正在使用「行」binlog,這在隨機的,無索引的更新的情況下可能會很好。但是,如果您只是使用索引更改大量數據,那麼「混合」binlog可能會更好。

+0

感謝您的建議,實際上我們每天都會做很多更新。我們的帶寬非常好。我會改變混合並嘗試一次。任何其他建議基於我們的my.cnf將不勝感激。 – user2674154

+0

我改變了它混合,現在表現更好。有什麼辦法可以增加它嗎? – user2674154

+0

@ user2674154檢查mysqltuner.pl對你的服務器有什麼要說的。不要盲目相信它所說的一切,但請閱讀它標記的設置。 – viraptor