Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How I make a local MySQL database update a mirror on internet all the time it is possible?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

You'll need to setup MySQL replication. You can find thorough docs here:

http://dev.mysql.com/doc/refman/5.0/en/replication.html

I agree with Craig, but I've had issues with MySQL and SSL over the Internet. I've actually used SSH tunnels instead and they've worked remarkably well. I use a wrapper called autossh (http://www.harding.motd.ca/autossh/) to manage the connections if they die.

If you're interested, here's the command I've used (note you only need to set it up on one end of the tunnel since this connection creates a bi-directional communication channel):

# /usr/bin/ssh -2 -N -o ServerAliveInterval=15 -i /root/.ssh/id_rsa -N -R \
  13306:127.0.0.1:3306 -L 13306:127.0.0.1:3306 root@<REMOTEIP>

What this does is create a tunnel on port 13306 on both ends to the MySQL instance running on the other side. To setup replication, you point the "master" server to 127.0.0.1 on port 13306. To wrap it with autossh, use this command:

# /usr/local/bin/autossh -2 -fN -M 20000 -o ServerAliveInterval=15\
 -i /root/.ssh/id_rsa -N -R 13306:127.0.0.1:3306 -L 13306:127.0.0.1:3306 root@<REMOTEIP>

Good Luck!

share|improve this answer

I think you're looking for MySQL replication

http://www.howtoforge.com/mysql_database_replication

share|improve this answer

You can set up MySQL to perform replication over SSL. We replicate one our servers from the midwest to the west coast over SSL, 150K+ records/day without problem. But, it requires access to the configuration of the slave server (the mirror in your question).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.