Last week I’ve got a brand new server to play with ;). The mission was clear (I’m going over there, I’m going to do the mission…) – upgrade, install all essential stuff, prepare and migrate the data from the old machine. So here’s what I’ve done so far (except setting up system accounts, ssh access and all that basic stuff):
installed fresh Apache & PHP from ubuntu repositories – I’m aware it’s not 100% up to date, but – it’s stable, and I didn’t want to go as war as PHP 5.4 as it’s breaks a lot of stuff with existing applications (and I didn’t had time to fix it all on my own), also lack of Suhosin patch for 5.4 is a little bit disappointing (well – it’s available but it’s still a development version)
rotated logs in apache for most sites, as they can get out of control sometimes and cause slowdowns
moved some of simple cronjobs tasks that involved only some mysql deletes/updates into MySQL events
installed RVM with Ruby 1.9.3 (with standalone passanger that handled legacy 1.8.7/Rails2 apps – with weird dependencies, hacked gems and lack of tests – trust me, it wasn’t pleasant ride). Tip: remember to enable and configure all essential proxy modules under apache, and keep an eye on your gemsets so you don’t mix it during the process.
updated some database backup scripts
configured monit to make sure that everything is running smoothly and without interruptions. Monit is a great (and free!) tool by the way – be sure to check it out. You can also buy a license for M/Monit which is monit on steroids.
and here quick way to dump MySQL tables that you need from old server to the new one:
You execute this command on old server, pipe it to
pv (for some neat progress bar) and then to the new server. Here description of options I decided to go with (tweak it as you please for your needs):
Add a DROP TABLE statement before each CREATE TABLE statement.
Add a DROP DATABASE statement before each CREATE DATABASE statement. This option is typically used in conjunction with the —all-databases or —databases option because no CREATE DATABASE statements are written unless one of those options is specified.
Dump several databases. Normally, mysqldump treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names. CREATE DATABASE and USE statements are included in the output before each new database.
Use multiple-row INSERT syntax that include several VALUES lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.
Log warnings and errors by appending them to the named file. The default is to do no logging.
This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out (this may be already set as default in your my.cfg file).
Include all MySQL-specific table options in the CREATE TABLE statements.