Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame^] | 3 | cd /home/sdc |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 4 | |
| 5 | CS_PORT="" |
| 6 | CS_HOST=127.0.0.1 |
| 7 | |
| 8 | if [ ! -z "${CS_HOST_IP}" ]; then |
| 9 | CS_HOST=$CS_HOST_IP |
| 10 | fi |
| 11 | |
| 12 | if [ ! -z "${CS_HOST_PORT}" ]; then |
| 13 | CS_PORT=$CS_HOST_PORT |
| 14 | fi |
| 15 | |
| 16 | echo "[Info] Going to initialize sdc onboard cassandra: user=$SDC_USER; host=$CS_HOST; port=$CS_PORT" |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 17 | |
Ofir Sonsino | f4dcec3 | 2019-06-23 16:20:50 +0300 | [diff] [blame] | 18 | echo "[Info] Initializing onboard keyspaces" |
| 19 | date; |
| 20 | cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_keyspaces.cql $CS_HOST $CS_PORT |
k.kedron | 57844f3 | 2019-07-09 15:44:54 +0200 | [diff] [blame] | 21 | rc=$? |
Ofir Sonsino | f4dcec3 | 2019-06-23 16:20:50 +0300 | [diff] [blame] | 22 | date; |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 23 | |
k.kedron | 57844f3 | 2019-07-09 15:44:54 +0200 | [diff] [blame] | 24 | if [[ $rc != 0 ]]; then |
| 25 | echo "[Error] Failed to initialize onboard keyspaces"; |
| 26 | exit $rc; |
Ofir Sonsino | f4dcec3 | 2019-06-23 16:20:50 +0300 | [diff] [blame] | 27 | fi |
| 28 | |
| 29 | echo "[Info] Initializing onboard schemas" |
| 30 | date; |
| 31 | cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_schemas.cql $CS_HOST $CS_PORT |
k.kedron | 57844f3 | 2019-07-09 15:44:54 +0200 | [diff] [blame] | 32 | rc=$? |
Ofir Sonsino | f4dcec3 | 2019-06-23 16:20:50 +0300 | [diff] [blame] | 33 | date; |
| 34 | |
k.kedron | 57844f3 | 2019-07-09 15:44:54 +0200 | [diff] [blame] | 35 | if [[ $rc != 0 ]]; then |
| 36 | echo "[Error] Failed to initialize onboard schemas"; |
| 37 | exit $rc; |
| 38 | fi |