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 Use, manage, and build secure and scalable databases with PostgreSQL 16

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781837635641
Length 744 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Luca Ferrari Luca Ferrari
Author Profile Icon Luca Ferrari
Luca Ferrari
Enrico Pirozzi Enrico Pirozzi
Author Profile Icon Enrico Pirozzi
Enrico Pirozzi
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

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

Exploring a logical replication setup and new logical replication features on PostgreSQL 16

Let’s now explore 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, which we will call pg_pub and pg_sub. We must remember to set our internal DNS, or the /etc hosts file, so that pg_pub can reach pg_sub; for example, for the pg_pub server, the primary server will have an IP of 192.168.144.3, and for the pg_sub server, the replica server will have an IP of 192.168.144.2. If you use the chapter18 container, you can execute:

chapter_18$ bash run-pg-docker.sh chapter18_logical_clear

Once you are inside the first container, you can open another bash terminal and execute:

chapter_18$ bash run-pg-docker_replica.sh chapter18_logical_clear

Now, let’s check whether there is a connection between the two...

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