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