blob: 2f398b2f916456f21c6514e5c96be42c27afbc20 [file] [log] [blame]
Avi Zivc175a0d2018-03-15 13:21:44 +02001#!/bin/bash
2
MichaelMorrisa2abf6e2020-03-10 12:37:48 +00003cd /home/sdc
Avi Zivc175a0d2018-03-15 13:21:44 +02004
5CS_PORT=""
6CS_HOST=127.0.0.1
7
8if [ ! -z "${CS_HOST_IP}" ]; then
9 CS_HOST=$CS_HOST_IP
10fi
11
12if [ ! -z "${CS_HOST_PORT}" ]; then
13 CS_PORT=$CS_HOST_PORT
14fi
15
16echo "[Info] Going to initialize sdc onboard cassandra: user=$SDC_USER; host=$CS_HOST; port=$CS_PORT"
Avi Zivc175a0d2018-03-15 13:21:44 +020017
Ofir Sonsinof4dcec32019-06-23 16:20:50 +030018echo "[Info] Initializing onboard keyspaces"
19date;
20cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_keyspaces.cql $CS_HOST $CS_PORT
k.kedron57844f32019-07-09 15:44:54 +020021rc=$?
Ofir Sonsinof4dcec32019-06-23 16:20:50 +030022date;
Avi Zivc175a0d2018-03-15 13:21:44 +020023
k.kedron57844f32019-07-09 15:44:54 +020024if [[ $rc != 0 ]]; then
25 echo "[Error] Failed to initialize onboard keyspaces";
26 exit $rc;
Ofir Sonsinof4dcec32019-06-23 16:20:50 +030027fi
28
29echo "[Info] Initializing onboard schemas"
30date;
31cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_schemas.cql $CS_HOST $CS_PORT
k.kedron57844f32019-07-09 15:44:54 +020032rc=$?
Ofir Sonsinof4dcec32019-06-23 16:20:50 +030033date;
34
k.kedron57844f32019-07-09 15:44:54 +020035if [[ $rc != 0 ]]; then
36 echo "[Error] Failed to initialize onboard schemas";
37 exit $rc;
38fi