blob: 92bf869cccee81dc969c94eac7a65d4194d1599f [file] [log] [blame]
sebdetdf353be2020-09-21 22:13:05 +02001#!/bin/sh
Avi Zivc175a0d2018-03-15 13:21:44 +02002
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
sebdetdf353be2020-09-21 22:13:05 +020024if [ $rc != 0 ]; then
k.kedron57844f32019-07-09 15:44:54 +020025 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
sebdetdf353be2020-09-21 22:13:05 +020035if [ $rc != 0 ]; then
k.kedron57844f32019-07-09 15:44:54 +020036 echo "[Error] Failed to initialize onboard schemas";
37 exit $rc;
38fi