Women in Technology

Hear us Roar



Article:
  Live Backups of MySQL Using Replication
Subject:   Replica requirements
Date:   2005-11-26 04:55:22
From:   russell_dyer
Response to: Replica requirements

I'm responding pretty late, but for future reference for others, here's my response.


You are correct. The lines I presented in the article to set the values for connecting to the master are only used one, when you first restart the slave server. They are copied to the master.info file, which is by default located in the data directory on the slave. Once the master.info file has the connection information stored in it, the server will ignore these configuration settings or options in the my.cnf file and even at the command-line when the server is restarted. The only way to change them after the master.info file is created is to edit the file--which is not a very good idea--or to use the CHANGE MASTER TO statement that you mentioned. Therefore, to adjust my article, you may as well not include them in the my.cnf file to begin with. Instead, enter them from the slave while logged into MySQL as root or the like:


CHANGE MASTER TO MASTER_HOST = 'master_host';
CHANGE MASTER TO MASTER_PORT = 3306;
CHANGE MASTER TO MASTER_USER = 'replicant';
CHANGE MASTER TO MASTER_PASSWORD = 'my_pwd';


You only need to execute these statements one time to set them since they're stored in the master.info file. They'll survive restarts. If you want to change something like the host name, though, then rerun just the statement with that particular parameter (i.e. MASTER_HOST).


Regarding MacIntosh, although my servers have Linux on them, my laptop now is an iBook G4. Yes, you're right: by default it is set up without the my.cnf file. You can copy some of the sample files like you did, or you can create a new my.cnf file with just the group headings (e.g., [mysqld]) and options that you need with a simple text editor like vi while logged in as root (i.e., su)from a terminal window.