From 46350c084766789ea59e83f1917c57c81d653048 Mon Sep 17 00:00:00 2001 From: "Tschaen, Brendan" Date: Tue, 16 Oct 2018 20:22:35 -0400 Subject: Include Cassandra locking Change-Id: I085acf8336d5f27782ee12768846a5befd3ee60d Issue-ID: MUSIC-148 Signed-off-by: Tschaen, Brendan --- distribution/cassandra/Dockerfile | 7 +++- distribution/cassandra/cassandra.yaml | 5 +-- distribution/cassandra_job/Dockerfile | 9 ----- distribution/cassandra_job/admin.cql | 17 -------- distribution/cassandra_job/admin_pw.cql | 2 - distribution/cassandra_job/runcql.sh | 71 --------------------------------- distribution/cassandra_job/test.cql | 2 - 7 files changed, 8 insertions(+), 105 deletions(-) delete mode 100644 distribution/cassandra_job/Dockerfile delete mode 100644 distribution/cassandra_job/admin.cql delete mode 100644 distribution/cassandra_job/admin_pw.cql delete mode 100644 distribution/cassandra_job/runcql.sh delete mode 100644 distribution/cassandra_job/test.cql (limited to 'distribution') diff --git a/distribution/cassandra/Dockerfile b/distribution/cassandra/Dockerfile index fe13322c..9405fcb3 100644 --- a/distribution/cassandra/Dockerfile +++ b/distribution/cassandra/Dockerfile @@ -1,4 +1,9 @@ #registry.hub.docker.com/ -FROM library/cassandra:3.11 +FROM library/cassandra:3.0 +RUN mkdir -p /docker-entrypoint-initdb.d && mkdir -p /home/cassandra/.cassandra && chown -R cassandra /home/cassandra COPY cassandra.yaml /etc/cassandra/ +COPY music_single.cql /docker-entrypoint-initdb.d/ +COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN chmod 755 /usr/local/bin/docker-entrypoint.sh && chown -R cassandra /docker-entrypoint-initdb.d + ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/distribution/cassandra/cassandra.yaml b/distribution/cassandra/cassandra.yaml index fa7c74a6..d4af64af 100644 --- a/distribution/cassandra/cassandra.yaml +++ b/distribution/cassandra/cassandra.yaml @@ -530,8 +530,7 @@ native_transport_port: 9042 # native_transport_max_concurrent_connections_per_ip: -1 # Whether to start the thrift rpc server. -#start_rpc: false -start_rpc: true +start_rpc: false # The address or interface to bind the Thrift RPC service and native transport # server to. @@ -721,7 +720,7 @@ sstable_preemptive_open_interval_in_mb: 50 # How long the coordinator should wait for read operations to complete read_request_timeout_in_ms: 5000 # How long the coordinator should wait for seq or index scans to complete -range_request_timeout_in_ms: 15000 +range_request_timeout_in_ms: 10000 # How long the coordinator should wait for writes to complete write_request_timeout_in_ms: 2000 # How long the coordinator should wait for counter writes to complete diff --git a/distribution/cassandra_job/Dockerfile b/distribution/cassandra_job/Dockerfile deleted file mode 100644 index 528c3bf4..00000000 --- a/distribution/cassandra_job/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -#registry.hub.docker.com/ -FROM library/cassandra:3.11 -ENV DEF_USER=cassandra -ENV DEF_PASS=cassandra -COPY runcql.sh / -RUN mkdir -p cql/extra && \ - chmod 755 runcql.sh && \ - chown cassandra runcql.sh -CMD ["/runcql.sh"] diff --git a/distribution/cassandra_job/admin.cql b/distribution/cassandra_job/admin.cql deleted file mode 100644 index 904a2bab..00000000 --- a/distribution/cassandra_job/admin.cql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE KEYSPACE IF NOT EXISTS admin - WITH REPLICATION = { - 'class' : 'SimpleStrategy', - 'replication_factor': 1 - } - AND DURABLE_WRITES = true; - -CREATE TABLE IF NOT EXISTS admin.keyspace_master ( - uuid uuid, - keyspace_name text, - application_name text, - is_api boolean, - password text, - username text, - is_aaf boolean, - PRIMARY KEY (uuid) -); diff --git a/distribution/cassandra_job/admin_pw.cql b/distribution/cassandra_job/admin_pw.cql deleted file mode 100644 index bbad8d1d..00000000 --- a/distribution/cassandra_job/admin_pw.cql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE ROLE IF NOT EXISTS WITH PASSWORD = '' AND SUPERUSER = True AND LOGIN = True; -ALTER ROLE cassandra WITH PASSWORD = 'SomeLongRandomStringNoonewillthinkof'; diff --git a/distribution/cassandra_job/runcql.sh b/distribution/cassandra_job/runcql.sh deleted file mode 100644 index 687e93b3..00000000 --- a/distribution/cassandra_job/runcql.sh +++ /dev/null @@ -1,71 +0,0 @@ -#! /bin/bash -if [ $CASS_HOSTNAME ]; then - echo "#############################################" - echo "############## Let run cql's ################" - echo "#############################################" - echo "Current Variales in play" - echo "Default User" - echo "DEF_USER="$DEF_USER - echo "DEF_PASS=***********" - echo "New User" - echo "USERNAME="$USERNAME - echo "PASSWORD=***********" - if cqlsh -u cassandra -p cassandra -e "describe keyspaces;"; - then - >&2 echo "Cassandra user still avalable, will continue as usual"; - else - if cqlsh -u $USERNAME -p $PASSWORD -e "describe keyspaces;"; - then - >&2 echo "Password $USERNAME in play, update Variables" - DEF_USER=$USERNAME - DEF_PASS=$PASSWORD - if cqlsh -u $USERNAME -p $PASSWORD -e "describe keyspaces;" | grep admin1; - then - >&2 echo "Admin table exists, everything looks good" - exit 0; - else - >&2 echo "Admin does not exists but password has changed. Continue as usual with proper username set" - >&2 echo "DEF_USER=" $DEF_USER - fi - else - >&2 echo "Continue and as usual" - fi - fi - echo "admin.cql file:" - cat /cql/admin.cql - >&2 echo "Running cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin.cql ${CASS_HOSTNAME} ${PORT}" - sleep 1; - if cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin.cql ${CASS_HOSTNAME} ${PORT}; - then - >&2 echo "Success - admin.cql - Admin keyspace created"; - else - >&2 echo "Failure - admin.cql"; - exit 0; - fi - echo "admin_pw.cql file:" - cat /cql/admin_pw.cql - >&2 echo "Running cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin_pw.cql ${CASS_HOSTNAME} ${PORT}" - sleep 1; - if cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin_pw.cql ${CASS_HOSTNAME} ${PORT}; - then - >&2 echo "Success - admin_pw.cql - Password Changed"; - else - >&2 echo "Failure - admin_pw.cql"; - exit 0; - fi - - for f in /cql/extra/*; do - case "$f" in - *.cql) - echo "$0: running $f" && cqlsh -u ${USERNAME} -p ${PASSWORD} -f "$f" ${CASS_HOSTNAME} ${PORT}; - ;; - *) - echo "$0: ignoring $f" - ;; - esac - done -else - >&2 echo "Missing CASS_HOSTNAME"; - exit 0; -fi - diff --git a/distribution/cassandra_job/test.cql b/distribution/cassandra_job/test.cql deleted file mode 100644 index 196fea22..00000000 --- a/distribution/cassandra_job/test.cql +++ /dev/null @@ -1,2 +0,0 @@ -DESCRIBE keyspaces; - -- cgit 1.2.3-korg