The intent of this project is to move data from oracle to mongo and for any data from CDC to flow into mongo db.
Source | Sink |
---|---|
Oracle | MongoDb |
docker-compose.yml
starts the oracledb, mongodb and flink services.
- Run
docker compose up -d
. This brings up oracle db on port 1521, mongo db on 27017 and flink on http://localhost:8081 - Run oracle insert/update queries using
docker-compose exec oracle sqlplus debezium/dbz@localhost:1521/ORCLCDB
- There is a
category
table underDEBEZIUM
which can be used. - Data has to loaded into
category
table as well. - Else create a new table of your choice.
- There is a
- Submit jobs using the sql client in flink by running
docker exec -it jobmanager /opt/flink/bin/sql-client.sh
. This opens up a sql shell where the source and sinks can be configured.
- Run
docker exec -it jobmanager /opt/flink/bin/sql-client.sh
- In the sql shell, if you are continuing with the
category
table,
create table category (
ID INT,
CATEGORY_NAME STRING
) WITH (
'connector' = 'oracle-cdc',
'hostname' = 'host.docker.internal',
'port' = '1521',
'username' = 'dbzuser',
'password' = 'dbz',
'database-name' = 'ORCLCDB',
'schema-name' = 'DEBEZIUM',
'table-name' = 'category'
);
if you are not on OSX replace host.docker.internal
with localhost
.
3. Check if the data is flowing in the stream by,
select * from category
4. This must show up the records which you have inserted earlier. This validates that is source is reachable from the flink cluster.
- In the sql shell, if you are continuing with the
category
table, run
CREATE TABLE mongo_category (
ID INT,
CATEGORY_NAME STRING,
PRIMARY KEY (ID) NOT ENFORCED
) WITH (
'connector' = 'mongodb',
'uri' = 'mongodb://host.docker.internal:27017',
'database' = 'local',
'collection' = 'category'
);
- Test your connectivity using
select * from mongo_category
.