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

I like having network disabled on mysql, but now I need to replicate one table across two servers. That is, the table will be updated on one server and then I need a copy of that table to be maintained on another server. Is there a reasonable way to do this without enabling network access?

My initial idea was to use socat to create a pipe using something like:

socat "UNIX-LISTEN:/tmp/mysql.sock.server2,reuseaddr,fork" \
EXEC:'ssh server2.mydomain.com \
socat STDIO UNIX-CONNECT\:/tmp/mysql.sock'

and then let the slave communicate to the master via that socket. So far that works great for starting a command-line client but I'm not sure how to proceed, if that approach is even possible.

If something like this doesn't work, then I'll probably just be doing the replication manually using a shell script that runs periodically to sync the tables over ssh.

share|improve this question
2  
Why are you averse to enabling network access? Just enable it, but then limit access to that port via iptables. Or alteratively, just have it listen on 127.0.0.1 and replicate over ssh. If you think too hard about this and implement something non-standard, don't expect help from anyone if you get yourself into a bind down the road. –  EEAA Mar 8 '12 at 16:58
    
@ErikA Can you point me to a reference for replicating over ssh? That might just be what I want to do, if there's a straightforward standard process for that. –  Thom Blake Mar 8 '12 at 17:00
    
There are dozens of how-tos - just google "mysql replication over ssh". –  EEAA Mar 8 '12 at 17:12
    
You can also replicate over SSL. Use self-signed certs. –  Craig Mar 8 '12 at 17:23
    
@ErikA Oh, do you mean using ssh tunneling and having it listen to a port on 127.0.0.1? Yeah, i'm familiar with that. Probably just going to go with a dump over ssh solution - the db is small. –  Thom Blake Mar 8 '12 at 18:37
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.