Re: 2.5TB Migration from SATA to SSD disks - PostgreSQL 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: Venkata B Nagothi <nag1010(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: 2.5TB Migration from SATA to SSD disks - PostgreSQL 9.2
Date: 2016-09-04 20:37:34
Message-ID: CAJNY3ivrb39id5jOFh-dk8BGQge622mn0L8k1paF+ZypVFyUYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 stop

rsync -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 :)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2016-09-04 23:28:56 Re: BDR: Transactions with global lock
Previous Message Raymond O'Donnell 2016-09-04 20:19:18 Re: please remove outdated site from 2005