Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:2ndQuadrant Pglogical Node Management

From Leeroopedia
Knowledge Sources
Domains Database, Replication
Last Updated 2026-10-13 00:00 GMT

Overview

Concept of establishing and managing unique node identities within a distributed replication topology, where each node is identified by name and connected via DSN-based interfaces.

Description

In a logical replication system, a node represents a database instance that participates in replication as either a provider (publisher) or subscriber (consumer) of changes. Each node has a globally unique name and one or more connection interfaces described by DSN (Data Source Name) connection strings.

Node management addresses the problem of identifying participants in a potentially complex replication graph. A node may simultaneously be a subscriber to one provider and a provider to other subscribers, enabling cascading and bi-directional topologies. The node identity is stored in catalog tables and referenced by subscriptions, replication sets, and replication slots.

The act of creating a node also bootstraps the default replication sets (default, insert_only, ddl_sql) and marks the database as the local node, establishing it as a participant in the replication topology.

Usage

Use node management when:

  • Setting up a new provider or subscriber database for logical replication
  • Establishing a node identity that subscriptions and replication sets reference
  • Creating a cascading replication chain where a subscriber also serves as a provider

Theoretical Basis

A replication topology is a directed graph where nodes are databases and edges are subscriptions. Each node has:

  • A unique name (identifier within the topology)
  • One or more interfaces (DSN connection strings)
  • A set of replication sets (groupings of tables/sequences for selective replication)
Provider Node "alpha"
  ├── Replication Set "default" (tables: t1, t2)
  ├── Replication Set "insert_only" (tables: t3)
  │
  └── Subscription edge ──► Subscriber Node "beta"
                             └── Subscription edge ──► Subscriber Node "gamma"

The node creation process:

  1. Insert a node record into the catalog
  2. Create a default interface with the provided DSN
  3. Create default replication sets
  4. Mark the node as the local node (only one local node per database)

Practical Guide

Creating a Node

A node must be created on every database that participates in replication:

-- On the provider
SELECT pglogical.create_node(
    node_name := 'provider1',
    dsn := 'host=provider.example.com port=5432 dbname=mydb'
);

-- On the subscriber
SELECT pglogical.create_node(
    node_name := 'subscriber1',
    dsn := 'host=subscriber.example.com port=5432 dbname=mydb'
);

Key Considerations

  • Only one local node can exist per database
  • The DSN must be reachable from all nodes that need to connect
  • Node names must be unique within the replication topology
  • Dropping a node requires dropping all its subscriptions first

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment