Merlin
Merlin

Reputation: 25639

How to Sync MySQL with python?

Im setting a VM.

Both host and VM machine have Mysql. How do keep the VM Mysql sync'd to to the host Mysql. Host is using MYsql 5.5 on XP. VM is Mysql 5.1 on Fedora 14.

1) I could DUMP to "shared," Restore. Not sure if this will work. 2) I could network Mysql Host to Mysql VM. Not how to do this

How would I do this with python 2.7?

I dont want them in sync after set-up phase. But, maybe sync some tables or SP occasionly on-rewrites. After I build out Linux Env. I would like to be able to convert V2P and have a dual-boot system.

Upvotes: 1

Views: 2719

Answers (3)

richo
richo

Reputation: 8989

Do you want it synced in realtime?

Why not just connect the guest's mysql process to the host?

Upvotes: 0

Apalala
Apalala

Reputation: 9224

You can use mysqldump to make snapshots of the database, and to restore it to known states after tests.

But instead or going into the complication of synchronizing different database instances, it would be best to open the host machine's instance to local network access, and have the applications in the virtual machine access that as if it was a remote server. Overall performance should improve too.

Even if you decide to run different databases for the host and the guest, run then both on the host's MySQL instance. Performance will be better, configuration management will be easier, and the apps in the guest will be tested against a realistic deployment environment.

Upvotes: 1

Mark Loeser
Mark Loeser

Reputation: 18627

Why are you using Python? Just use the built in replication abilities: http://dev.mysql.com/doc/refman/5.5/en/replication.html

Upvotes: 0

Related Questions