-
Lorena Ciutacu authored
Add query for validating siphon See merge request !4560 Merged-by:
Lorena Ciutacu <lciutacu@gitlab.com> Approved-by:
Lorena Ciutacu <lciutacu@gitlab.com> Reviewed-by:
Lorena Ciutacu <lciutacu@gitlab.com> Co-authored-by:
Max Woolf <max@woolf.io>
Lorena Ciutacu authoredAdd query for validating siphon See merge request !4560 Merged-by:
Lorena Ciutacu <lciutacu@gitlab.com> Approved-by:
Lorena Ciutacu <lciutacu@gitlab.com> Reviewed-by:
Lorena Ciutacu <lciutacu@gitlab.com> Co-authored-by:
Max Woolf <max@woolf.io>
Configure Siphon to run in GDK
You can configure Siphon to run in GDK. Siphon is not yet ready for production use.
Siphon facilitates data synchronization between PostgreSQL and other data stores. You can use Siphon in GDK to synchronize data between tables in PostgreSQL to matching tables in ClickHouse, which allows you to write features that will benefit from the performance improvements of using an OLAP database.
Prerequisites
Before configuring Siphon to run in GDK, you must:
- Enable ClickHouse in your GDK. For more information, see ClickHouse within GitLab.
- Enable NATS in your GDK.
gdk config set nats.enabled true
- Configure a Docker runtime. Only Docker Desktop is supported, but other container runtimes might work.
Enable logical replication in PostgreSQL
To use Siphon, you must enable logical replication for GDK's main PostgreSQL database:
-
Open the
$GDK_ROOT/postgresql/data/postgresql.conf
file. -
Change
wal_level
value towal_level = logical
. -
If
$GDK_ROOT/postgresql/data/replication.conf
exists, also changewal_level = logical
there. (This file is only likely to exist if PostgreSQL had replication enabled at any point) -
Restart the PostgreSQL service:
gdk restart postgresql
Start and configure Siphon
To start and configure Siphon:
-
Update
gdk.yml
to enable Siphon:gdk config set siphon.enabled true
-
Run
gdk reconfigure
to generate configuration files. -
Optional. In GitLab Rails directory (
gitlab
), run the Siphon migration generator to generate a table. The migration generator creates a migration to create a table in ClickHouse.rails generate gitlab:click_house:siphon users
-
Run the ClickHouse migrations:
bundle exec rake gitlab:clickhouse:migrate
-
Run
gdk start
to start the new service.
Validate
To validate that Siphon is working in your GDK:
-
Check that GDK is running the
siphon-producer-main-db
andsiphon-clickhouse-consumer
services. -
Inspect the output of these services with
gdk tail siphon-producer-main-db
andgdk tail siphon-clickhouse-consumer
. -
Add new data to the provisioned tables (
users
in this case). -
Note that the data should be replicated to the
siphon_users
table in ClickHouse. Validate this using:SELECT COUNT(*) FROM siphon_users FINAL;