How to change postgresql data directory.
- vim /etc/postgresql/8.2/main/postgresql.conf
- set data directory path to the new directory path
- Create new Server Certificate
- openssl req -new -text -out server.req
- openssl rsa -in privkey.pem -out server.key
- rm privkey.pem
- openssl req -x509 -in server.req -text -key server.key -out server.crt
- chmod og-rwx server.key
- chown postgres:postgres server.key
- Stop and Restart Postgresql server
5 comments:
thanks
The procedure below worked for me on ubuntu 10.04 LTS. It has the same effect with the advantage that there is no need to modify the default configuration of postgres.
1) change dir to the default postgres data directory
cd /var/lib/postgresql/8.4
2) physically move the 'main' directory to the new location
sudo mv main /data/postgresql/8.4/
3) create a symlink in the default postgres data directory to the new location
ln -s /data/postgresql/8.4/main/ main
yepp great easy short and sweet idea :) super coool !!!
Post a Comment