Neither --relay-log nor --relay-log-index were used
[mysql]
既存のマスタースレーブ構成のmysqlサーバにレプリケーションを新たに追加して起動したら以下のメッセージが出てレプリケーションが張れなかった。
120123 10:35:00 Warning 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=hostname02-relay-bin' to avoid this problem.
relayログのファイル名がホストと違うのでエラーが出ているとのこと。
コピー元スレーブサーバの
my.cnf
を見ると
relay-log
relay-log-index
の指定をしていなかった。
デフォルトの挙動ではホスト名の付いたlogファイルをmysqlディレクトリ下に作成するようだ。
my.cnfで以下の様に指定しても
relay-log=mysql-bin relay-log-index=mysql-relay-bin
120123 10:22:46 [ERROR] Failed to open the relay log './hostname01-relay-bin.001418' (relay_log_pos 170411730) 120123 10:22:46 [ERROR] Could not find target log during relay log initialization 120123 10:22:46 [ERROR] Failed to initialize the master info structure
とエラーが出てしまうので
この場合は
relay-log=hostname01-relay-bin relay-log-index=hostname01-relay-bin
とするか、再度レプリケーションの設定を一からやり直すしかない。
ホスト名を書き込んでしまうと環境が変わった際に対応が手間なので一からやり直した方がいいだろう。