Run Health Checker
This folder contains:
- run-health-checker: A Bash script for installing, configuring, and running health-checker.
- check-zookeeper: A Bash script for checking health of the ZooKeeper node.
- install.sh: A Bash script that installs the
run-health-checker
script.
Typically, you would run the install.sh
script in a Packer template so that you create an Amazon
Machine Image (AMI) that comes pre-installed with run-health-checker
. Then, by calling run-health-checker
in User Data, your server will configure and start health-checker
on boot.
run-health-checker
This script assumes that the following are already installed:
- Supervisord: see the install-supervisord module.
The run-health-checker
script will use Supervisord to start health-checker.
This script has been tested on the following operating systems:
- Amazon Linux
- Ubuntu
There is a good chance it will work on Debian, CentOS, and RHEL as well, but our automated testing for this module does not cover these other distros at the moment.
check-zookeeper
This script assumes that the following are already installed:
nc
: Used to issuesrvr
command to ZooKeeper.
This script has been tested on the following operating systems:
- Amazon Linux
- Ubuntu
There is a good chance it will work on Debian, CentOS, and RHEL as well, but our automated testing for this module does not cover these other distros at the moment.
Quick start
The easiest way to install the run-health-checker script is with the Gruntwork Installer:
gruntwork-install \
--module-name "run-health-checker" \
--repo "https://github.com/gruntwork-io/terraform-aws-zookeeper" \
--tag "v0.4.11"
This will download and install health-checker itself, as well as the run-health-checker
and check-zookeeper
scripts. Later, when you run the
run-health-checker
script, you'll configure health-checker to run as a service.
We recommend running this module as part of a Packer template to create an Amazon Machine Image (AMI) (see the zookeeper-ami example for a fully-working example).
Install command line arguments
When you run gruntwork-install
to install run-health-checker
, gruntwork-install
downloads the appropriate version
of the run-health-checker module from GitHub and runs the install.sh
script in the folder.
The install.sh
script accepts the following arguments, all optional:
--install-dir
: The directory where therun-health-checker
files should be installed. Default:/opt/health-checker
.--user
: The user who will be set as the owner of--install-dir
. Default:health_checker
.--version
: The version of health-checker to install. May be specified as a Tag Constraint Expression
If you're using gruntwork-install
to run this module, you can pass these arguments using --module-param
arguments.
Example:
gruntwork-install \
--module-name "run-health-checker" \
--repo "https://github.com/gruntwork-io/terraform-aws-zookeeper" \
--tag "v0.4.11" \
--module-param "install-dir=/opt/health-checker"
run-health-checker command line arguments
When you run the run-health-checker
script itself, you must provide the following arguments:
--tcp-port
: The port number on which a TCP connection will be attempted by health-checker. Specify one or more times.
For example, to configure health-checker to run as a service using Supervisord that listens on its default port of 5000 for inbound HTTP requests and which uses all inbound requests to trigger an attempt to open a TCP connection to port 8000 and run a custom health check script with a timeout of 5 seconds, you can use:
run-health-checker \
--tcp-port 8080 \
--script "/opt/health-checker/check-zookeeper --zkport 2181" \
--script-timeout 5
To see the other arguments that run-health-checker
accepts, run run-health-checker
with the --help
flag or view
the source code.