Comments on How to Install and Configure PostgreSQL Replication with Hot Standby on Ubuntu 15.04

In this tutorial, we I will show you how to install and configure PostgreSQL replication by using hot standby mode. PostgreSQL or Postgres is an open source object-relational database management system (ORDBMS) with more than 15 years of active development. It's a powerful database server and can handle high workloads.

6 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: David Pérez

Detected a minor typo.  It has double slash:

restore_command = 'cp //var/lib/postgresql/9.4/main/archive/%f %p'

By: David Pérez

Why the copy command is interactive?

I think the use of the -i flag isn't appropiate.

archive_command = 'cp -i %p /var/lib/postgresql/9.4/main/archive/%f'

By: Vladimir

I guess it's typo here as well:mkdir -p /var/lib/9.4/main/archive/should bemkdir -p /var/lib/postgresql/9.4/main/archive/

By: akhilesh

Hi,

I have installed postgresql with active-passive with above steps in redhat 7.2 but I need psql in active-active mode which helps my tool.Please help me in installing it either both master-slave as write access or share the steps to install postgresql in multi master mode which will be helpful

By: Mehman Jafarov

 Hi guys,

I try replication with postgresql 9.5 on Red Hat 7.2. when I try this part step 5

pg_basebackup -h 192.168.1.249 -D /var/lib/postgresql/9.4/main -U replica -v -P (of course changed for redhat and version for RHEL)

there is permission error although it has permission and all configurations are ok.

 The error is like that when try to use pg_basebackup command

 

[postgres@slave ~]$ pg_basebackup -h 192.168.1.108 -D /usr/local/pgsql/data -U replica -v -Ppg_basebackup: could not access directory “/usr/local/pgsql/data”: Permission denied

Besides this I google a lot about main path and don’t understand where it is in my postgresql installed host.

<>in a lot of source the path is in that format /var/lib/postgresql/9.x/main

when I installed postresql 9.5 on my host I didn’t install postgresql packages when installing RHEL. I install postgresql after RHEL installation to specific directory (from source not with yum command) as /usr/local/pgsql/

As a result postgresql installed successfully and database works.

I don’t understand clearly …/main parts equal to what in my configuration path?I guess it is equal to /usr/local/pgsql/data in my configuration. Am I right???

The IP here is master server IP.And I mv ../data/ to backup location on standby (slave) before replication

Please HELP ME?? It is urgent

Thanks!!

By: Bach-Nga

Hello,

I try replication with postgresql 11.2, at 1st everything is ok, i can create a new database,  a simple table and insert data.  I can read right away from slave, but now everything is broken and I don't know how to correct it.  It's not replicate anymore... even now when I tried to create a small table in master (liked create table xxx (id integer), it was hung...

If I bounce the slave then I can see a new table existed from master and then it copied to slave..