--停止原主库 [atlasdb@vm1 ~]$ pg_ctl -D /data/atlasdb -l logfile stop waiting for server to shut down.... done server stopped --配置流复制文件和参数 [atlasdb@vm1 ~]$ vi $PGDATA/recovery.conf [atlasdb@vm1 ~]$ cat $PGDATA/recovery.conf standby_mode = 'on' primary_conninfo = 'user=atlasdb password=atlasdb host=192.168.0.202 port=5432 sslmode=prefer sslcompression=0 target_session_attrs=any' [atlasdb@vm1 ~]$ -- 启动数据库 [atlasdb@vm1 ~]$ pg_ctl -D /data/atlasdb -l logfile start waiting for server to start.... done server started [atlasdb@vm1 ~]$ psql psql (11.5) PSQL: Release 2.7.0 Connected to: AtlasDB V2.7 Enterprise Edition Release - 64-bit Production Type "help" for help. atlasdb=# select pg_is_in_recovery(); pg_is_in_recovery ------------------- t (1 row) atlasdb=# select * from test_tab ; id | name | e_mail | d_id ----+-----------+------------------+------ 1 | hemny | hemny@qq.com | 10 2 | hemny_pg1 | hemny_pg1@qq.com | 10 (2 rows)