Contains several scripts which are used to deploy and run Cassandra on an Emulab cluster.
Two major scripts,exec_remote.sh and copy_remote.sh. You need to fill the variable $USER.
$ ./exec_remote.sh -f script.sh -h hosts_file [-p]
exec_remote executes a script remotely on all of the hosts which are specified in hosts_file. Besides it can be done in parallel with -p option.
For example, do "hello world" on all the hosts.
$ ./exec_remote.sh -f ./scripts/info.sh -h hosts
scripts dir contains several scripts that are used at remote hosts.
info.shjust prints "hello world".init.shinstalls java and create work dir (/public/${node-id}/) at every remote host.deploy.shdecompresses the cassandra tar file, which has been copied to all hosts previously, and injects configuration.start.shstarts Cassandra on remote hosts.create_keyspace.shcreates lots of keyspaces on Cassandra cluster, usually through seed node.stop.shkills Cassandra daemon on remote hosts.
The hosts file has the format like,
22 node-1.CA-6127.ucare.emulab.net
22 node-10.CA-6127.ucare.emulab.net
22 node-11.CA-6127.ucare.emulab.net
22 node-12.CA-6127.ucare.emulab.net
22 node-13.CA-6127.ucare.emulab.net
22 node-14.CA-6127.ucare.emulab.net
where the first column is ssh port (for compatibility when using virtual nodes), and the second is host name.
We still need a script that copies Cassandra tar file to every host.
$ ./copy_remote.sh -s SRC -h hosts_file
The script hard coded the target dir as /public/${node-id}/.
Here's a typical work flow that runs a Cassandra cluster using these scripts.
Beside, we may need other host files like seeds and non_seeds when seed nodes are supposed to start first, and then the non-seed nodes. Like,
all host file,
22 node-1.CA-6127.ucare.emulab.net
22 node-10.CA-6127.ucare.emulab.net
22 node-11.CA-6127.ucare.emulab.net
22 node-12.CA-6127.ucare.emulab.net
22 node-13.CA-6127.ucare.emulab.net
22 node-14.CA-6127.ucare.emulab.net
seed file,
22 node-1.CA-6127.ucare.emulab.net
non-seed file,
22 node-10.CA-6127.ucare.emulab.net
22 node-11.CA-6127.ucare.emulab.net
22 node-12.CA-6127.ucare.emulab.net
22 node-13.CA-6127.ucare.emulab.net
22 node-14.CA-6127.ucare.emulab.net
This could be done by,
$ ./exec_remote.sh -f ./scripts/info.sh -h hosts
Install packages, create directories, and etc. It would be better using -p parallel option.
$ ./exec_remote.sh -f ./scripts/init.sh -h hosts -p
$ ./copt_remote.sh -s cassandra.tgz -h hosts
Decompress tar file and inject configuration.
$ ./exec_remote.sh -f ./scripts/deploy.sh -h hosts -p
$ ./exec_remote.sh -f ./scripts/start.sh -h seeds
$ ./exec_remote.sh -f ./scripts/create_keyspace.sh -h seeds
Start all other nodes simultanously.
$ ./exec_remote.sh -f ./scripts/start.sh -h non_seeds -p