One, database installation
Choose to install according to your own environment
1, yum specified directory installation
https://blog.csdn.net/llwy1428/article/details/105143053
2, yum install directly
https://blog.csdn.net/llwy1428/article/details/102486414
3. Compile and install
https://blog.csdn.net/llwy1428/article/details/95444151
4. PostgreSql basic operation
https://blog.csdn.net/llwy1428/article/details/102598732
5. Centos7 yum installation, configuration PgAdmin4
https://blog.csdn.net/llwy1428/article/details/102486511
6, Centos7 PostgreSql database installation extension
https://blog.csdn.net/llwy1428/article/details/105167524
7. Centos7 PostgreSql database uses FDW extension
https://blog.csdn.net/llwy1428/article/details/106291669
8. Centos7 postgresql v11 installs timescale database TimescaleDB
https://blog.csdn.net/llwy1428/article/details/106357900
Two, database backup
1. Back up the local database
Back up the database dbfrom to the /tmp path and name it as sysdb.backup file
/usr/pgsql-11/bin/pg_dump --file "/tmp/sysdb.backup" --host "localhost" --port "5432" --username "postgres" --dbname "dbfrom" --verbose --role "postgres" --format=c --blobs --encoding "UTF8"
2. Back up the remote database
vim ~/.pgpass
写入内容:
目标数据库IP:5432:目标数据库:postgres:目标数据库密码
Execute backup command
/usr/pgsql-11/bin/pg_dump --file "/tmp/sysdb.backup" --host "目标数据库IP" --port "5432" --username "postgres" --dbname "目标数据库" --verbose --role "postgres" --format=c --blobs --encoding "UTF8"
Three, database restore
chmod 755 /tmp/sysdb.backup
Switch user
su - postgres
psql
Create database
CREATE DATABASE dbto;
Switch to the postgres user and execute the restore command
su - postgres
pg_restore --username "postgres" --no-password --role "postgres" --dbname "dbto" --verbose /tmp/sysdb.backup
Postgresql v11 database backup and restore operations are complete!