Configure a Streaming Replication cluster in PostgreSQL

Source: Internet
Author: User
Tags psql

Running Environment: Primary: 192.168.111.150Standby: 192.168.111.15119425111.152os: CentOS5.8PostgreSQL: 9.1.2 or later. Streaming Replication is supported.

PostgreSQL cache details

Compiling PostgreSQL on Windows

Configuration and installation of LAPP (Linux + Apache + PostgreSQL + PHP) Environment in Ubuntu

Install and configure phppgAdmin on Ubuntu

Install PostgreSQL9.3 on CentOS

1. It is best to have the same environment for the Primary and Standby nodes in environment planning. 2. install PostgreSQL1) install PostgreSQL software on the Primary and Standy nodes with the installation path/opt/pgsql-9.1.22) set the postgres user's environment variable PGHOME =/opt/pgsql-9.1.2PGDATA =/storage0/database/postgres/mainPATH = $ PG_HOME/bin: $ PATH: $ HOME/bin 3. primary Node 1) switch to ipvs user $ su-ipvs2) initialize database $ initdb3) Configure pg_ipv.conf and add a line under # IPv4 local connections, set PostgreSQL access and its permissions host all 192.168.111.1/24 trust in # replication privilege. add a row below and set the replication user and permission host re Plication ipvs 192.168.111.1/24 trust4) Configure postgresql. conf configuration listening, modify listen_addresses = 'localhost' listen _ addresses = '*' # what IP address (es) to listen on; configure the Primary Replication parameter wal_level = partition = 5wal_keep_segments = 32archive_mode = onarchive_command = 'cp % p/storage0/database/S/archive/% f </dev/null' "/storage0/database /postgres/archive "is the storage path of the Replication archive. PostgreSQL stores the Replication WAL in the "/storage0/database/S/archive" path. 5) Start PostgreSQL database $ pg_ctl start6 on Primary. Execute the following command on primary: $ psql-c "SELECT pg_start_backup ('label', true) "Remove the files under the PGDATA directory of Primary, except postmaster. copy the pid to the/storage0/database/postgres/main directory of the Standby node, which is the PGDATA directory of the PostgreSQL database on the Standby node. $ Rsync-a $ {PGDATA}/postgres@192.168.111.151:/storage0/database/S/main -- exclude postmaster. pid $ psql-c "SELECT pg_stop_backup ()" content in the/storage0/database/S/main directory of 192.168.111.151 is as follows:
  • 1
  • 2
  • Next Page

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.