Skip to content

Instantly share code, notes, and snippets.

@adejanovski
Created May 4, 2022 06:45
Show Gist options
  • Save adejanovski/00d1885eb591bbb53a2034f501d36de9 to your computer and use it in GitHub Desktop.
Save adejanovski/00d1885eb591bbb53a2034f501d36de9 to your computer and use it in GitHub Desktop.
Shell script to create a ccm cluster fit for Reaper integration tests
#!/usr/bin/env bash
set -x
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "create-reaper-test-cluster.sh: automation script for creating Reaper ccm clusters for integration tests"
echo " "
echo " "
echo "options:"
echo "-h, --help show brief help"
echo "--version=CASSANDRA_VERSION specify the version of Cassandra to install"
exit 0
;;
--version*)
export VERSION=`echo $1 | sed -e 's/^[^=]*=//g'`
shift
;;
*)
break
;;
esac
done
ccm stop
ccm switch test
ccm remove
ccm create test -v $VERSION > /dev/null
# use "2:0" to ensure the first datacenter name is "dc1" instead of "datacenter1", so to be compatible with CircleCI tests
ccm populate --vnodes -n 2:0 > /dev/null
for i in {1..2} ; do
sed -i '' 's/jmxremote.authenticate=true/jmxremote.authenticate=false/' ~/.ccm/test/node$i/conf/cassandra-env.sh
sed -i '' 's/#MAX_HEAP_SIZE="4G"/MAX_HEAP_SIZE="256m"/' ~/.ccm/test/node$i/conf/cassandra-env.sh
sed -i '' 's/#HEAP_NEWSIZE="800M"/HEAP_NEWSIZE="200M"/' ~/.ccm/test/node$i/conf/cassandra-env.sh
sed -i '' 's/_timeout_in_ms:.*/_timeout_in_ms: 60000/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/start_rpc: true/start_rpc: false/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/cross_node_timeout: false/cross_node_timeout: true/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/concurrent_reads: 32/concurrent_reads: 4/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/concurrent_writes: 32/concurrent_writes: 4/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/concurrent_counter_writes: 32/concurrent_counter_writes: 4/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/num_tokens: 256/num_tokens: 4/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/auto_snapshot: true/auto_snapshot: false/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/enable_materialized_views: true/enable_materialized_views: false/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/internode_compression: dc/internode_compression: none/' ~/.ccm/test/node$i/conf/cassandra.yaml
sed -i '' 's/# file_cache_size_in_mb: 512/file_cache_size_in_mb: 1/' ~/.ccm/test/node$i/conf/cassandra.yaml
echo 'phi_convict_threshold: 16' >> ~/.ccm/test/node$i/conf/cassandra.yaml
done
export LOCAL_JMX=no
ccm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment