Skip to content

Commit eaba052

Browse files
authored
Merge pull request #766 from Altinity/2.3.0
2.3.0
2 parents 33bc1da + 9e11b61 commit eaba052

32 files changed

+4584
-107
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ First two are good tutorials on MySQL and PostgreSQL respectively.
5959
* [Logging](doc/logging.md)
6060
* [Production Setup](doc/production_setup.md)
6161
* [Adding new tables(Incremental Snapshot)](doc/incremental_snapshot.md)
62+
* [Configuration](doc/configuration.md)
6263

6364
### Operations
6465

doc/Troubleshooting.md

+3
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ https://stackoverflow.com/questions/63523998/multiple-debezium-connector-for-one
5555

5656
### PostgreSQL - ERROR - Error starting connectorio.debezium.DebeziumException: Creation of replication slot failed; when setting up multiple connectors for the same database host, please make sure to use a distinct replication slot name for each.
5757
Make sure to add `slot.name` to the configuration(config.yml) and change it to a unique name.
58+
59+
### PostgreSQL (WAL size growing)
60+
[Handling PostgreSQL WAL Growth with Debezium Connectors](doc/postgres_wal_growth.md)

doc/configuration.md

+33-32
Large diffs are not rendered by default.

doc/postgres_wal_growth.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Handling PostgreSQL WAL Growth with Debezium Connectors
2+
Credits: https://medium.com/@pawanpg0963/postgres-replication-lag-using-debezium-connector-4ba50e330cd6
3+
4+
One of the common problems with PostgreSQL is the WAL size increasing. This issue can be observed when using Debezium connectors for change data capture.
5+
The WAL size increases due to the connector not sending any data to the replication slot.
6+
This can be observed by checking the replication slot lag using the following query:
7+
```sql
8+
postgres=# SELECT slot_name, pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS replicationSlotLag,
9+
pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn)) AS confirmedLag, active FROM pg_replication_slots;
10+
slot_name | replicationslotlag | confirmedlag | active
11+
-----------+--------------------+--------------+--------
12+
db1_slot | 20 GB | 16 GB | t
13+
db2_slot | 62 MB | 42 MB | t
14+
(2 rows)
15+
```
16+
17+
This issue can be addressed using the `heartbeat.interval.ms` configuration
18+
19+
### Solution
20+
Create a new table in postgres (Heartbeat) table.
21+
```sql
22+
CREATE TABLE heartbeat.pg_heartbeat (
23+
random_text TEXT,
24+
last_update TIMESTAMP
25+
);
26+
```
27+
Add the table to the existing publisher used by the connector:
28+
```sql
29+
INSERT INTO heartbeat.pg_heartbeat (random_text, last_update) VALUES ('test_heartbeat', NOW());
30+
```
31+
Add the table to the existing publisher used by the connector:
32+
```
33+
ALTER PUBLICATION db1_pub ADD TABLE heartbeat.pg_heartbeat;
34+
ALTER PUBLICATION db2_pub ADD TABLE heartbeat.pg_heartbeat;
35+
```
36+
Grant privileges to the schema heartbeat and table pg_heartbeat to the replication user used by the connector.
37+
Add the following configuration to `config.yml`
38+
```
39+
heartbeat.interval.ms=10000
40+
heartbeat.action.query="UPDATE heartbeat.pg_heartbeat SET last_update=NOW();"
41+
```

doc/production_setup.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
## Production setup
2-
![](img/production_setup.jpg)
32

43

5-
### Improving throughput and/or Memory usage.
4+
[Throughput & Memory Usage](#improving-throughput-and/or-memory-usage.) \
5+
[Initial Load](#initial-load) \
6+
[PostgreSQL Setup](#postgresql-production-setup)
67

8+
### Improving throughput and/or Memory usage.
9+
![](img/production_setup.jpg)
710
As detailed in the diagram above, there are components that store the messages and
811
can be configured to improve throughput and/or memory usage.
912

@@ -43,7 +46,7 @@ in terms of number of elements the queue can hold and the maximum size of the qu
4346
buffer.flush.time.ms: "1000"
4447
```
4548

46-
## Snapshots (Out of Memory)
49+
## Initial Load
4750

4851
The following parameters might be useful to reduce the memory usage of the connector during the snapshotting phase.
4952

@@ -62,3 +65,12 @@ The maximum number of rows that the connector fetches and reads into memory when
6265

6366
**snapshot.max.threads**: Increase this number from 1 to a higher value to enable parallel snapshotting.
6467

68+
**Single Threaded (Low Memory/Slow replication)**:
69+
By setting the `single.threaded: true` configuration variable in `config.yml`, the replication will skip the sink connector queue and threadpool
70+
and will insert batches directly from the debezium queue.
71+
This mode will work on lower memory setup but will increase the replication speed.
72+
73+
## PostgreSQL Production Setup
74+
75+
One of the common problems with PostgreSQL is the WAL size increasing.
76+
[Handling PostgreSQL WAL Growth with Debezium Connectors](doc/postgres_wal_growth.md)

release-notes/2.3.0.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## What's Changed
2+
* Update Monitoring.md to include metrics.port by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/735
3+
* Added integration test for PostgreSQL keepermap by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/728
4+
* Enable metrics by default for MySQL and postgres by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/750
5+
* Added documentation to set the replication start position by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/753
6+
* Added documentation for using JAR file for postgres replication by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/754
7+
* Update quickstart.md by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/763
8+
* Update quickstart.md update docker tag. by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/764
9+
* Removed schema history configuration settings for postgres by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/755
10+
* 725 we cant start grafana in sink connector we have cert issue by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/760
11+
* Added JMX exporter to export JMX metrics from debezium. by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/757
12+
* Disable validation of source database by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/716
13+
* Added Integration test to validate truncate event replication in post…gresql by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/759
14+
* Fix set lsn to accept string and not long by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/752
15+
* Added logic in retrying database in case of failure by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/761
16+
* 630 postgres heartbeat setup documentation by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/765
17+
* 628 add integration test for mariadb by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/673
18+
* Added functionality to replicate in single threaded mode based on configuration without using a Queue by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/756
19+
* Convert localDateTime to String in show_replica_status API call by @subkanthi in https://github.com/Altinity/clickhouse-sink-connector/pull/736
20+
21+
22+
**Full Changelog**: https://github.com/Altinity/clickhouse-sink-connector/compare/2.2.1...2.3.0

sink-connector-lightweight/dependency-reduced-pom.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
</goals>
4343
<configuration>
4444
<transformers>
45+
<transformer />
4546
<transformer>
4647
<mainClass>com.altinity.clickhouse.debezium.embedded.ClickHouseDebeziumEmbeddedApplication</mainClass>
4748
</transformer>
@@ -118,7 +119,7 @@
118119
<dependency>
119120
<groupId>io.debezium</groupId>
120121
<artifactId>debezium-connector-mongodb</artifactId>
121-
<version>2.7.0.Alpha2</version>
122+
<version>2.7.0.Beta2</version>
122123
<scope>test</scope>
123124
<exclusions>
124125
<exclusion>
@@ -300,13 +301,13 @@
300301
<version.testcontainers>1.19.1</version.testcontainers>
301302
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
302303
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
303-
<sink-connector-library-version>0.0.8</sink-connector-library-version>
304+
<sink-connector-library-version>0.0.9</sink-connector-library-version>
304305
<version.junit>5.9.1</version.junit>
305306
<maven.compiler.source>17</maven.compiler.source>
306307
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
307308
<version.checkstyle.plugin>3.1.1</version.checkstyle.plugin>
308309
<maven.compiler.target>17</maven.compiler.target>
309-
<version.debezium>2.7.0.Alpha2</version.debezium>
310+
<version.debezium>2.7.0.Beta2</version.debezium>
310311
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
311312
</properties>
312313
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Start from the official Grafana image
2+
FROM grafana/grafana:latest
3+
USER root
4+
# Add your CA certificate to the system's trusted certificates
5+
# If you have multiple certificates, you can copy them all
6+
COPY ca-certificates.crt /usr/local/share/ca-certificates/ca-certificates.crt
7+
RUN apk add --no-cache ca-certificates && \
8+
update-ca-certificates
9+
# Install the Grafana plugin
10+
# Replace 'your-plugin-id' with the actual plugin ID
11+
#RUN grafana-cli --pluginUrl https://your-plugin-repository.com/plugins/your-plugin-id install your-plugin-id
12+
13+
# Restart Grafana to pick up the changes
14+
CMD ["/run.sh"]

0 commit comments

Comments
 (0)