...
Simple Shell script to coordinate a cluster
In order to push configurations and binaries, start, stop, restart and purge the Ubuntu 12.04 LTS cluster this small script gets used on the FIZ cluster.
In order to make this work without having to input passwords all the time for the sudo and ssh calls on the cluster nodes, I distributed a public ssh key on the cluster nodes for ssh auth and allowed the fcrepo user to execute
sudo
calls torm, cp, service
calls without a password.- The configuration of the FIZ cluster can be accessed here: https://github.com/fasseg/fiz-fcrepo-cluster-config. There is also a setenv.sh file in there which we symlinked to $TOMCAT_HOME/bin/setenv.sh, that sets the environment variables for the repository, jgroups and infinispan configuration.
- So on each node the layout on the file system looks like this:
/data/fcrepo
(the exploded war file, owned by fcrepo)/home/fcrepo/fiz-cluster-config
(the configuration and setenv.sh file, owned by fcrepo)/var/lib/tomcat7/webapps/fedora
(owned by root) symlinks to /data/fcrepo
- Using this setup jar updates can be pushed by the shell script to /data/fcrepo/WEB-INF/lib directly.
- Pushing a new WAR file to the nodes requires unpacking the WAR to /data/fcrepo therefore access to /tmp is required.
- The script is setup for six nodes with know IPs. So the
node[]
array will have to change for different configurations, as should the range defined in the for statements instart_cluster() purge_cluster()
andstop_cluster().
...