Skip to content

Commit 7260e2d

Browse files
author
katmayb
committed
Edits & feedback
1 parent 43faa7d commit 7260e2d

File tree

3 files changed

+36
-54
lines changed

3 files changed

+36
-54
lines changed

src/current/v25.2/create-logical-replication-stream.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,18 @@ If the table you're replicating does not contain [user-defined types]({% link {{
2020

2121
## Required privileges
2222

23-
{% include_cached new-in.html version="v25.2" %} To run the `CREATE LOGICAL REPLICATION STREAM` statement to create an LDR stream, the following privileges are required:
24-
25-
On the source cluster:
26-
27-
- The table-level `REPLICATIONSOURCE` privilege on the source table(s).
23+
`CREATE LOGICAL REPLICATION STREAM` creates a one-way LDR stream only. To achieve bidirectional replication, you must manually create two separate streams, one in each direction, with the required privileges set on both clusters.
2824

29-
This is the user provided in the source URI when you start a LDR stream.
25+
LDR from cluster A to B represents a one-way stream from a source to a destination cluster. LDR from cluster B to A is the reverse stream for a bidirectional setup.
3026

31-
On the destination cluster:
32-
33-
- The table-level `REPLICATIONDEST` privilege on the destination table(s).
34-
35-
For bidirectional LDR:
27+
{% include_cached new-in.html version="v25.2" %} To run the `CREATE LOGICAL REPLICATION STREAM` statement to create an LDR stream, the following privileges are required:
3628

37-
- The user in the original source URI, who begins the reverse LDR stream, requires the table-level `REPLICATIONDEST` privilege.
29+
LDR direction | Cluster | User role | Required privilege
30+
----------------------+---------+-----------+--------------------
31+
A ➔ B | A | User in the LDR connection string. | `REPLICATIONSOURCE`
32+
A ➔ B | B | User running the command. | `REPLICATIONDEST`
33+
B ➔ A | B | User in the LDR connection string. | `REPLICATIONSOURCE`
34+
B ➔ A | A | User running the command. | `REPLICATIONDEST`
3835

3936
Grant a table-level privilege with the [`GRANT`]({% link {{ page.version.version }}/grant.md %}) statement to a [user or a role]({% link {{ page.version.version }}/security-reference/authorization.md %}#users-and-roles):
4037

src/current/v25.2/create-logically-replicated.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,20 @@ This page is a reference for the `CREATE LOGICALLY REPLICATED` SQL statement, wh
2222

2323
## Required privileges
2424

25-
{% include_cached new-in.html version="v25.2" %} To run the `CREATE LOGICALLY REPLICATED` statement to create an LDR stream, the following privileges are required:
25+
{% include_cached new-in.html version="v25.2" %} Users need the following privileges to create an LDR stream with `CREATE LOGICALLY REPLICATED`:
2626

27-
On the source cluster:
27+
- **Source connection string user:** Needs the `REPLICATIONSOURCE` privilege on the source table(s). This is the user specified in the [source connection string]({% link {{ page.version.version }}/set-up-logical-data-replication.md %}#step-2-connect-from-the-destination-to-the-source) in unidirectional or bidirectional streams.
28+
- **User starting the LDR stream on the destination:** Must have `CREATE` on the destination database **and** be the same user that is specified in the destination connection string for a bidirectional stream. The destination table will be created and the user given the `REPLICATIONDEST` privilege on the new table automatically.
29+
- **For reverse (bidirectional) setup:** The original source user must have `REPLICATIONDEST` on the tables in the original source cluster.
2830

29-
- The table-level `REPLICATIONSOURCE` privilege on the source table(s).
31+
LDR from cluster A to B represents a _unidirectional_ setup from a source to a destination cluster. LDR from cluster B to A is the reverse stream for a _bidirectional_ setup:
3032

31-
This is the user provided in the source URI when you start a LDR stream.
32-
33-
On the destination cluster:
34-
35-
- `CREATE` on the parent database of the new table, which allows for the automatic table creation.
36-
37-
For bidirectional LDR:
38-
39-
- The user in the original source URI, who begins the reverse LDR stream, requires the table-level `REPLICATIONDEST` privilege.
33+
Replication direction | Cluster | User role | Required privileges
34+
----------------------+---------+-----------+-------------------
35+
A ➔ B | A | User in source connection string. | `REPLICATIONSOURCE` on A's tables.
36+
A ➔ B | B | User running `CREATE LOGICALLY REPLICATED` from the destination cluster. The destination table will be created and the user given the `REPLICATIONDEST` privilege on the new table automatically.<br>**Note:** Must match the user in the destination connection string for bidirectional LDR. | `CREATE` on B's parent database.
37+
B ➔ A (reverse stream) | B | User in the new source connection string. | `REPLICATIONSOURCE` on B's tables.
38+
Reverse replication requirement | A | Original source connection string user. | `REPLICATIONDEST` on A's tables.
4039

4140
Grant a table-level privilege with the [`GRANT`]({% link {{ page.version.version }}/grant.md %}) statement to a [user or a role]({% link {{ page.version.version }}/security-reference/authorization.md %}#users-and-roles):
4241

src/current/v25.2/set-up-logical-data-replication.md

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -101,45 +101,31 @@ If you are setting up bidirectional LDR, you **must** run this step on both clus
101101
CREATE USER {your_username} WITH PASSWORD '{your_password}';
102102
~~~
103103

104-
Choose the appropriate privilege based on the SQL statement the user will run:
105-
- [`CREATE LOGICAL REPLICATION STREAM`](#create-logical-replication-stream-existing-destination-table) (replicating into an **existing table**)
106-
- [`CREATE LOGICALLY REPLICATED`](#create-logically-replicated-automatically-creates-destination-table) (creating a **new table** as part of the replication).
107-
108-
For details on which syntax to use, refer to the [Syntax](#syntax) section at the beginning of this tutorial.
104+
1. Choose the appropriate privilege based on the SQL statement the user on the destination cluster will run. (For details on which syntax to use, refer to the [Syntax](#syntax) section at the beginning of this tutorial):
105+
- [`CREATE LOGICAL REPLICATION STREAM`]({% link {{ page.version.version }}/create-logical-replication-stream.md %}) (replicating into an **existing table**). Grant the [`REPLICATIONDEST` privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#replicationdest) on the **destination table**, which allows the user to stream data into the existing table:
109106

110-
{{site.data.alerts.callout_info}}
111-
If you are setting up bidirectional LDR, each cluster must **authorize both stream directions** using the table-level privileges. Ensure that you also grant privileges to users running the LDR stream in the reverse direction (from the original destination to the original source).
112-
{{site.data.alerts.end}}
107+
{% include_cached copy-clipboard.html %}
108+
~~~sql
109+
GRANT REPLICATIONDEST ON TABLE {your_db}.{your_schema}.{your_table} TO {your_username};
110+
~~~
111+
- [`CREATE LOGICALLY REPLICATED`]({% link {{ page.version.version }}/create-logically-replicated.md %}) (creating a **new table** as part of the replication). Grant the [`CREATE` privilege]({% link {{ page.version.version }}/create-database.md %}#required-privileges) on the **parent database**, which allows the user to create a new table in the specified database, and the user will automatically have `REPLICATIONDEST` on the table they create:
113112

114-
#### `CREATE LOGICAL REPLICATION STREAM` (existing destination table):
113+
{% include_cached copy-clipboard.html %}
114+
~~~sql
115+
GRANT CREATE ON DATABASE {your_db} TO {your_username};
116+
~~~
115117

116-
{% include_cached new-in.html version="v25.2" %} Grant the [`REPLICATIONDEST` privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#replicationdest) on the **destination table**:
117-
118-
{% include_cached copy-clipboard.html %}
119-
~~~sql
120-
GRANT REPLICATIONDEST ON TABLE {your_db}.{your_schema}.{your_table} TO {your_username};
121-
~~~
122-
123-
This privilege allows the user to stream data into the existing table.
124-
125-
#### `CREATE LOGICALLY REPLICATED` (automatically creates destination table):
126-
127-
{% include_cached new-in.html version="v25.2" %} Grant the [`CREATE` privilege]({% link {{ page.version.version }}/create-database.md %}#required-privileges) on the **parent database**:
128-
129-
{% include_cached copy-clipboard.html %}
130-
~~~sql
131-
GRANT CREATE ON DATABASE {your_db} TO {your_username};
132-
~~~
133-
134-
This allows the user to create a new table in the specified database, and the user will automatically have `REPLICATIONDEST` on the table they create.
135-
136-
1. {% include_cached new-in.html version="v25.2" %} On the **source**, grant the user who will be [specified in the connection string to the source cluster](#step-2-connect-from-the-destination-to-the-source) the [`REPLICATIONSOURCE` privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#replicationsource):
118+
1. On the **source**, grant the user who will be [specified in the connection string to the source cluster](#step-2-connect-from-the-destination-to-the-source) the [`REPLICATIONSOURCE` privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#replicationsource):
137119

138120
{% include_cached copy-clipboard.html %}
139121
~~~sql
140122
GRANT REPLICATIONSOURCE ON TABLE {your_db}.{your_schema}.{your_table} TO {your_username};
141123
~~~
142124

125+
1. (Optional) If you are setting up **bidirectional** LDR, each cluster must authorize both stream directions using the table-level privileges depending on the syntax you're using:
126+
- [`CREATE LOGICAL REPLICATION STREAM`]({% link {{ page.version.version }}/create-logical-replication-stream.md %}) (setting up a reverse stream manually). Grant `REPLICATIONDEST` and `REPLICATIONSOURCE` to the users in the reverse direction.
127+
- [`CREATE LOGICALLY REPLICATED`]({% link {{ page.version.version }}/create-logically-replicated.md %}) (setting up a bidirectional stream automatically). Grant the original source user `REPLICATIONDEST` on the tables.
128+
143129
{{site.data.alerts.callout_info}}
144130
As of v25.2, the `REPLICATION` system privilege has been **deprecated** and replaced with the granular, table-level privileges: `REPLICATIONSOURCE` and `REPLICATIONDEST`.
145131
{{site.data.alerts.end}}

0 commit comments

Comments
 (0)