Hi guys,
You can actually reduce the time more by pre-syncing to the new location.something like:rsync -va /var/lib/pgsql/ /var/lib/pgsql2/service postgres stoprsync -va /var/lib/pgsql/ /var/lib/pgsql2/The second rsync will only copy the deltas from the first, it still has to go in and determine what needs to be copied/what changed but the bulk of it can be prepared/migrated before the actual downtime window.
Thanks a lot @David.
I tested the above and it worked... Here is what I did:
1 - Create /var/lib/pgsql2 directory
mkdir /var/lib/pgsql2
2 - Set permissions:
chown -R postgres:postgres /var/lib/pgsql2
3 - Change postgresql.conf:
data_directory = '/var/lib/pgsql2/9.2/data/'
4 - RSYNC:
rsync -va /var/lib/pgsql/ /var/lib/pgsql2/
5 - Stop postgres
/etc/init.d/postgresql-9.2 stop
5 - Re-run RSYNC to incremental copy:
rsync -va /var/lib/pgsql/ /var/lib/pgsql2/
6 - Change /etc/init.d/postgresql-9.2:
OLD:
PGDATA=/var/lib/pgsql/9.2/data
PGLOG=/var/lib/pgsql/9.2/pgstartup.log
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log
NEW:
PGDATA=/var/lib/pgsql2/9.2/data
PGLOG=/var/lib/pgsql2/9.2/pgstartup.log
PGUPLOG=/var/lib/pgsql2/$PGMAJORVERSION/pgupgrade.log
7 - Start postgres
/etc/init.d/postgresql-9.2 start
and it worked perfectly fine... :)
That's great news! My only concern is about the "RSYNC" - Hope that doesn't take long!!!
This all steps must be performed by me on the next few days/weeks - I'll keep you guys updated... Keen to see the new DB running in a SSD environment :)