Wednesday, July 6, 2011
Tuesday, July 5, 2011
Moving Postgresql data
So the volume attached to the EC2 instance where I was running a test instance of Squiz Matrix ran out of room.
Luckily this proved to be pretty straight forward:
Luckily this proved to be pretty straight forward:
- using AWS web console, create a new volume and attach it to my instance (while instance is shutdown) - the new volume is attached as /dev/sdb
- start up the instance, ssh in and format new volume: mkfs.ext3 /dev/sdb
- mkdir mount point, eg /pgdata
- vim /etc/fstab, adding:
/dev/sdb /pgdata ext3 defaults 1 1 - mount /pgdata
- chown postgres:postgres /pgdata/
- refer to this handy blog post
- service postgresql stop
- cp -R /var/lib/pgsql/data /pgdata/
- Wait...
- vim /etc/init.d/postgresql and setting PGDATA to /pgdata
- service postgresql start
Subscribe to:
Posts (Atom)