天天看點

mysql:Neither --relay-log nor --relay-log-index were used; so replication may break

mysql replication 錯誤

mysql :Neither --relay-log nor --relay-log-index were used; so replication may break

2011-03-21 15:58

The syntax 'for replication startup options' is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead

你的配置檔案裡有某些選項是和5.2版本不相容的,被mysql屏蔽了,這個不影響同步。

Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=localhost-relay-bin' to avoid this problem.

由于你的配置檔案裡面沒有 --relay-log或者--relay-log-index,當你的伺服器作為slave并且更改主機名的時候,同步會被停止。如果你一直沒有改主機名就無所謂

start slave; 報錯日志

100607 10:48:47 [ERROR] Failed to open the relay log './localhost-relay-bin.000010' (relay_log_pos 2787)

100607 10:48:47 [ERROR] Could not find target log during relay log initialization

100607 10:48:47 [ERROR] Failed to initialize the master info structure

= = =

原因 :

 同步錯誤原因已找到

同步日志檔案名 預設是使用 主機名 來定義的

今天把主機名 localhost 改成 slave 

是以同步出錯 ...

現在定義 mysql 日志名為 slave-relay-bin

relay-log = slave-relay-bin

以後不會出現同樣的錯誤了 

解決 :

stop slave;

reset slave;

# mysql master 最新狀态

change master to

master_host='192.168.0.192',

master_user='username',

master_password='password',

master_port=3306,

master_log_file='log-bin.000017',

master_log_pos=600;

slave start;

還需要在 my.cnf 裡面定義 relay-log = slave-relay-bin  (隻要不以主機名定義)