CentOS7 PostgreSQL Master-slave configuration (iii)

Source: Internet
Author: User
Tags postgresql

Postgres Primary and Standby switching

The Master is looking for
Method
Ps-ef | grep wal (Main library sender)
Postgres 27873 27864 0 May 06? 00:00:10 Postgres:wal Sender Process Postgres 10.2.0.13 (47582) streaming 0/906ff78
Postgres 27874 27864 0 May 06? 00:00:11 Postgres:wal Sender Process Postgres 10.2.0.15 (51872) streaming 0/906ff78


Ps-ef | grep wal (Standby receiver)
Postgres 25875 25828 0 May 06? 00:05:28 Postgres:wal receiver Process streaming 0/906ff78

Standby library switch to master Library
1 switch off the main library
Pg_ctl stop
Waiting for server to shut down ... done
Server stopped

View the Repository Log

Tail-f/var/lib/pgsql/9.5/data/pg_log/postgresql-fri.log
TCP/IP connections on port 5432?

< 2016-05-13 17:24:09.493 CST >fatal:could not connect to the primary server:could does connect to Server:connecti On refused
is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?

< 2016-05-13 17:24:14.500 CST >fatal:could not connect to the primary server:could does connect to Server:connecti On refused
is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?

< 2016-05-13 17:24:19.508 CST >fatal:could not connect to the primary server:could does connect to Server:connecti On refused
is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?

Generate the file specified in the recovery.conf file in the corresponding directory of the standby pgdata trigger_file = '/home/postgres.trigger ' (the standby is now in a normal state)
Touch/home/postgres.trigger

You will see the recovery.conf file become Recovery.done

Tail-f/var/lib/pgsql/9.5/data/pg_log/postgresql-fri.log
TCP/IP connections on port 5432?

< 2016-05-13 17:27:21.714 CST >fatal:could not connect to the primary server:could does connect to Server:connecti On refused
is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?

< 2016-05-13 17:27:26.719 CST >fatal:could not connect to the primary server:could does connect to Server:connecti On refused
is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?

< 2016-05-13 17:27:31.719 CST >log:trigger file found:/home/postgres.trigger
< 2016-05-13 17:27:31.719 CST >log:redo is not required
< 2016-05-13 17:27:31.735 CST >log:selected new Timeline Id:2
< 2016-05-13 17:27:32.282 CST >log:archive Recovery complete
< 2016-05-13 17:27:32.331 CST >log:multixact member wraparound protections is now enabled
< 2016-05-13 17:27:32.345 CST >log:autovacuum launcher started
< 2016-05-13 17:27:32.347 CST >log:database system is ready to accept connections

CentOS7 PostgreSQL Master-slave configuration (iii)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.