From 35e44680bedb9c6033aa4d8b18fb8fb7af67c826 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 22 Sep 2022 11:55:39 -0400 Subject: [PATCH] notes --- postgres/install.sh | 4 ++++ postgres/move_data_directory.md | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 postgres/install.sh diff --git a/postgres/install.sh b/postgres/install.sh new file mode 100644 index 0000000..9e82c3a --- /dev/null +++ b/postgres/install.sh @@ -0,0 +1,4 @@ +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +sudo apt-get update +sudo apt-get -y install postgresql diff --git a/postgres/move_data_directory.md b/postgres/move_data_directory.md index a6cdfec..53e31c4 100644 --- a/postgres/move_data_directory.md +++ b/postgres/move_data_directory.md @@ -1,3 +1,14 @@ https://www.digitalocean.com/community/tutorials/how-to-move-a-postgresql-data-directory-to-a-new-location-on-ubuntu-18-04 +copy the data +`sudo rsync -av /var/lib/postgresql /target_dir` +rename original as a backup +`sudo mv /var/lib/postgresql/10/main /var/lib/postgresql/10/main.bak` + +point postgres to the new data directory +`sudo vim //etc/postgresql/14/main/postgres.conf` +` data_directory = '/mnt/volume_nyc1_01/postgresql/10/main'` + +remove the old data +`sudo rm -Rf /var/lib/postgresql/10/main.bak`