@@ -45,8 +45,7 @@ Next the `pglogical` extension has to be installed on all nodes:
45
45
Now create the provider node:
46
46
47
47
SELECT pglogical.create_provider(
48
- node_name := 'node1',
49
- node_dsn := 'host=hostname1 port=5432 dbname=db'
48
+ provider_name := 'provider1',
50
49
);
51
50
52
51
Optionally you can also create replication sets and add tables to them (see
@@ -55,81 +54,86 @@ Optionally you can also create replication sets and add tables to them (see
55
54
Once the provider node is setup, subscribers can be subscribed to it:
56
55
57
56
SELECT pglogical.create_subscriber(
58
- node_name := 'node1 ',
59
- node_dsn := 'host=hostname2 port=5432 dbname=db ',
60
- init_from_dsn := 'host=hostname1 port=5432 dbname=db' # should be same as node_dsn of the provider
57
+ subscriber_name := 'subscriber1 ',
58
+ provider_name := 'provider1 ',
59
+ provider_dsn := 'host=providerhost port=5432 dbname=db'
61
60
);
62
61
63
62
### Node management
64
63
65
64
Nodes can be added and removed dynamically using the SQL interfaces.
66
65
67
- - ` pglogical.create_provider(node_name name, node_dsn text ) `
66
+ - ` pglogical.create_provider(provider_name name) `
68
67
Creates a provider node.
69
68
70
69
Parameters:
71
- - ` node_name ` - name of the new node, must be unique
72
- - ` node_dsn ` - connection string used both for connections by other nodes as
73
- well as back connections on the same node, must be accessible as both
74
- standard connection and replication connection mode
70
+ - ` provider_name ` - name of the new provider, currently only one provider
71
+ is allowed per database
75
72
76
- - `pglogical.create_subscriber(node_name name, node_dsn text, init_from_dsn
77
- text, replication_sets name[ ] , synchronize pglogical.synchronization_type)`
73
+ - `pglogical.create_subscriber(subscriner_name name, provider_name name,
74
+ provider_dsn text, replication_sets name[ ] , synchronize_schema boolean
75
+ synchronize_data boolean)`
78
76
Creates a subsriber node.
79
77
80
78
Parameters:
81
- - ` node_name ` - name of the new node, must be unique
82
- - ` node_dsn ` - connection string used both for connections by other nodes as
83
- well as back connections on the same node, only standard connection will be
84
- used
85
- - ` init_from_dsn ` - connection string to a node which will be used for
86
- initializing this node (usually the provider node)
79
+ - ` subscriner_name ` - name of the subscriber, must be unique
80
+ - ` provider_name ` - name of the provider to which this subscriber will be
81
+ connected
82
+ - ` provider_dsn ` - connection string to a provider node
87
83
- ` replication_sets ` - array of replication sets to subscribe to, these must
88
84
already exist, default is "default"
89
- - ` synchronize ` - specifies what to synchronize during initialization, can be
90
- one of "full", which means synchronize structure and data or "none" which
91
- means the initial syncrhonization should be skipped
85
+ - ` synchronize_schema ` - specifies is to synchronize schema from provider to
86
+ the subscriber, default true
87
+ - ` synchronize_data ` - specifies is to synchronize data from provider to
88
+ the subscriber, default true
92
89
93
- - ` pglogical.drop_node(node_name name) `
94
- Disconnect and drop existing node, can be any type of node .
90
+ - ` pglogical.drop_provider(provider_name name) `
91
+ Removes the provider and disconnect all subscrbers from it .
95
92
96
93
Parameters:
97
- - ` node_name ` - name of the existing node
94
+ - ` subscriber_name ` - name of the existing provider
95
+
96
+ - ` pglogical.drop_subscriber(subscriber_name name) `
97
+ Disconnects the subsriber and removes it from the catalog.
98
+
99
+ Parameters:
100
+ - ` subscriber_name ` - name of the existing subscriber
98
101
99
102
### Replication sets
100
103
101
104
Replication sets provide a mechanism to control which tables in the database
102
105
will be replicated and which actions on those tables will be replicated.
103
106
104
- Each replicated set can specify individually if ` INSERTs ` , ` UPDATEs ` and
105
- ` DELETEs ` on the set are replicated. Every table can be in multiple replication
106
- sets and every node can subscribe to multiple replication sets as well. The
107
- resulting set of tables and actions replicated is the union of the sets the
108
- table is in.
107
+ Each replicated set can specify individually if ` INSERTs ` , ` UPDATEs ` ,
108
+ ` DELETEs ` and ` TRUNCATEs ` on the set are replicated. Every table can be in
109
+ multiple replication sets and every subscriber can subscribe to multiple
110
+ replication sets as well. The resulting set of tables and actions replicated
111
+ is the union of the sets the table is in.
109
112
110
113
There are two preexisting replication sets named "all" and "default". The "all"
111
114
replication set contains every user table in the database and every table that
112
115
has not been added to specific replication set will be in the "default" set.
113
116
114
117
The following functions are provided for managing the replication sets:
115
118
116
- - ` pglogical.create_replication_set(set_name name, replicate_inserts bool, replicate_updates bool, replicate_deletes bool) `
119
+ - ` pglogical.create_replication_set(set_name name, replicate_insert bool, replicate_update bool, replicate_delete bool, replicate_truncate bool) `
117
120
This function creates new replication set.
118
121
119
122
Parameters:
120
123
- ` set_name ` - name of the set, must be unique
121
- - ` replicate_inserts ` - specifies if ` INSERTs ` are replicated, default true
122
- - ` replicate_updates ` - specifies if ` UPDATEs ` are replicated, default true
123
- - ` replicate_deletes ` - specifies if ` DELETEs ` are replicated, default true
124
+ - ` replicate_insert ` - specifies if ` INSERT ` is replicated, default true
125
+ - ` replicate_update ` - specifies if ` UPDATE ` is replicated, default true
126
+ - ` replicate_delete ` - specifies if ` DELETE ` is replicated, default true
127
+ - ` replicate_truncate ` - specifies if ` TRUNCATE ` is replicated, default true
124
128
125
129
- ` pglogical.alter_replication_set(set_name name, replicate_inserts bool, replicate_updates bool, replicate_deletes bool, replicate_truncate bool) `
126
130
This function change the parameters of the existing replication set.
127
131
128
132
Parameters:
129
133
- ` set_name ` - name of the existing replication set
130
- - ` replicate_inserts ` - specifies if ` INSERTs ` are replicated, default true
131
- - ` replicate_updates ` - specifies if ` UPDATEs ` are replicated, default true
132
- - ` replicate_deletes ` - specifies if ` DELETEs ` are replicated, default true
134
+ - ` replicate_insert ` - specifies if ` INSERT ` is replicated, default true
135
+ - ` replicate_update ` - specifies if ` UPDATE ` is replicated, default true
136
+ - ` replicate_delete ` - specifies if ` DELETE ` is replicated, default true
133
137
- ` replicate_truncate ` - specifies if ` TRUNCATE ` is replicated, default true
134
138
135
139
- ` pglogical.delete_replication_set(set_name text) `
0 commit comments