MySQL 5.6 リファレンスマニュアル  /  レプリケーション  /  レプリケーションの実装

17.2 レプリケーションの実装

レプリケーションは、データベースへのあらゆる変更 (更新、削除など) をバイナリログで追跡するマスターサーバーに基づきます。バイナリログは、サーバーが起動した瞬間からデータベースの構造または内容 (データ) を変更するあらゆるイベントが書き込まれた記録として機能します。SELECT ステートメントは通常、データベースの構造および内容を変更しないため記録されません。







Download this Manual
EPUB - 7.5Mb
HTML Download (TGZ) - 7.1Mb
HTML Download (Zip) - 7.2Mb
User Comments
  Posted by David Tonhofer on September 10, 2004
When setting up replication from one database to another on the same machine I *strongly* recommend compiling MySQL once as the master server and once as the slave server, both with their separate 'localstatedir' and 'port' given in the "configure" command. Then give each its own my.cnf in its respective 'localstatedir'. Finally, make sure either the master's 'bin' is in your PATH if your want to work with master or the slave's 'bin' is in your path if you want to connect to the slave. Otherwise you *will* make an error sooner or later regarding to which server you are connected.

And passing --port on the command line does not help: unexpectedly, it does NOT override the value found in my.cnf.

Good luck!

  Posted by no no on January 15, 2005
"After the slave has been set up with a copy of the master's data, it will simply connect to the master and wait for updates to process. If the master goes away or the slave loses connectivity with your master, it will keep trying to connect periodically until it is able to reconnect and resume listening for updates. The retry interval is controlled by the --master-connect-retry option. The default is 60 seconds."

Note the above is not the case in MySQL 4.0.22 -- documentation might need to be updated to clarify which version it is talking about. (FWIW, just had a master die, come back up, and 10 minutes later the slaves still thought they were connected to the first instance.)
  Posted by Joao S. O. Bueno Calligaris on October 22, 2005
For tables other than MyISAM, a work around is to create the table structure on the slave server with ENGINE=FEDERATED, pointing at the server table.

Once it is properly setup, you can alter the table to the engine of your choice, and a local copy will be made. (e.g. ALTER TABLE my_data ENGINE=InnoDB; )

This have to be done on a per table basis, though.
Sign Up Login You must be logged in to post a comment.