PostgreSQL Master-Slave configuration

Source: Internet
Author: User
Tags md5 postgresql

Installing PostgreSQL

Whether the master-slave must be divided into two machines, master and slave should be the same version, or start will error.

3. Configure the master database

Su–postgres

/usr/local/pgsql/bin/pg_ctl–d/data/pgsql9.1 Start #启动数据库

#进入数据库创建repl用户

Psql–p 5432–u postgres–h 127.0.0.1

Create user repl superuser password ' password '

\q

#修改postgresql. conf file

Vi/data/pgsql9.1/postgresql.conf

listen_addresses = ' * '//Listening address

Wal_level = hot_standby//sync level, minimum, file, Hot_standby, or logic (requires reboot after change)

Synchronous_commit = ON//is synchronous, on indicates the need to synchronize to a different server

Max_wal_senders = 2//maximum number of processes synchronized

Wal_keep_segments = 32//log file segment size, default = 16m,0 means disable

Full_page_writes=on


Synchronous_standby_names = ' * '/* provide a standby server for the synchronization agent
* comma-delimited list application_name
* FROM standby State (S); "*" = all */

#修改pg_hba. conf file

Vi/data/pgsql9.1/pg_hba.conf

#允许局域网中md5密码认证连接

Host All 192.168.100.0/24 MD5

#用户数据同步, the replication database must be

Host replication Repl 192.168.100.0/24 MD5

#用户在当前数据库服务器无密码连接

Local all All trust

#重启数据库

Su–postgres

/usr/local/pgsql/bin/pg_ctl–d/data/pgsql9.1 restart

PostgreSQL Master-Slave configuration

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.