前提配置1-pg_hba.conf
host replication all 0.0.0.0/0 trust
前提配置2-postgresql.conf
listen_addresses= '*'
wal_level = replica
archive_mode = on
archive_command = 'copy /V "%p" C:\\backup\\wal_files\\%f '
restore_command = 'copy c:\\backup\\wal_files\\%f "%p" '
max_wal_senders= 10
wal_keep_size = 1000 # in megabytes; 0 disables
max_slot_wal_keep_size = 10 # in megabytes; -1 disables
wal_sender_timeout = 120s # in milliseconds; 0 disables
hot_standby = on
1、备份
pg_basebackup.exe -D ../data1 -U postgres -Fp -X stream -R -P -v -p5432 -h 【主服务器ip】
如果启动失败,则先关闭该路径下其他的data启动进程
.\pg_ctl -D …/data start
2、备份包重新赋权
3、启动
pg_ctl.exe -D ../data1 start