-
Notifications
You must be signed in to change notification settings - Fork 293
Add guide: Replicate data with DBConvert Streams #3335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
slotix
wants to merge
2
commits into
neondatabase:main
Choose a base branch
from
slotix:add-dbconvert-cdc-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| --- | ||
| title: 'Replicate data with DBConvert Streams' | ||
| subtitle: 'Set up Neon for use with DBConvert Streams for data migration and CDC' | ||
| enableTableOfContents: true | ||
| isDraft: false | ||
| updatedOn: '2025-04-16T14:49:37.564Z' | ||
| --- | ||
|
|
||
| [DBConvert Streams](https://streams.dbconvert.com) is a data integration platform that specializes in real-time data synchronization and CDC (Change Data Capture) operations between various database systems. It enables you to replicate data from your Neon PostgreSQL database to other destinations while maintaining data consistency. | ||
|
|
||
| This guide demonstrates how to configure your Neon PostgreSQL database for connection with DBConvert Streams, including setting up logical replication and user permissions required for CDC operations. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - A [DBConvert Streams account](https://streams.dbconvert.com) | ||
| - A [DBConvert Streams deployed instance](https://streams.dbconvert.com/deploy) | ||
| - A [Neon account](https://console.neon.tech/) | ||
| - Read the [important notices about logical replication in Neon](/docs/guides/logical-replication-neon#important-notices) before you begin | ||
|
|
||
| ## Prepare your source Neon database | ||
|
|
||
| This section describes how to prepare your source Neon database (the publisher) for replicating data to your destination Neon database (the subscriber). | ||
|
|
||
| ### Enable logical replication in Neon | ||
|
|
||
| <Admonition type="important"> | ||
| Enabling logical replication modifies the Postgres `wal_level` configuration parameter, changing it from `replica` to `logical` for all databases in your Neon project. Once the `wal_level` setting is changed to `logical`, it cannot be reverted. Enabling logical replication also restarts all computes in your Neon project, meaning active connections will be dropped and have to reconnect. | ||
| </Admonition> | ||
|
|
||
| To enable logical replication for CDC operations: | ||
|
|
||
| 1. Select your project in the Neon Console | ||
| 2. On the Neon **Dashboard**, select **Settings** | ||
| 3. Select **Logical Replication** | ||
| 4. Click **Enable** to enable logical replication | ||
|
|
||
| You can verify that logical replication is enabled by running the following query from the [Neon SQL Editor](/docs/get-started-with-neon/query-with-neon-sql-editor): | ||
|
|
||
| ```sql | ||
| SHOW wal_level; | ||
| wal_level | ||
| ----------- | ||
| logical | ||
| ``` | ||
|
|
||
|
|
||
| ### Verify replication settings | ||
|
|
||
| After setting up, verify your replication configuration: | ||
|
|
||
| ```sql | ||
| -- Check replication settings | ||
| SELECT name, setting | ||
| FROM pg_settings | ||
| WHERE name IN ( | ||
| 'wal_level', | ||
| 'max_replication_slots', | ||
| 'max_wal_senders' | ||
| ); | ||
| ``` | ||
|
|
||
| ## Configure database users | ||
|
|
||
| For better security, create separate users for regular database operations and CDC operations. | ||
|
|
||
| ### Create a regular database user | ||
|
|
||
| To create a regular database user with standard privileges: | ||
|
|
||
| <Tabs labels={["Console", "SQL"]}> | ||
|
|
||
| <TabItem> | ||
|
|
||
| To create a role in the Neon Console: | ||
|
|
||
| 1. Navigate to the Neon Console | ||
| 2. Select your project | ||
| 3. Select **Branches** | ||
| 4. Select the branch where you want to create the role | ||
| 5. Select the **Roles & Databases** tab | ||
| 6. Click **Add Role** | ||
| 7. Specify a role name (e.g., `app_user`) | ||
| 8. Click **Create** | ||
|
|
||
| </TabItem> | ||
|
|
||
| <TabItem> | ||
|
|
||
| You can create a regular user and assign appropriate permissions with SQL: | ||
|
|
||
| ```sql | ||
| -- Create regular user | ||
| CREATE USER app_user WITH PASSWORD 'strong_password'; | ||
|
|
||
| -- Grant basic privileges | ||
| GRANT CONNECT ON DATABASE your_database TO app_user; | ||
| GRANT USAGE ON SCHEMA public TO app_user; | ||
| GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO app_user; | ||
| ALTER DEFAULT PRIVILEGES IN SCHEMA public | ||
| GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO app_user; | ||
| ``` | ||
|
|
||
| </TabItem> | ||
|
|
||
| </Tabs> | ||
|
|
||
| ### Create a CDC user for replication | ||
|
|
||
| For CDC operations, create a dedicated user with replication privileges: | ||
|
|
||
| <Tabs labels={["Console", "SQL"]}> | ||
|
|
||
| <TabItem> | ||
|
|
||
| To create a CDC role in the Neon Console: | ||
|
|
||
| 1. Follow the same steps as above for creating a regular user | ||
| 2. Name the role something meaningful like `cdc_user` | ||
|
|
||
| The default Postgres role created with your Neon project and roles created using the Neon Console are granted membership in the [neon_superuser](/docs/manage/roles#the-neonsuperuser-role) role, which has the required `REPLICATION` privilege. | ||
|
|
||
| </TabItem> | ||
|
|
||
| <TabItem> | ||
|
|
||
| Create a replication user with the necessary privileges: | ||
|
|
||
| ```sql | ||
| -- Create replication user | ||
| CREATE USER cdc_user WITH REPLICATION PASSWORD 'strong_password'; | ||
|
|
||
| -- Grant necessary privileges | ||
| GRANT CONNECT ON DATABASE your_database TO cdc_user; | ||
| GRANT USAGE ON SCHEMA public TO cdc_user; | ||
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO cdc_user; | ||
| ALTER DEFAULT PRIVILEGES IN SCHEMA public | ||
| GRANT SELECT ON TABLES TO cdc_user; | ||
| ``` | ||
|
|
||
| Verify the privileges are set correctly: | ||
|
|
||
| ```sql | ||
| -- Check replication privilege | ||
| \du cdc_user | ||
|
|
||
| -- Check table permissions | ||
| \dp | ||
| ``` | ||
|
|
||
| </TabItem> | ||
|
|
||
| </Tabs> | ||
|
|
||
|
|
||
|
|
||
| ## Connect DBConvert Streams to Neon | ||
|
|
||
| ### Get your connection information | ||
|
|
||
| 1. From your Neon Project Dashboard, click the **Connect** button | ||
| 2. Copy the connection string provided | ||
|
|
||
| Connection string format: | ||
| ``` | ||
| postgres://user:password@endpoint.region.aws.neon.tech/dbname?sslmode=require | ||
| ``` | ||
|
|
||
| ### Configure connection in DBConvert Streams | ||
|
|
||
| 1. Open DBConvert Streams application | ||
| 2. Create a new connection, selecting PostgreSQL as the database type | ||
| 3. Enter the connection details from your Neon connection string: | ||
| - **Host**: endpoint.region.aws.neon.tech | ||
| - **Port**: 5432 | ||
| - **Database Name**: Your database name | ||
| - **Username**: Your CDC user (e.g., `cdc_user`) | ||
| - **Password**: Your CDC user's password | ||
| - **SSL Mode**: require | ||
|
|
||
| <Admonition type="note"> | ||
| Neon requires SSL connections. Make sure SSL mode is enabled in your connection configuration. | ||
| </Admonition> | ||
|
|
||
| ### Configure CDC settings | ||
|
|
||
| When setting up a CDC pipeline in DBConvert Streams: | ||
|
|
||
| 1. Select the Neon connection as your source | ||
| 2. Select the tables you want to monitor for changes | ||
| 3. Configure your destination connection and mappings | ||
|
|
||
| ## Allow inbound traffic | ||
|
|
||
| If you are using Neon's **IP Allow** feature to limit IP addresses that can connect to Neon, you will need to allow inbound traffic from DBConvert Streams's IP addresses. You can find a IP address when deploying your instance of dbconvert streams in the cloud. For information about configuring allowed IPs in Neon, see [Configure IP Allow](/docs/manage/projects#configure-ip-allow). | ||
|
|
||
|
|
||
|
|
||
| ## References | ||
|
|
||
| - [DBConvert Streams Documentation](https://docs.dbconvert.com) | ||
| - [Logical Replication in PostgreSQL](https://www.postgresql.org/docs/current/logical-replication.html) | ||
|
|
||
| <NeedHelp/> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.