Skip to content

Commit 057373a

Browse files
committed
demo updates
1 parent ec01340 commit 057373a

File tree

14 files changed

+570
-40
lines changed

14 files changed

+570
-40
lines changed

connectors/db2/demo/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ Docker compatible [*nix OS](https://en.wikipedia.org/wiki/Unix-like) and [Docker
33
<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>
44
<br>Execute the following commands (copy & paste) to download and setup Redis Connect db2 Connector and demo scripts.
55
i.e.</br>
6+
67
```bash
78
wget -c https://github.com/redis-field-engineering/redis-connect-dist/archive/main.zip && \
89
mkdir -p redis-connect-db2/demo && \
9-
unzip main.zip "redis-connect-dist-main/connectors/db2/demo/*" -d redis-connect-db2/demo && \
10-
cp -R redis-connect-db2/demo/redis-connect-dist-main/connectors/db2/demo/* redis-connect-db2/demo && \
11-
mv redis-connect-db2/demo/config redis-connect-db2 && \
12-
rm -rf main.zip redis-connect-db2/demo/redis-connect-dist-main && \
10+
mkdir -p redis-connect-db2/k8s-docs && \
11+
unzip main.zip "redis-connect-dist-main/connectors/db2/*" -d redis-connect-db2 && \
12+
cp -R redis-connect-db2/redis-connect-dist-main/connectors/db2/demo/* redis-connect-db2/demo && \
13+
cp -R redis-connect-db2/redis-connect-dist-main/connectors/db2/k8s-docs/* redis-connect-db2/k8s-docs && \
14+
rm -rf main.zip redis-connect-db2/redis-connect-dist-main && \
1315
cd redis-connect-db2 && \
1416
chmod a+x demo/*.sh
1517
```
18+
1619
Expected output:
1720
```bash
1821
redis-connect-db2$ ls
Binary file not shown.
Binary file not shown.

connectors/db2/k8s-docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Overall flow:
1010
5. Stage the Redis Connect job.
1111
6. Start the Redis Connect job.
1212

13-
**Note:** This doc uses `kubectl` and `oc` interchangably.
13+
**Note:** This doc uses `kubectl` and `oc` interchangeably.
1414

1515
## 1. Clone the Redis Connect for db2 Repository
16+
17+
Follow the [demo](../demo) steps then goto k8s-docs directory
1618
```
17-
$ git clone https://github.com/RedisLabs-Field-Engineering/redis-connect-dist.git
18-
...
19-
$ cd redis-connect-dist/connectors/db2/k8s-docs
19+
redis-connect-db2$ cd k8s-docs
2020
```
2121

2222
## 2. Configure Redis Connect
@@ -68,7 +68,7 @@ kubectl create configmap redis-connect-db2-config \
6868
--from-file=Setup.yml=Setup.yml \
6969
--from-file=mapper1.yml=mappers/mapper1.yml \
7070
--from-file=TaskCreator.yml=TaskCreator.yml \
71-
--from-file=redis-connect-custom-stage-demo-1.0-SNAPSHOT.0.jar=redis-connect-custom-stage-demo-1.0-SNAPSHOT.0.jar
71+
--from-file=redis-connect-custom-stage-demo-1.0-SNAPSHOT.jar=redis-connect-custom-stage-demo-1.0-SNAPSHOT.jar
7272
```
7373
The outcome is:
7474
```

connectors/mssql/README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,9 @@ On their own Redis Connect instances are stateless therefore require Redis to ma
5555

5656
## Setting up SQL Server (Source)
5757

58-
Before using the SQL Server connector (redis-connect-sqlserver) to monitor the changes committed on SQL Server, first [enable](https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/enable-and-disable-change-data-capture-sql-server?view=sql-server-2017) _CDC_ on a monitored database.
58+
Please see <a href="https://debezium.io/documentation/reference/stable/connectors/sqlserver.html#setting-up-sqlserver" target="_blank">SQL Server Setup</a> for reference.
5959

60-
<h5>Note: To support net changes queries, the source table must have a primary key or unique index to uniquely identify rows. If a unique index is used, the name of the index must be specified using the <em>@index_name</em> parameter. The columns defined in the primary key or unique index must be included in the list of source columns to be captured.</h5>
61-
62-
Please see [Enable Change Data Capture for a Table](https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/enable-and-disable-change-data-capture-sql-server?view=sql-server-ver15#enable-change-data-capture-for-a-table) for reference.
63-
64-
Please see an example, [SQL Statements](https://github.com/redis-field-engineering/redis-connect-dist/blob/main/connectors/mssql/demo/mssql_cdc.sql) under [Demo](https://github.com/redis-field-engineering/redis-connect-dist/blob/main/connectors/mssql/demo/).
60+
Please see an example under [Demo](demo/setup_mssql.sh).
6561

6662
## Setting up Redis Enterprise Databases (Target)
6763

@@ -73,7 +69,7 @@ Before using the SQL Server connector (redis-connect-sqlserver) to capture the c
7369

7470
**NOTE**
7571

76-
The current [release](https://github.com/RedisLabs-Field-Engineering/redis-connect-dist/releases) has been built with JDK 11 and tested with JRE 1.8 and above. Please have JRE 1.8 ([OpenJRE](https://openjdk.java.net/install/) or OracleJRE) or above installed prior to running this connector.
72+
The current [release](https://github.com/RedisLabs-Field-Engineering/redis-connect-dist/releases) has been built with JDK 11 and tested with JRE 11 and above. Please have JRE 11+ installed prior to running this connector.
7773

7874
---
7975

@@ -430,7 +426,7 @@ redis-connect-sqlserver/bin$ ./redisconnect.sh stage
430426
```
431427

432428
<h4>Start Redis Connect Job</h4>
433-
<br>Once staging is done, execute the same script with <i>start</i> option to start the configured Job(s) i.e. an instance of Redis Connect.
429+
Once staging is done, execute the same script with <i>start</i> option to start the configured Job(s) i.e. an instance of Redis Connect.
434430

435431
```bash
436432
redis-connect-sqlserver/bin$ ./redisconnect.sh start
@@ -439,3 +435,4 @@ redis-connect-sqlserver/bin$ ./redisconnect.sh start
439435
| ℹ️ |
440436
|:-------------------------------------------|
441437
| Quick Start: Follow the [demo](demo) |
438+
| K8s Setup: Follow the [k8s-docs](k8s-docs) |

connectors/mssql/demo/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ Docker compatible [*nix OS](https://en.wikipedia.org/wiki/Unix-like) and [Docker
44
<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>
55
<br>Execute the following commands (copy & paste) to download and setup Redis Connect MSSQL Connector and demo scripts.
66
i.e.</br>
7+
78
```bash
89
wget -c https://github.com/redis-field-engineering/redis-connect-dist/archive/main.zip && \
910
mkdir -p redis-connect-sqlserver/demo && \
10-
unzip main.zip "redis-connect-dist-main/connectors/mssql/demo/*" -d redis-connect-sqlserver/demo && \
11-
cp -R redis-connect-sqlserver/demo/redis-connect-dist-main/connectors/mssql/demo/* redis-connect-sqlserver/demo && \
12-
mv redis-connect-sqlserver/demo/config redis-connect-sqlserver && \
13-
rm -rf main.zip redis-connect-sqlserver/demo/redis-connect-dist-main && \
11+
mkdir -p redis-connect-sqlserver/k8s-docs && \
12+
unzip main.zip "redis-connect-dist-main/connectors/sqlserver/*" -d redis-connect-sqlserver && \
13+
cp -R redis-connect-sqlserver/redis-connect-dist-main/connectors/sqlserver/demo/* redis-connect-sqlserver/demo && \
14+
cp -R redis-connect-sqlserver/redis-connect-dist-main/connectors/sqlserver/k8s-docs/* redis-connect-sqlserver/k8s-docs && \
15+
rm -rf main.zip redis-connect-sqlserver/redis-connect-dist-main && \
1416
cd redis-connect-sqlserver && \
1517
chmod a+x demo/*.sh
1618
```
19+
1720
Expected output:
1821
```bash
1922
redis-connect-sqlserver$ ls

connectors/mssql/k8s-docs/README.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Redis Connect for MSSQL in K8s
2+
3+
This repository describes the steps involved to deploy Redis Connect for MSSQL in K8s.
4+
5+
Overall flow:
6+
1. Clone the Redis Connect for MSSQL repository.
7+
2. Configure Redis Connect as in <a href="../demo/config/samples/sqlserver" target="_blank">this set of docs</a>.
8+
3. Deploy the Redis Connect configuration to Kubernetes.
9+
4. Configure the Redis Connect deployment manifests.
10+
5. Stage the Redis Connect job.
11+
6. Start the Redis Connect job.
12+
13+
**Note:** This doc uses `kubectl` and `oc` interchangeably.
14+
15+
## 1. Clone the Redis Connect for MSSQL Repository
16+
17+
Follow the [demo](../demo) steps then goto k8s-docs directory
18+
```
19+
redis-connect-sqlserver$ cd k8s-docs
20+
```
21+
22+
## 2. Configure Redis Connect
23+
24+
Configure the files to describe your Redis Connect Job. One sample configuration is <a href="../demo/config/samples/sqlserver" target="_blank">here</a>.
25+
26+
Redis Connect is a Java application which is a client of both the source RDBMS and the target Redis. As such, you will need:
27+
* Source database details (endpoint, port, credentials)
28+
* <a href="../" target="_blank">CDC and replication configuration</a> completed on the source database system
29+
* Source schema details
30+
* Target Redis details and instances (one for the data, one for the Job configuration)
31+
32+
Details for configuring Redis Connect for MSSQL are <a href="../demo/" target="_blank">here</a>.
33+
34+
## 3. Deploy the Redis Connect Configuration to Kubernetes
35+
36+
This deployment requires the use of K8s ConfigMaps. The necessary config maps will be uploaded from your local directories using the commands below.
37+
38+
```
39+
$ cd ../demo/config/samples/sqlserver
40+
demo/config/samples/sqlserver$ ls
41+
FormatterConfig.yml JobManager.yml env.yml templates/
42+
JobConfig.yml Setup.yml mappers/
43+
```
44+
45+
Here is an example of creating the ConfigMap. This command should be *run from the directory containing your config files*.
46+
```
47+
kubectl create configmap redis-connect-sqlserver-config \
48+
--from-file=JobConfig.yml=JobConfig.yml \
49+
--from-file=JobManager.yml=JobManager.yml \
50+
--from-file=env.yml=env.yml \
51+
--from-file=Setup.yml=Setup.yml \
52+
--from-file=mapper1.yml=mappers/mapper1.yml
53+
```
54+
The outcome is:
55+
```
56+
$ oc get configmap/redis-connect-sqlserver-config
57+
NAME DATA AGE
58+
redis-connect-sqlserver-config 5 5s
59+
```
60+
61+
If you need to add a custom stage jar file then you can append that to the ConfigMap creation as follows:
62+
```
63+
kubectl create configmap redis-connect-sqlserver-config \
64+
--from-file=JobConfig.yml=JobConfig.yml \
65+
--from-file=JobManager.yml=JobManager.yml \
66+
--from-file=env.yml=env.yml \
67+
--from-file=Setup.yml=Setup.yml \
68+
--from-file=mapper1.yml=mappers/mapper1.yml \
69+
--from-file=redis-connect-custom-stage-demo-1.0-SNAPSHOT.jar=redis-connect-custom-stage-demo-1.0-SNAPSHOT.jar
70+
```
71+
The outcome is:
72+
```
73+
$ oc get configmap/redis-connect-sqlserver-config
74+
NAME DATA AGE
75+
redis-connect-sqlserver-config 6 12s
76+
```
77+
78+
If the ConfigMap did not get created, it's likely that one of more of the source configuration files was not found (eg. JobConfig.yml) so please verify the path to your files.
79+
80+
The details of the the command above are:
81+
`kubectl create configmap <configmap_name> --from-file=<key_name>=<path-to/file_name>`
82+
83+
**Note:** ConfigMaps are immutable so if you are making changes to an existing configuration, you need to delete the existing configuration first.
84+
85+
### How Does the ConfigMap get used?
86+
87+
The values of keys in the ConfigMap will be mounted directly to the pod's filesystem.
88+
89+
The following volume mount is defined in the manifests. The a will mount the resource `config-volume` to that `mountPath`.
90+
```
91+
volumeMounts:
92+
- name: config-volume
93+
mountPath: /opt/redislabs/redis-connect-sqlserver/config/fromconfigmap
94+
```
95+
The volume is defined through the following `volume` directive. It will mount the file/pth `JobConfig.yml` using the contents of the key named `JobConfig.yml` from the ConfigMap `redis-connect-sqlserver-config` in the `mountPath` define above.
96+
```
97+
volumes:
98+
- name: config-volume
99+
configMap:
100+
name: redis-connect-sqlserver-config
101+
items:
102+
- key: JobConfig.yml
103+
path: JobConfig.yml
104+
```
105+
The effect of this mapping in the pod's filesystem is the following:
106+
```
107+
root@redis-connect-sqlserver-7b7ccf87b9-sqshl> pwd
108+
/opt/redislabs/redis-connect-sqlserver/config/fromconfigmap
109+
root@redis-connect-sqlserver-7b7ccf87b9-sqshl> ls -al
110+
total 0
111+
drwxrwxrwx 3 root root 149 Aug 12 15:52 .
112+
drwxr-xr-x 1 root root 27 Aug 12 15:52 ..
113+
drwxr-xr-x 3 root root 96 Aug 12 15:52 ..2021_08_12_15_52_06.258096011
114+
lrwxrwxrwx 1 root root 31 Aug 12 15:52 ..data -> ..2021_08_12_15_52_06.258096011
115+
lrwxrwxrwx 1 root root 20 Aug 12 15:52 JobConfig.yml -> ..data/JobConfig.yml
116+
lrwxrwxrwx 1 root root 21 Aug 12 15:52 JobManager.yml -> ..data/JobManager.yml
117+
lrwxrwxrwx 1 root root 16 Aug 12 15:52 Setup.yml -> ..data/Setup.yml
118+
lrwxrwxrwx 1 root root 14 Aug 12 15:52 env.yml -> ..data/env.yml
119+
lrwxrwxrwx 1 root root 14 Aug 12 15:52 mappers -> ..data/mappers
120+
```
121+
The final link is the environment variable that instructs Redis Connect to use these mapped files:
122+
```
123+
env:
124+
- name: REDISCONNECT_CONFIG
125+
value: "/opt/redislabs/redis-connect-sqlserver/config/fromconfigmap"
126+
```
127+
128+
## 4. Configure the Redis Connect Deployment Manifests
129+
130+
Update both the `redis-connect-sqlserver-stage.yaml` and `redis-connect-sqlserver-start.yaml` to map the appropriate environment variables in the `env:` section. Notable, the `REDISCONNECT_SOURCE_USERNAME`, `REDISCONNECT_SOURCE_PASSWORD`, `REDISCONNECT_TARGET_USERNAME` and `REDISCONNECT_TARGET_PASSWORD`.
131+
132+
Examples are provided to populate environment variables from the manifest/yaml, from configmap, and from k8s secrets for sensitive info such as credentials:
133+
134+
```
135+
- name: REDISCONNECT_SOURCE_PASSWORD
136+
value: admin123
137+
# valueFrom:
138+
# configMapKeyRef:
139+
# key: REDISCONNECT_SOURCE_PASSWORD
140+
# name: redis-connect-sqlserver-config
141+
# valueFrom:
142+
# secretKeyRef:
143+
# key: password
144+
# name: redis-connect-secret
145+
```
146+
147+
## 5. Stage the Redis Connect Job
148+
149+
Apply the stage manifest as follows: `oc apply -f redis-connect-sqlserver-stage.yaml`. The outcome will be a k8s batch/Job which will run once and exit.
150+
```
151+
$ oc get po -w
152+
NAME READY STATUS RESTARTS AGE
153+
redis-connect-sqlserver-stage-lkvp2 0/1 Completed 0 44s
154+
```
155+
156+
The effect of this stage operation is the configuration keys are loaded in to the target Redis instance defined in `env.yml`:`jobConfigConnection`. The Job should have an `UNASSIGNED` owner.
157+
158+
## 6. Start the Redis Connect Job
159+
160+
Apply the stage manifest as follows: `oc apply -f redis-connect-sqlserver-start.yaml`. The outcome will be a k8s apps/Deployment which will run continually.
161+
```
162+
$ oc get po -w
163+
NAME READY STATUS RESTARTS AGE
164+
redis-connect-sqlserver-cbc7dcd9d-k9mxj 1/1 Running 0 4s
165+
redis-connect-sqlserver-stage-lkvp2 0/1 Completed 0 3m10s
166+
```
167+
168+
The effect of the above is that the Redis Connect job has started. The Job Owner should be specified in the in `env.yml`:`jobConfigConnection` Redis DB as `JC-xx@redis-connect-sqlserver-cbc7dcd9d-k9mxj` indicating that the pod created is the Redis Connect job owner. You should see your changes propagate to the `targetConnection` Redis database as defined in `env.yml`.
169+
170+
---
171+
### Troubleshooting Options
172+
173+
1. Tail the pod logs. `oc logs -f pod/redis-connect-sqlserver-cbc7dcd9d-k9mxj`
174+
2. Start the pods in interactive mode.
175+
* Launch the pods in a do/while loop instead of the redisconnect.sh start command:
176+
```
177+
#### uncomment the following two lines while you are setting up your
178+
command: [ "/bin/bash", "-c", "--" ]
179+
args: [ "while true; do sleep 30; done;" ]
180+
####
181+
# comment out the default starting point
182+
# command: ["/opt/redislabs/redis-connect-sqlserver/bin/redisconnect.sh", "start"]
183+
```
184+
* Now you can leverage the `bin/redisconnect.sh` enterpoint interactively to:
185+
* Test source and target connections
186+
* Run Redis Connect interactively to test a configuration
187+
3. Enable more verbose logging.
188+
* Adjust and add `logback.xml` to your ConfigMap
189+
* Add to the `volumeMounts` and `volumes` to leverage the map the `logback.xml` file.
190+
* Point to the file in the `REDISCONNECT_LOGBACK_CONFIG` environment variable.
191+

0 commit comments

Comments
 (0)