O'Reilly logo

PostgreSQL High Performance Cookbook by Dinesh Kumar, Chitij Chauhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up hot streaming replication

In this recipe, we are going to set up a master/slave streaming replication.

Getting ready

For this exercise, you need two Linux machines each with the latest version of PostgreSQL 9.6 installed. We will be using the following IP addresses for master and slave servers:

  • Master IP address: 192.168.0.4
  • Slave IP address: 192.168.0.5

How to do it...

The following steps show you how to set up master/slave streaming replication:

  1. Set up password-less authentication between master and slave for the Postgres user.
  2. First, we are going to create a user ID on the master, which will be used by the slave server to connect to the PostgreSQL database on the master server:
            psql -c "CREATE USER repuser REPLICATION LOGIN ENCRYPTED ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required