Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconinstall-open-jdk
file-type-iconzookeeper-ami
file-type-iconzookeeper-cluster
file-type-iconuser-data
file-type-iconuser-data.sh
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvars.tf
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-icon.pre-commit-hooks.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md

Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconinstall-open-jdk
file-type-iconzookeeper-ami
file-type-iconzookeeper-cluster
file-type-iconuser-data
file-type-iconuser-data.sh
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvars.tf
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-icon.pre-commit-hooks.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
Apache ZooKeeper

Apache ZooKeeper

Deploy an Apache ZooKeeper cluster. Supports automatic bootstrap, Exhibitor, zero-downtime rolling deployment, and auto healing.

Code Preview

Preview the Code

mobile file icon

user-data.sh

down
  • #!/bin/bash
  • #
  • # This script is meant to be run in the User Data of each ZooKeeper EC2 Instance while it's booting. The script uses the
  • # run-exhibitor script to configure and start Exhibitor and ZooKeeper. Note that this script assumes it's running in
  • # an AMI built from the Packer template in examples/zookeeper-ami/zookeeper.json.
  • #
  • # Note that many of the variables below are filled in via Terraform interpolation.
  • set -e
  • # Send the log output from this script to user-data.log, syslog, and the console
  • # From: https://alestic.com/2010/12/ec2-user-data-output/ and https://stackoverflow.com/a/41559867/2308858
  • exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
  • # We created one ENI per server, so mount the ENI that has the same eni-0 tag as this server
  • echo "Attaching ENI"
  • /usr/local/bin/attach-eni --eni-with-same-tag "eni-0"
  • # Mount the EBS volume used for ZooKeeper transaction logs. Every write to ZooKeeper goes to the transaction log
  • # and you get much better performance if you store this transaction log on a completely separate disk that does not
  • # have to contend with any other I/O operations. The dataLogDir setting in ZooKeeper should be pointed at this volume.
  • # https://zookeeper.apache.org/doc/r3.4.12/zookeeperAdmin.html#sc_advancedConfiguration
  • echo "Mounting EBS volume as device name ${transaction_logs_volume_device_name} at ${transaction_logs_volume_mount_point}"
  • /usr/local/bin/mount-ebs-volume \
  • --aws-region "${aws_region}" \

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?