Skip to content

Commit f2e1597

Browse files
committed
Updated re scripts to load module info dynamically.
1 parent fefe220 commit f2e1597

File tree

6 files changed

+253
-19
lines changed

6 files changed

+253
-19
lines changed

connectors/db2/demo/setup_re.sh

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,50 @@ echo ""
1616
# Test the cluster
1717
sudo docker exec -it re-node1 bash -c "/opt/redislabs/bin/rladmin info cluster"
1818

19+
# Get the module info to be used for database creation
20+
tee -a list_modules.sh <<EOF
21+
curl -s -k -L -u [email protected]:redislabs --location-trusted -H "Content-Type: application/json" -X GET https://localhost:9443/v1/modules | python -c 'import sys, json; modules = json.load(sys.stdin);
22+
modulelist = open("./module_list.txt", "a")
23+
for i in modules:
24+
lines = i["display_name"], " ", i["module_name"], " ", i["uid"], " ", i["semantic_version"], "\n"
25+
modulelist.writelines(lines)
26+
modulelist.close()'
27+
EOF
28+
29+
sudo docker cp list_modules.sh re-node1:/opt/list_modules.sh
30+
sudo docker exec --user root -it re-node1 bash -c "chmod 777 /opt/list_modules.sh"
31+
sudo docker exec --user root -it re-node1 bash -c "/opt/list_modules.sh"
32+
33+
json_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i json /opt/module_list.txt | cut -d ' ' -f 2")
34+
json_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i json /opt/module_list.txt | cut -d ' ' -f 4")
35+
search_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i search /opt/module_list.txt | cut -d ' ' -f 3")
36+
search_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i search /opt/module_list.txt | cut -d ' ' -f 5")
37+
timeseries_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i timeseries /opt/module_list.txt | cut -d ' ' -f 2")
38+
timeseries_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i timeseries /opt/module_list.txt | cut -d ' ' -f 4")
39+
1940
echo "Creating databases..."
20-
rm create_demodb.sh
2141
tee -a create_demodb.sh <<EOF
22-
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{ "name": "RedisConnect-Target-db", "port": 12000, "memory_size": 1000000000, "type" : "redis", "replication": false, "module_list": [ {"module_args": "PARTITIONS AUTO", "module_id": "9f8e4b44fbd28838190dbee7935e964d", "module_name": "search", "semantic_version": "2.0.11"}, {"module_args": "", "module_id": "4942f870bcd96678dd92cd55ae5d2801", "module_name": "ReJSON", "semantic_version": "1.0.8"} ] }' https://localhost:9443/v1/bdbs
23-
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{"name": "RedisConnect-JobConfig-Metrics-db", "type":"redis", "replication": false, "memory_size":1000000000, "port":12001, "module_list": [{"module_args": "", "module_id": "6715acd18978c330bb2fb3f4193f070c", "module_name": "timeseries", "semantic_version": "1.4.10"}]}' https://localhost:9443/v1/bdbs
42+
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{ "name": "RedisConnect-Target-db", "port": 12000, "memory_size": 1000000000, "type" : "redis", "replication": false, "module_list": [ {"module_args": "PARTITIONS AUTO", "module_name": "$search_module_name", "semantic_version": "$search_semantic_version"}, {"module_args": "", "module_name": "$json_module_name", "semantic_version": "$json_semantic_version"} ] }' https://localhost:9443/v1/bdbs
43+
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{"name": "RedisConnect-JobConfig-Metrics-db", "type":"redis", "replication": false, "memory_size":1000000000, "port":12001, "module_list": [{"module_args": "", "module_name": "$timeseries_module_name", "semantic_version": "$timeseries_semantic_version"} ] }' https://localhost:9443/v1/bdbs
2444
EOF
45+
2546
sleep 20
47+
2648
sudo docker cp create_demodb.sh re-node1:/opt/create_demodb.sh
2749
sudo docker exec --user root -it re-node1 bash -c "chmod 777 /opt/create_demodb.sh"
50+
//g" /opt/create_demodb.sh"t -it re-node1 bash -c "sed -i "s/
2851
sudo docker exec -it re-node1 bash -c "/opt/create_demodb.sh"
2952
echo ""
3053

54+
echo Created RedisConnect-Target-db with
55+
echo $search_module_name
56+
echo $search_semantic_version
57+
echo $json_module_name
58+
echo $json_semantic_version
59+
echo Created RedisConnect-JobConfig-Metrics-db with
60+
echo $timeseries_module_name
61+
echo $timeseries_semantic_version
62+
3163
echo "Creating idx:emp index for search.."
3264
sleep 10
3365
sudo docker exec -it re-node1 bash -c "/opt/redislabs/bin/redis-cli -p 12000 ft.create idx:emp on hash prefix 1 'emp:' schema EmpNum numeric sortable FName text sortable LName text Job tag sortable Manager numeric HireDate text Salary numeric Commission numeric Department numeric"
@@ -47,3 +79,10 @@ sudo docker run -d -p 3000:3000 --name=grafana -e "GF_INSTALL_PLUGINS=redis-data
4779
echo "You can open a browser and access RedisInsight client UI at http://127.0.0.1:18001 (replace localhost with your ip/host) and add databases to monitor."
4880
echo "Please visit, https://docs.redis.com/latest/ri/using-redisinsight/add-instance/ for steps to add these databases to RedisInsight."
4981
echo "DISCLAIMER: This is best for local development or functional testing. Please see, https://docs.redis.com/latest/rs/getting-started/getting-started-docker"
82+
83+
# Cleanup
84+
rm list_modules.sh
85+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/list_modules.sh"
86+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/module_list.txt"
87+
rm create_demodb.sh
88+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/create_demodb.sh"

connectors/gemfire/demo/setup_re.sh

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,50 @@ echo ""
1616
# Test the cluster
1717
sudo docker exec -it re-node1 bash -c "/opt/redislabs/bin/rladmin info cluster"
1818

19+
# Get the module info to be used for database creation
20+
tee -a list_modules.sh <<EOF
21+
curl -s -k -L -u [email protected]:redislabs --location-trusted -H "Content-Type: application/json" -X GET https://localhost:9443/v1/modules | python -c 'import sys, json; modules = json.load(sys.stdin);
22+
modulelist = open("./module_list.txt", "a")
23+
for i in modules:
24+
lines = i["display_name"], " ", i["module_name"], " ", i["uid"], " ", i["semantic_version"], "\n"
25+
modulelist.writelines(lines)
26+
modulelist.close()'
27+
EOF
28+
29+
sudo docker cp list_modules.sh re-node1:/opt/list_modules.sh
30+
sudo docker exec --user root -it re-node1 bash -c "chmod 777 /opt/list_modules.sh"
31+
sudo docker exec --user root -it re-node1 bash -c "/opt/list_modules.sh"
32+
33+
json_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i json /opt/module_list.txt | cut -d ' ' -f 2")
34+
json_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i json /opt/module_list.txt | cut -d ' ' -f 4")
35+
search_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i search /opt/module_list.txt | cut -d ' ' -f 3")
36+
search_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i search /opt/module_list.txt | cut -d ' ' -f 5")
37+
timeseries_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i timeseries /opt/module_list.txt | cut -d ' ' -f 2")
38+
timeseries_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i timeseries /opt/module_list.txt | cut -d ' ' -f 4")
39+
1940
echo "Creating databases..."
20-
rm create_demodb.sh
2141
tee -a create_demodb.sh <<EOF
22-
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{ "name": "RedisConnect-Target-db", "port": 12000, "memory_size": 1000000000, "type" : "redis", "replication": false, "module_list": [ {"module_args": "PARTITIONS AUTO", "module_id": "9f8e4b44fbd28838190dbee7935e964d", "module_name": "search", "semantic_version": "2.0.11"}, {"module_args": "", "module_id": "4942f870bcd96678dd92cd55ae5d2801", "module_name": "ReJSON", "semantic_version": "1.0.8"} ] }' https://localhost:9443/v1/bdbs
23-
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{"name": "RedisConnect-JobConfig-Metrics-db", "type":"redis", "replication": false, "memory_size":1000000000, "port":12001, "module_list": [{"module_args": "", "module_id": "6715acd18978c330bb2fb3f4193f070c", "module_name": "timeseries", "semantic_version": "1.4.10"}]}' https://localhost:9443/v1/bdbs
42+
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{ "name": "RedisConnect-Target-db", "port": 12000, "memory_size": 1000000000, "type" : "redis", "replication": false, "module_list": [ {"module_args": "PARTITIONS AUTO", "module_name": "$search_module_name", "semantic_version": "$search_semantic_version"}, {"module_args": "", "module_name": "$json_module_name", "semantic_version": "$json_semantic_version"} ] }' https://localhost:9443/v1/bdbs
43+
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{"name": "RedisConnect-JobConfig-Metrics-db", "type":"redis", "replication": false, "memory_size":1000000000, "port":12001, "module_list": [{"module_args": "", "module_name": "$timeseries_module_name", "semantic_version": "$timeseries_semantic_version"} ] }' https://localhost:9443/v1/bdbs
2444
EOF
45+
2546
sleep 20
47+
2648
sudo docker cp create_demodb.sh re-node1:/opt/create_demodb.sh
2749
sudo docker exec --user root -it re-node1 bash -c "chmod 777 /opt/create_demodb.sh"
50+
//g" /opt/create_demodb.sh"t -it re-node1 bash -c "sed -i "s/
2851
sudo docker exec -it re-node1 bash -c "/opt/create_demodb.sh"
2952
echo ""
3053

54+
echo Created RedisConnect-Target-db with
55+
echo $search_module_name
56+
echo $search_semantic_version
57+
echo $json_module_name
58+
echo $json_semantic_version
59+
echo Created RedisConnect-JobConfig-Metrics-db with
60+
echo $timeseries_module_name
61+
echo $timeseries_semantic_version
62+
3163
echo "Creating idx:emp index for search.."
3264
sleep 10
3365
sudo docker exec -it re-node1 bash -c "/opt/redislabs/bin/redis-cli -p 12000 ft.create idx:emp on hash prefix 1 'emp:' schema EmpNum numeric sortable FName text sortable LName text Job tag sortable Manager numeric HireDate text Salary numeric Commission numeric Department numeric"
@@ -47,3 +79,10 @@ sudo docker run -d -p 3000:3000 --name=grafana -e "GF_INSTALL_PLUGINS=redis-data
4779
echo "You can open a browser and access RedisInsight client UI at http://127.0.0.1:18001 (replace localhost with your ip/host) and add databases to monitor."
4880
echo "Please visit, https://docs.redis.com/latest/ri/using-redisinsight/add-instance/ for steps to add these databases to RedisInsight."
4981
echo "DISCLAIMER: This is best for local development or functional testing. Please see, https://docs.redis.com/latest/rs/getting-started/getting-started-docker"
82+
83+
# Cleanup
84+
rm list_modules.sh
85+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/list_modules.sh"
86+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/module_list.txt"
87+
rm create_demodb.sh
88+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/create_demodb.sh"

connectors/mssql/demo/setup_re.sh

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,50 @@ echo ""
1616
# Test the cluster
1717
sudo docker exec -it re-node1 bash -c "/opt/redislabs/bin/rladmin info cluster"
1818

19+
# Get the module info to be used for database creation
20+
tee -a list_modules.sh <<EOF
21+
curl -s -k -L -u [email protected]:redislabs --location-trusted -H "Content-Type: application/json" -X GET https://localhost:9443/v1/modules | python -c 'import sys, json; modules = json.load(sys.stdin);
22+
modulelist = open("./module_list.txt", "a")
23+
for i in modules:
24+
lines = i["display_name"], " ", i["module_name"], " ", i["uid"], " ", i["semantic_version"], "\n"
25+
modulelist.writelines(lines)
26+
modulelist.close()'
27+
EOF
28+
29+
sudo docker cp list_modules.sh re-node1:/opt/list_modules.sh
30+
sudo docker exec --user root -it re-node1 bash -c "chmod 777 /opt/list_modules.sh"
31+
sudo docker exec --user root -it re-node1 bash -c "/opt/list_modules.sh"
32+
33+
json_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i json /opt/module_list.txt | cut -d ' ' -f 2")
34+
json_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i json /opt/module_list.txt | cut -d ' ' -f 4")
35+
search_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i search /opt/module_list.txt | cut -d ' ' -f 3")
36+
search_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i search /opt/module_list.txt | cut -d ' ' -f 5")
37+
timeseries_module_name=$(sudo docker exec --user root -it re-node1 bash -c "grep -i timeseries /opt/module_list.txt | cut -d ' ' -f 2")
38+
timeseries_semantic_version=$(sudo docker exec --user root -it re-node1 bash -c "grep -i timeseries /opt/module_list.txt | cut -d ' ' -f 4")
39+
1940
echo "Creating databases..."
20-
rm create_demodb.sh
2141
tee -a create_demodb.sh <<EOF
22-
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{ "name": "RedisConnect-Target-db", "port": 12000, "memory_size": 1000000000, "type" : "redis", "replication": false, "module_list": [ {"module_args": "PARTITIONS AUTO", "module_id": "9f8e4b44fbd28838190dbee7935e964d", "module_name": "search", "semantic_version": "2.0.11"}, {"module_args": "", "module_id": "4942f870bcd96678dd92cd55ae5d2801", "module_name": "ReJSON", "semantic_version": "1.0.8"} ] }' https://localhost:9443/v1/bdbs
23-
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{"name": "RedisConnect-JobConfig-Metrics-db", "type":"redis", "replication": false, "memory_size":1000000000, "port":12001, "module_list": [{"module_args": "", "module_id": "6715acd18978c330bb2fb3f4193f070c", "module_name": "timeseries", "semantic_version": "1.4.10"}]}' https://localhost:9443/v1/bdbs
42+
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{ "name": "RedisConnect-Target-db", "port": 12000, "memory_size": 1000000000, "type" : "redis", "replication": false, "module_list": [ {"module_args": "PARTITIONS AUTO", "module_name": "$search_module_name", "semantic_version": "$search_semantic_version"}, {"module_args": "", "module_name": "$json_module_name", "semantic_version": "$json_semantic_version"} ] }' https://localhost:9443/v1/bdbs
43+
curl -v -k -L -u [email protected]:redislabs --location-trusted -H "Content-type:application/json" -d '{"name": "RedisConnect-JobConfig-Metrics-db", "type":"redis", "replication": false, "memory_size":1000000000, "port":12001, "module_list": [{"module_args": "", "module_name": "$timeseries_module_name", "semantic_version": "$timeseries_semantic_version"} ] }' https://localhost:9443/v1/bdbs
2444
EOF
45+
2546
sleep 20
47+
2648
sudo docker cp create_demodb.sh re-node1:/opt/create_demodb.sh
2749
sudo docker exec --user root -it re-node1 bash -c "chmod 777 /opt/create_demodb.sh"
50+
//g" /opt/create_demodb.sh"t -it re-node1 bash -c "sed -i "s/
2851
sudo docker exec -it re-node1 bash -c "/opt/create_demodb.sh"
2952
echo ""
3053

54+
echo Created RedisConnect-Target-db with
55+
echo $search_module_name
56+
echo $search_semantic_version
57+
echo $json_module_name
58+
echo $json_semantic_version
59+
echo Created RedisConnect-JobConfig-Metrics-db with
60+
echo $timeseries_module_name
61+
echo $timeseries_semantic_version
62+
3163
echo "Creating idx:emp index for search.."
3264
sleep 10
3365
sudo docker exec -it re-node1 bash -c "/opt/redislabs/bin/redis-cli -p 12000 ft.create idx:emp on hash prefix 1 'emp:' schema EmpNum numeric sortable FName text sortable LName text Job tag sortable Manager numeric HireDate text Salary numeric Commission numeric Department numeric"
@@ -47,3 +79,10 @@ sudo docker run -d -p 3000:3000 --name=grafana -e "GF_INSTALL_PLUGINS=redis-data
4779
echo "You can open a browser and access RedisInsight client UI at http://127.0.0.1:18001 (replace localhost with your ip/host) and add databases to monitor."
4880
echo "Please visit, https://docs.redis.com/latest/ri/using-redisinsight/add-instance/ for steps to add these databases to RedisInsight."
4981
echo "DISCLAIMER: This is best for local development or functional testing. Please see, https://docs.redis.com/latest/rs/getting-started/getting-started-docker"
82+
83+
# Cleanup
84+
rm list_modules.sh
85+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/list_modules.sh"
86+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/module_list.txt"
87+
rm create_demodb.sh
88+
sudo docker exec --user root -it re-node1 bash -c "rm /opt/create_demodb.sh"

0 commit comments

Comments
 (0)