Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn PostgreSQL

You're reading from   Learn PostgreSQL Build and manage high-performance database solutions using PostgreSQL 12 and 13

Arrow left icon
Product type Paperback
Published in Oct 2020
Publisher Packt
ISBN-13 9781838985288
Length 650 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Enrico Pirozzi Enrico Pirozzi
Author Profile Icon Enrico Pirozzi
Enrico Pirozzi
Luca Ferrari Luca Ferrari
Author Profile Icon Luca Ferrari
Luca Ferrari
Arrow right icon
View More author details
Toc

Table of Contents (27) Chapters Close

Preface 1. Section 1: Getting Started
2. Introduction to PostgreSQL FREE CHAPTER 3. Getting to Know Your Cluster 4. Managing Users and Connections 5. Section 2: Interacting with the Database
6. Basic Statements 7. Advanced Statements 8. Window Functions 9. Server-Side Programming 10. Triggers and Rules 11. Partitioning 12. Section 3: Administering the Cluster
13. Users, Roles, and Database Security 14. Transactions, MVCC, WALs, and Checkpoints 15. Extending the Database - the Extension Ecosystem 16. Indexes and Performance Optimization 17. Logging and Auditing 18. Backup and Restore 19. Configuration and Monitoring 20. Section 4: Replication
21. Physical Replication 22. Logical Replication 23. Section 5: The PostegreSQL Ecosystem
24. Useful Tools and Extensions 25. Toward PostgreSQL 13 26. Other Books You May Enjoy

Exploring logical replication setup

Let's explore now how to perform logical replication. In this section, we will prepare the environment we need to be able to perform our logical replication.

Logical replication environment settings

Suppose we have two machines that we will call pg1 and pg2. We must remember to set our internal DNS, or the /etc hosts file, so that pg1 can reach pg2; for example, for the pg1 server, the master server will have an IP of 192.168.122.20, and for the pg2 server, the replica server will have an IP of 192.168.122.36.

First of all, let's check whether there is a connection between the two servers:

pg1:~$ ping pg2
PING pg2.pgtraining.com (192.168.122.36) 56(84) bytes of data.
64 bytes from pg2.pgtraining.com (192.168.122.36): icmp_seq=1 ttl=64 time=0.893 ms
64 bytes from pg2.pgtraining.com (192.168.122.36): icmp_seq=2 ttl=64 time=0.639 ms

pg2:~$ ping pg1
64 bytes from pg1.pgtraining.com (192.168.122.20): icmp_seq=1 ttl=64 time=1.40 ms
64 bytes from pg1...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image