Store Postgres data on a separate AWS EBS volume.

I have an Amazon EC2 instance running postgres. I would like to connect another EBS volume to it, which is used ONLY for postgres data. I can add a volume, but how do I configure postgres to use the installed ebs disk to store data?

+6
source share
2 answers
  • Create a file system on EBS, and then mount it. See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
  • Set ownership of your file system on postgres.
  • Use the initdb command to initialize your new space.
  • Tell postgres to use your new file system by using the -D option to the postgres binary file, setting the PGDATA environment variable or setting data_directory to postgresql.conf
+5
source

You must edit pgdata postgres and point it to the directory mapped to your EBS volume, as described in this section here -

http://www.linuxquestions.org/questions/linux-server-73/change-postgresql-data-directory-649911/

+1
source

Source: https://habr.com/ru/post/955845/


All Articles