Start using Docker:
cd docker
docker compose up -dCheck go-etl-related containers:
docker exec -it etl bashConnect using clients like DBeaver.
Connect to postgres_source:
127.0.0.1:5432
db1
user1
password1
Connect to postgres_dest:
127.0.0.1:5433
db2
user2
password2
Open in browser: http://127.0.0.1:9090.
Open in browser: http://127.0.0.1:3000.
- Connect to
postgres_source. Ifsource.splittable doesn't exist, execute:
CREATE SCHEMA source;
CREATE TABLE source.split (
id bigint,
dt date,
str varchar(10)
);- Connect to
postgres_dest. Ifdest.splittable doesn't exist, execute:
CREATE SCHEMA dest;
CREATE TABLE dest.split (
id bigint,
dt date,
str varchar(10)
);Place data files and import_config.json in ETL's mounted volume:
cd docker/data
go run main.go- Import data to source PostgreSQL:
docker exec -it etl release/bin/go-etl -http :6080 -c data/import_config.json- Sync data to destination PostgreSQL:
docker exec -it etl release/bin/go-etl -http :6080 -c data/config.json- Check job status:
up{job="etl"}
- Get total sync records:
datax_channel_total_record
- Get records per second:
rate(datax_channel_total_record{job="etl"}[1m])
- Get total data volume:
datax_channel_total_byte
- Get data volume per second:
rate(datax_channel_total_byte{job="etl"}[30s])
The following are detailed steps for adding a Prometheus data source in Grafana:
Open your browser and access the Grafana address (default http://127.0.0.1:3000), and log in with the administrator account (default username/password: admin/admin).
- Click on ⚙️ Configuration (gear icon) in the left sidebar.
- Select Data Sources.
- Click Add data source.
- Enter
Prometheusin the search box and select the Prometheus data source type.
- HTTP Settings:
- URL: Enter the Prometheus address
- For local deployment:
http://etl:9090
- For local deployment:
- URL: Enter the Prometheus address
- Click Save & test at the bottom.
- The message Data source is working indicates success.
- First click Dashboards, then click New, and then click Import, select
go-etl-grafana.jsonto import. - Click datasource and select
Prometheus.
This completes the monitoring setup for go-etl with Prometheus and Grafana.