How to do it...

Use the following steps to replicate a PostGIS database:

  1. Create directories for the primary and standby database clusters by executing the following commands:
      > mkdir postgis_cookbook/db
      > mkdir postgis_cookbook/db/primary
      > mkdir postgis_cookbook/db/standby
  1. Initialize the database clusters with initdb as follows, defining the user me as the owner of the database:
      > cd postgis_cookbook/db
      > initdb --encoding=utf8 --locale=en_US.utf-8 -U me -D primary
      > initdb --encoding=utf8 --locale=en_US.utf-8 -U me -D standby
  1. You may opt for avoiding the --locale=en_US.utf-8 option if an error occurs; in that case, the system will adopt the default locale on your computer.
  2. Create directories for the archives of the primary and standby ...

Get PostGIS Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.