Hackish HOWTO: migrating a (larger) running OpenX installation to a new machine +

Disclaimer: It’s a hack, but it worked :) You’re doing this at your own risk! Copying raw Mysql database files may corrupt your data to the point of no return!

First, a little background information: we’ve been using OpenAds / OpenX even back in the days when it was called phpAdsNew.

Last fall (septmeber to be exact) we’ve launched a new website, that ran OpenAds, a Vbulletin forum, and a custom CMS / application for other parts of the site.

At the beginning a single server was able to handle it all. Recently, however, the site usage grew, and the OpenX database grew to around 1.5GB in size, serving around 7 million ad impressions per month.

A new server appeared and it was decided we’re gonna move OpenX to its own dedicated machine.

Trying to dump the database contents to .sql files was proven to not be doable (without taking the server down for maintenance, which we felt was not good for our users). We wanted to migrate it without taking the server down and users noticing anything (if possible).

So, another solution was to be found, and here’s how we hacked it, in case someone else finds themselves in a similar situation:

  • create a new empty database on the new server
  • scp the raw *.frm, *.myd and *.myi files from your old server’s mysql data dir to the newly created db’s data dir on the new server
  • chown the newly copied files to the appropriate user/group under which mysql is running on the new server (if different from the old one)
  • run mysqlrepair –database new_server_db_name –repair (see http://dev.mysql.com/doc/refman/5.1/en/mysqlcheck.html for more info and options)
  • scp the OpenX files over to the new server and chown/chmod appropriately
  • modify the OpenX config file in var/ if you’re changing the server’s public address and stuff like that

And that’s it. Everything worked after that.

After seeing that it all works, we upgraded to the latest OpenX release (2.4.7 at the time of writing) by just following the upgrade docs from the manual.

Once again, keep in mind that copying raw db files might cause MAJOR PROBLEMS, incompatibility issues, data inconsistencies etc.

You’re doing this at your own risk. Make sure that the Mysql versions are the same on both servers.

One Response to “Hackish HOWTO: migrating a (larger) running OpenX installation to a new machine”

  1. Oh my, sounds like fun. I’ve used this technique so many times - I consider it to be 100% legit. :) I’ve lost mysql users and roles few times when I copied data between different mysql versions, but yes in situation like yours it’s acceptable risk.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>