|
| 1 | +# Demo Outline |
| 2 | +:white_check_mark: Setup MongoDB database (Source)<br> |
| 3 | +:white_check_mark: Setup and start Redis Enterprise database (Target)<br> |
| 4 | +:white_check_mark: Setup and start Redis Connect<br> |
| 5 | +:white_check_mark: Perform Initial load and CDC with Redis Connect<br> |
| 6 | + |
| 7 | +# Prerequisites |
| 8 | +Docker compatible [*nix OS](https://en.wikipedia.org/wiki/Unix-like) and [Docker](https://docs.docker.com/get-docker) installed. |
| 9 | +<br>Please have 8 vCPU*, 8GB RAM and 50GB storage for this demo to function properly. Adjust the resources based on your requirements. For HA, at least have 2 Redis Connect Connector instances deployed on separate hosts.</br> |
| 10 | +<br>Execute the following commands (copy & paste) to download and setup Redis Connect and demo scripts. |
| 11 | +i.e.</br> |
| 12 | + |
| 13 | +```bash |
| 14 | +wget -c https://github.com/redis-field-engineering/redis-connect-dist/archive/main.zip && \ |
| 15 | +mkdir -p redis-connect/demo && \ |
| 16 | +mkdir -p redis-connect/k8s-docs && \ |
| 17 | +unzip main.zip "redis-connect-dist-main/examples/mongodb/*" -d redis-connect && \ |
| 18 | +cp -R redis-connect/redis-connect-dist-main/examples/mongodb/demo/* redis-connect/demo && \ |
| 19 | +cp -R redis-connect/redis-connect-dist-main/examples/mongodb/k8s-docs/* redis-connect/k8s-docs && \ |
| 20 | +rm -rf main.zip redis-connect/redis-connect-dist-main && \ |
| 21 | +cd redis-connect && \ |
| 22 | +chmod a+x demo/*.sh && \ |
| 23 | +cd demo |
| 24 | +``` |
| 25 | + |
| 26 | +## Setup MongoDB database (Source) |
| 27 | + |
| 28 | +https://www.mongodb.com/atlas/database |
| 29 | + |
| 30 | +## Setup Redis Enterprise cluster, databases and RedisInsight in docker (Target) |
| 31 | +<br>Execute [setup_re.sh](setup_re.sh)</br> |
| 32 | +```bash |
| 33 | +demo$ ./setup_re.sh |
| 34 | +``` |
| 35 | +**NOTE** |
| 36 | + |
| 37 | +The above script will create a 1-node Redis Enterprise cluster in a docker container, [Create a target database with RediSearch module](https://docs.redislabs.com/latest/modules/add-module-to-database/), [Create a job management and metrics database with RedisTimeSeries module](https://docs.redislabs.com/latest/modules/add-module-to-database/), [Create a RediSearch index for emp Hash](https://redislabs.com/blog/getting-started-with-redisearch-2-0/), [Start a docker instance of grafana with Redis Data Source](https://redisgrafana.github.io/) and [Start an instance of RedisInsight](https://docs.redislabs.com/latest/ri/installing/install-docker/). |
| 38 | + |
| 39 | +## Start Redis Connect |
| 40 | + |
| 41 | +<details><summary>Review options by running Redis Connect docker container </summary> |
| 42 | +<p> |
| 43 | + |
| 44 | +```bash |
| 45 | +demo$ docker run \ |
| 46 | +-it --rm --privileged=true \ |
| 47 | +--name redis-connect-$(hostname) \ |
| 48 | +-v $(pwd)/config:/opt/redislabs/redis-connect/config \ |
| 49 | +-v $(pwd)/config/samples/credentials:/opt/redislabs/redis-connect/config/samples/credentials \ |
| 50 | +--net host \ |
| 51 | +redislabs/redis-connect |
| 52 | +``` |
| 53 | + |
| 54 | +</p> |
| 55 | +</details> |
| 56 | + |
| 57 | +<details><summary>Expected output:</summary> |
| 58 | +<p> |
| 59 | + |
| 60 | +```bash |
| 61 | +------------------------------- |
| 62 | +Redis Connect startup script. |
| 63 | +******************************* |
| 64 | +Please ensure that these environment variables are correctly mapped before executing start and cli options. They can also be found in /opt/redislabs/redis-connect/bin/redisconnect.conf |
| 65 | +Example environment variables and volume mapping for docker based deployments |
| 66 | +-e REDISCONNECT_JOB_MANAGER_CONFIG_PATH=/opt/redislabs/redis-connect/config/jobmanager.properties [OPTIONAL] |
| 67 | +-e REDISCONNECT_LOGBACK_CONFIG=/opt/redislabs/redis-connect/config/logback.xml [OPTIONAL] |
| 68 | +-e REDISCONNECT_JAVA_OPTIONS=-Xms1g -Xmx2g [OPTIONAL] |
| 69 | +-e REDISCONNECT_EXTLIB_DIR=/opt/redislabs/redis-connect/extlib [OPTIONAL] |
| 70 | +-v <HOST_PATH_TO_JOB_MANAGER_PROPERTIES>:/opt/redislabs/redis-connect/config |
| 71 | +-v <HOST_PATH_TO_CREDENTIALS>:/opt/redislabs/redis-connect/config/samples/credentials |
| 72 | +-v <HOST_PATH_TO_EXTLIB>:/opt/redislabs/redis-connect/extlib [OPTIONAL] |
| 73 | +-p 8282:8282 |
| 74 | + |
| 75 | +Usage: [-h|cli|start] |
| 76 | +options: |
| 77 | +-h: Print this help message and exit. |
| 78 | +-v: Print version. |
| 79 | +cli: init Redis Connect CLI |
| 80 | +start: init Redis Connect Instance (Cluster Member) |
| 81 | +------------------------------- |
| 82 | +``` |
| 83 | + |
| 84 | +</p> |
| 85 | +</details> |
| 86 | + |
| 87 | +<details><summary><b>Start Redis Connect Instance</b></summary> |
| 88 | +<p> |
| 89 | + |
| 90 | +```bash |
| 91 | +docker run \ |
| 92 | +-it --rm --privileged=true \ |
| 93 | +--name redis-connect-$(hostname) \ |
| 94 | +-v $(pwd)/config:/opt/redislabs/redis-connect/config \ |
| 95 | +-v $(pwd)/extlib:/opt/redislabs/redis-connect/extlib \ |
| 96 | +--net host \ |
| 97 | +redislabs/redis-connect start |
| 98 | +``` |
| 99 | + |
| 100 | +</p> |
| 101 | +</details> |
| 102 | + |
| 103 | +<details><summary>Expected output:</summary> |
| 104 | +<p> |
| 105 | + |
| 106 | +```bash |
| 107 | + |
| 108 | +``` |
| 109 | + |
| 110 | +</p> |
| 111 | +</details> |
| 112 | + |
| 113 | +**Open browser to access Swagger UI -** [http://localhost:8282/swagger-ui/index.html]() |
| 114 | +<br>_For quick start, use '**cdc_job**' as **jobName**_ |
| 115 | +<br><br><img src="/images/quick-start/Redis Connect Swagger Front Page.jpg" style="float: right;" width = 700px height = 425px/> |
| 116 | + |
| 117 | +**Create Job Configuration** - `/connect/api/vi/job/config/{jobName}` |
| 118 | +<br>_For quick start, use the sample `cdc-job.json` configuration:_ <a href="/examples/mongodb/demo/config/samples/payloads/cdc-job.json">SQL Server</a> |
| 119 | +<br><br><img src="/images/quick-start/Redis Connect Save Job Config.png" style="float: right;" width = 700px height = 375px/> |
| 120 | +<br> |
| 121 | + |
| 122 | +**Or Use `curl` to create the `cdc-job` configuration** <br> |
| 123 | +`demo$ curl -v -X POST "http://localhost:8282/connect/api/v1/job/config/cdc-job" -H "accept: */*" -H "Content-Type: multipart/form-data" -F "file=@config/samples/payloads/cdc-job.json;type=application/json"` |
| 124 | + |
| 125 | +------------------------------- |
| 126 | + |
| 127 | +### Initial Loader Steps |
| 128 | + |
| 129 | +**Start Job -** `/connect/api/vi/job/transition/start/{jobName}/{jobType}` |
| 130 | +<br>Use '**load**' as _**jobType**_ |
| 131 | +<br><br><img src="/images/quick-start/Redis Connect Start Job.png" style="float: right;" width = 700px height = 375px/> |
| 132 | + |
| 133 | +**Or Use `curl` to start the initial load for `cdc-job`** <br> |
| 134 | +`demo$ curl -X POST "http://localhost:8282/connect/api/v1/job/transition/start/cdc-job/load" -H "accept: */*"` |
| 135 | + |
| 136 | +<details><summary><b>Query for the above inserted record in Redis (target)</b></summary> |
| 137 | +<p> |
| 138 | + |
| 139 | +```bash |
| 140 | +demo$ sudo docker exec -it re-node1 bash -c 'redis-cli -p 12000 ft.search idx_emp "@empno:[1 11]"' |
| 141 | + |
| 142 | +``` |
| 143 | + |
| 144 | +</p> |
| 145 | +</details> |
| 146 | + |
| 147 | +------------------------------- |
| 148 | + |
| 149 | +### CDC Steps |
| 150 | + |
| 151 | +**Start Job -** `/connect/api/vi/job/transition/start/{jobName}/{jobType}` |
| 152 | +<br>Use '**stream**' as _**jobType**_ |
| 153 | +<br><br><img src="/images/quick-start/Redis Connect Start Job.png" style="float: right;" width = 700px height = 375px/> |
| 154 | + |
| 155 | +**Or Use `curl` to start the stream for `cdc-job`** <br> |
| 156 | +`demo$ curl -X POST "http://localhost:8282/connect/api/v1/job/transition/start/cdc-job/stream" -H "accept: */*"` |
| 157 | + |
| 158 | +**Confirm Job Claim -** `/connect/api/vi/jobs/claim/{jobStatus}` |
| 159 | +<br>_For quick start, use '**all**' as **jobStatus**_ |
| 160 | +<br><br><img src="/images/quick-start/Redis Connect Get Claims.png" style="float: right;" width = 700px height = 250px/> |
| 161 | + |
| 162 | +**Or Use `curl` to query the `cdc-job` status** <br> |
| 163 | +`demo$ curl -X GET "http://localhost:8282/connect/api/v1/cluster/jobs/claim/all" -H "accept: */*"` |
| 164 | + |
| 165 | +Expected output: `[{"jobId":"{connect}:job:cdc-job","jobName":"cdc-job","jobStatus":"CLAIMED","jobOwner":"30@virag-cdc","jobType":"STREAM"}]` |
| 166 | + |
| 167 | +<b>INSERT/UPDATE a document in MongoDB (source)</b> |
| 168 | +<p> |
| 169 | + |
| 170 | +<details><summary><b>Query for the above inserted record in Redis (target)</b></summary> |
| 171 | +<p> |
| 172 | + |
| 173 | +```bash |
| 174 | +demo$ sudo docker exec -it re-node1 bash -c 'redis-cli -p 12000 ft.search idx_emp "@empno:[1002 1002]"' |
| 175 | + |
| 176 | +``` |
| 177 | + |
| 178 | +</p> |
| 179 | +</details> |
0 commit comments