Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Great write-up. Thanks for posting. Worked great with 9.3 on Ubuntu 14.04 (just needed to swap version numbers and use /etc/init.d/postgresql stop/start/status)
This worked well. The only thing I’m having trouble with is it not finding the data_directory on reboot. If I reboot the droplet and try to run psql, it gives me this error:
psql: could not connect to server: No such file or directory
If I manually restart the posgresql service, it will find the directory and work again.
Any ideas how to get the postgresql service to wait for the block storage to mount?
Thanks!
Thanks for the amazing tutorial. There is a small issue though.
First you’re creating a backup like this;
sudo mv /var/lib/postgresql/9.5/main /var/lib/postgresql/9.5/main.bak
But then try to remove it like this;
sudo rm -Rf /var/lib/postgresql.bak
Might want to fix that.
thanks for the tutorial. it works well except that bash and psql history for postgres user doesn’t work afterwards. do i miss something?
You should not blow away the /var/lib/postgresql/9.x/main because the daemon scripts will still point to it with “-D” argument. The -D directory needs to exist so that the postmaster will leave its pid.
The easier way for most consequently is just to mv /var/lib/postgresql/9.x/main and make a symlink in place of /var/lib/postgresql/9.x/main.
Thanks for the tutorial, unfortunately after successfully restarting the server I can no longer connect to it. I get the error - psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket
Running Ubuntu 16.04.2 and PostgreSQL9.6 Any hints?
Ps. can connect no problem when I rsync the data back to the original directory. Cheers
Hi I got the same error on ubuntu14.04 and postgresql 9.5 which is ‘could not connect to server: No such file or directory’.
I finally figured out that it’s that my changed data directory which is an external SSD drive does not give access to user postgres the access to see the drive even though I’ve already changed the ownership of the new data directory(which is inside the SSD drive) to postgres.
I got help by this thread: https://dba.stackexchange.com/questions/124617/postgres-user-cannot-access-location-of-new-data-directory
I have two databases on postgreSQL. I am running out of disk space and want to move one of my databases to a different directory. How can I do this?