Change Postgresql data directory
Hello all,
The default data directory for postgres is /var/lib/pgsql/data How can I change it? There is not config file in /etc (like mysql has /etc/my.cnf) How can I change this? I want the data dir to "live" in another directory I am running CentOS 5.0 -C |
|
You have to create another database cluster. To do this :
>mkdir your_new_directory >chown postgres_user your_new_directory login as postgres user >initdb -D your_new_directory You have to specify this new cluster when you start postmaster with the -D option too or you can change it directly in the startup script like /etc/rc.d/rc.pgsql if you have one. |
Solved
Quote:
This is what I did to get it to work (This was on CentOS 5.0)... Shutdown postgres (if it's running) Code:
root@host# service postgresql stop Code:
root@host# vi /etc/rc.d/init.d/postgresql Code:
# Set defaults for configuration variables Code:
root@host# mkdir -p /path/to/pgdata Code:
root@host# su - postgres -c "initdb -D /path/to/pgdata" Code:
root@host# service postgresql start Code:
root@host# ps aux | grep post |
All times are GMT -5. The time now is 04:54 PM. |