master configuration of PostgreSQL (not ha, not eagerly)

Source: Internet
Author: User
Tags rsync

This is just part of the note, the master hangs up and cuts to the repository.

Master:192.168. 1.111 from: 192.168. 1.222

Primary server

sudo apt-get Install rsync

From the server

sudo apt-get  install Rsyncsudo apt-get install Openssh-server

Master db
Create user

sudo-'123456'; \q exit

Modifying a configuration file

Vim/etc/postgresql/9.x/main/pg_hba.conf

0.0. 0.0/0 MD5

Vim/etc/postgresql/9.x/main/postgresql.conf

" * "   =3

From DB
Set the Postgres system account password to use when the user remotely rsync
Vim/etc/postgresql/9.x/main/postgresql.conf

Hot_standby = On

Vim/var/lib/postgresql/9.x/main/recovery.conf

Standby_mode = Onprimary_conninfo='host=192.168.1.111 user=repuser password=123456' /tmp/Switch_to_read_write, prepare the library can write #trigger_file='/tmp/switch_to_read_write    '

About recovery's sample can be seen here/usr/share/postgresql/

Integration
Master and slave execution separately

sudo service PostgreSQL stop

It starts with the need to execute on the primary server

sudo rsync-ravztopg--exclude=/var/lib/postgresql/9. x/main/pg_xlog//var/lib/ postgresql/9. x/main/[email protected]192.168. 1.222:/var/lib/postgresql/9. x/main/

After success
executed separately in master and slave

Service PostgreSQL Start

master configuration of PostgreSQL (not ha, not eagerly)

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.