-
Notifications
You must be signed in to change notification settings - Fork 33
Demo Script
Tugdual Grall edited this page Apr 5, 2020
·
2 revisions
- Open a terminal and run the Docker compose file to start all containers/services
$ docker-compose up -build
- Once MySQL is Ready, and most of the services too, call the following REST endpoint to start the various events processing services:
# RedisStreamsCDCPublisher : take all existing events and new events from MySQL and push them into Redis Streams
$ curl http://localhost:8082/start
# Takes events out of `movies` and `actors` streams and add new entries in the `imdb` graph.
$ curl http://localhost:8083/start
-
Open Redis Insight, connect to credit service (
localhost:6379
) -
Navigate to the Streams, data, groups to show to users what is presenting the database
-
Go to Graph and run the following queries in the Graph, and navigate in the tree:
MATCH (m:movie{ movie_id: 3}) RETURN m
- You can run any query you want.
$ docker exec -it cdc-debezium-redis_mysql-debezium-service_1 bash
# mysql -umysqluser -pmysqlpw inventory
MySQL> INSERT INTO movies (title, genre, votes, rating, release_year) values ('12 Angry Men', 'Drama', 646033, 8.9, 1957);
- Data is pushed to Debezium, Redis Streams and then Redis Graph, in Redis insight you can run the following query:
MATCH (m:movie{ title: '12 Angry Men'}) RETURN m
-
*Look at the
movie_id
, probably285
, but could be different, we may use it later, you can also useSELECT LAST_INSERT_ID();
in MySQL * -
Let, in MySQL, using a transaction add new actors to the movie
mysql> BEGIN;
mysql> INSERT INTO actors (first_name, last_name, dob) VALUES ('Martin','Balsam', 1919);
mysql> INSERT INTO movies_actors (movie_id, actor_id) VALUES (285, LAST_INSERT_ID() );
mysql> COMMIT;
- Go back to Redis Insight and look at the actors that have acted in this movie. Lets add more actors to the movie, still with a transaction.
mysql> BEGIN;
mysql> INSERT INTO actors (first_name, last_name, dob) VALUES ('John', 'Fiedler', 1925);
mysql> INSERT INTO movies_actors (movie_id, actor_id) VALUES (285, LAST_INSERT_ID() );
mysql> INSERT INTO actors (first_name, last_name, dob) VALUES ('Lee', 'J. Cobb', 1911);
mysql> INSERT INTO movies_actors (movie_id, actor_id) VALUES (285, LAST_INSERT_ID() );
mysql> INSERT INTO actors (first_name, last_name, dob) VALUES ('Jack', 'Klugman', 1922);
mysql> INSERT INTO movies_actors (movie_id, actor_id) VALUES (285, LAST_INSERT_ID() );
mysql> COMMIT;
If you refresh the Cipher Query in Redis Graph, you should see the following graph: