Table of Contents
Zookeeper is a coordination and discovery service maintained by the Apache Software Foundation.
This cookbook focuses on deploying Zookeeper via Chef.
This cookbook is primarily a library cookbook. It implements a zookeeper
resource to handle the installation and configuration of Zookeeper. It ships
with a default recipe for backwards compatibility pre-LWRP which will work
fine, but is really just an example.
Testing is handled using Test Kitchen, with the expectation that you have it installed as part of the Chef DK.
zookeeper::default
: Installs and configures zookeeper. This does not start or manage the service.zookeeper::install
: Installs the zookeeper but does not configure it.zookeeper::config_render
: Configures zookeeper but does not install it.zookeeper::service
: Starts and manages the zookeeper service. Requires zookeeper to be installed/configured.
This cookbook ships with one resource, with future plans for two more covering service management and configuration rendering.
The zookeeper
resource is responsible for installing and (eventually)
uninstalling Zookeeper from a node.
Actions: :install
, :uninstall
Parameters:
version
: Version of Zookeeper to install (name attribute)user
: The user who will eventually run Zookeeper (default:'zookeeper'
)user_home
: Path to the home folder for the Zookeeper user (default:/home/zookeeper
)mirror
: The mirror to obtain Zookeeper from (required)checksum
: Checksum for the Zookeeper download fileinstall_dir
: Which directory to install Zookeeper to (default:'/opt/zookeeper'
)
Example:
zookeeper '3.4.8' do
user 'zookeeper'
mirror 'http://www.poolsaboveground.com/apache/zookeeper'
checksum 'f10a0b51f45c4f64c1fe69ef713abf9eb9571bc7385a82da892e83bb6c965e90'
action :install
end
This resource renders a Zookeeper configuration file. Period-delimited parameters can be specified either as a flat hash, or by embeddeding each sub-section within a separate hash. See the example below for an example.
Actions: :render
, :delete
Parameters:
user
: The user to give ownership of the file to (default:zookeeper
)config
: Hash of configuration parameters to add to the filepath
: Path to write the configuration file to.
Example:
config_hash = {
clientPort: 2181,
dataDir: '/mnt/zk',
tickTime: 2000,
autopurge: {
snapRetainCount: 1,
purgeInterval: 1
}
}
zookeeper_config '/opt/zookeeper/zookeeper-3.4.8/conf/zoo.cfg' do
config config_hash
user 'zookeeper'
action :render
end
This resource can create nodes in Zookeeper.
Actions: :create
, :create_if_missing
, :delete
Parameters:
path
: The zookeeper node path (default: The name of the resource)connect_str
: The zookeeper connection string (required)data
: The data to write to the nodeauth_scheme
: The authentication scheme (default: digest)auth_cert
: The authentication password or dataacl_digest
: Hash of acl permissions per 'digest' idacl_ip
: Hash of acl permissions per 'ip'acl_sasl
: Hash of acl permissions per 'sasl' id (SASLAuthentication provider must be enabled)acl_world
: Acl permissions for anyone (default:Zk::PERM_ALL
)
Example:
zookeeper_node '/data/myNode' do
action :create
connect_str "localhost:2181"
data "my data"
auth_scheme "digest"
auth_cert "user1:pwd1"
acl_digest "user1:a9l5yfb9zl8WCXjVmi5/XOC0Ep4=" => Zk::PERM_ALL
acl_ip "127.0.0.1" => Zk::PERM_READ | Zk::PERM_WRITE
acl_sasl "user@CHEF.IO" => Zk::PERM_ADMIN
acl_world Zk::PERM_NONE
end
- Version 1.4.7 on the community site is in fact version 1.4.8.
Simple Finance ops@simple.com Apache License, Version 2.0