Setting up pub sub
Setting up Pub/Sub
Overview
In this tutorial, we will learn how to run Debezium Server with Pub/Sub sink and Artie Transfer locally using Docker.
Prerequisites
- Terraform
- Docker
- gcloud CLI
- GCP Project
Set-up
gcloud CLI
Please visit this link to download the CLI. Once you have done so, run this command:
Pub/Sub API
To use Pub/Sub in your GCP project, you will also need to enable it. Visit this link to enable it.
Creating a service account
Download the service account credentials
Once your service account has been created, head to the GCP console and create a key for the service account. Save the key as we will be referencing it in the later steps.
Create the Pub/Sub topic and subscriptions
Debezium will not automatically create topics or subscriptions for you.
Running Debezium
Within the pubsub examples folder, make sure to modify the application.properties to specify the project_id
. If you need help locating your GCP Project ID, see #getting-your-project-identifier
Running Transfer
Below is the config.yaml where the test database
will just output the query commands into the terminal. Make sure to also fill out the projectID
Visit options.md to see all the possible options for your configuration file and examples.md.
Docker Compose File
Now, within the docker-compose.yaml file, you will need to specify the path to your credentials that you have downloaded from the prior step. #download-the-service-account-credentials.
Putting everything together
When running this, the PostgreSQL database already has some seeded data. As a result, we can see the merge statement being issued to add the seeded data.
Now that PostgreSQL is running locally on 0.0.0.0:5432
, you can open up a SQL editor to interact with the data model. The example below, we are updating the first_name
of a customer object and the change is directly streamed to Artie.
Closing remarks
We hope you found this tutorial helpful.
- The code for this tutorial can be found here.
- To understand how Artie Transfer works with Google Pub/Sub under the hood, please click on this link.
- If you run into any other issues, please file a bug report on our GitHub page or get in touch at
[email protected]
.
Was this page helpful?