Guest User

Untitled

a guest
Mar 13th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. # Check that all envirment variables have been set.
  2. echo "CASSANDRA_IP:$CASSANDRA_IP"
  3. echo "CASSANDRA_PORT:$CASSANDRA_PORT"
  4. echo "CASSANDRA_ADMIN_USERNAME:$CASSANDRA_ADMIN_USERNAME"
  5. echo "CASSANDRA_ADMIN_PASSWORD:$CASSANDRA_ADMIN_PASSWORD"
  6.  
  7. # Echo all commands for debug.
  8. set -x
  9.  
  10. # Inject the username and password of new admin into the cql script.
  11. sed -i s/\<CASSANDRA_ADMIN_USERNAME\>/$CASSANDRA_ADMIN_USERNAME/g $1 /scripts/createAdmin.cql
  12. sed -i s/\<CASSANDRA_ADMIN_PASSWORD\>/$CASSANDRA_ADMIN_PASSWORD/g $1 /scripts/createAdmin.cql
  13. cqlsh -u cassandra -p cassandra -f /scripts/createAdmin.cql $CASSANDRA_IP $CASSANDRA_PORT
  14.  
  15. # Set Cassandra Admin password to a random string.
  16. RANDOM_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
  17. sed -i s/\<RANDOM_PASSWORD\>/$RANDOM_PASSWORD/g $1 /scripts/scrambleCassandraAdminPassword.cql
  18. cqlsh -u $CASSANDRA_ADMIN_USERNAME -p $CASSANDRA_ADMIN_PASSWORD -f /scripts/scrambleCassandraAdminPassword.cql $CASSANDRA_IP $CASSANDRA_PORT
Add Comment
Please, Sign In to add comment