0

I have a production webserver with a MySQL database setup as Master. I have a dev server with MySQL setup as Slave, with the data successfully being replicated from the Master.

What happens when a developer commits a chance to the Slave db? Is that commit going to screw up the whole setup?

If this is not the ideal situation for a Production / Dev / Staging setup, what would the ideal setup be?

Josh Brower
  • 1,669
  • 3
  • 18
  • 29

1 Answers1

2

What happens when a developer commits a chance to the Slave db? Is that commit going to screw up the whole setup?

If you're committing to the same database that's being replicated then yes, it will most certainly screw things up.

You ought to have a completely different database that your developers can work against. If you want it to be refreshed periodically from production data, that would be fairly easy to set up and automate.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • So what is the ideal way of dealing with this issue in a Prod/Dev env? – Josh Brower Jul 13 '11 at 18:50
  • @Josh - see my edit. Your developers need a separate database instance. You're crazy and asking for trouble if you have them working directly against the production database. – EEAA Jul 13 '11 at 18:52
  • I have no doubt that I am crazy... :) Though technically, they would be working against a copy of the prod db, not the actual prod db. – Josh Brower Jul 13 '11 at 18:57
  • As they work against the prod replica, though, it will gradually get further and further out of sync with production and you'll never really know what state the db is in. Doing what you want to do is just a bad practice all around. Don't do it. – EEAA Jul 13 '11 at 19:00
  • 1
    You can use [mysqldump](http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html) to make the backups and then restore them with the mysql command. I would actually recommend setting up a dev environment for each developer on their local computer and then have a shared test/QA environment. That way they can mess up their own data without affecting everyone else. :-) – Scott Keck-Warren Jul 13 '11 at 19:02
  • @ErikA Yes, I understand. I had a flawed understanding of the implications of this type of setup. So the ideal would be an imported dump of the current prod db, refreshed every so often... (?) – Josh Brower Jul 13 '11 at 19:05
  • @Josh - yep, exactly. – EEAA Jul 13 '11 at 19:06