Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x
- Puppet >= 6.1.0 < 9.0.0
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'deric-zookeeper', '1.5.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-zookeeper
A puppet receipt for Apache Zookeeper. ZooKeeper is a high-performance coordination service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.
Requirements
- Puppet
- Binary or ZooKeeper source code archive
Basic Usage:
class { 'zookeeper': }
Cluster setup
When running ZooKeeper in the distributed mode each node must have unique ID (1-255
). The easiest way how to setup multiple ZooKeepers, is by using Hiera.
hiera/host/zk1.example.com.yaml
:
zookeeper::id: '1'
hiera/host/zk2.example.com.yaml
:
zookeeper::id: '2'
hiera/host/zk3.example.com.yaml
:
zookeeper::id: '3'
A ZooKeeper quorum should consist of odd number of nodes (usually 3
or 5
).
For defining a quorum it is enough to list all IP addresses of all its members.
class { 'zookeeper':
servers => {
1 => '192.168.1.1',
2 => '192.168.1.2',
3 => '192.168.1.3',
},
}
In case that an array is passed as servers
, first ZooKeeper will be assigned ID = 1
. This would produce following configuration:
server.1=192.168.1.1:2888:3888
server.2=192.168.1.2:2888:3888
server.3=192.168.1.3:2888:3888
where first port is election_port
and second one leader_port
. Both ports could be customized for each ZooKeeper instance.
class { 'zookeeper':
election_port => 2889,
leader_port => 3889,
servers => {
1 => '192.168.1.1',
2 => '192.168.1.2',
3 => '192.168.1.3',
}
}
Observers
Observers were introduced in ZooKeeper 3.3.0. To enable this feature simply state which of ZooKeeper servers are observing:
class { 'zookeeper':
servers => ['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4', '192.168.1.5'],
observers => ['192.168.1.4', '192.168.1.5']
}
Note: Currently observer server needs to be listed between standard servers (this behavior might change in feature).
Set binding interface
By default ZooKeeper should bind to all interfaces. When you specify client_ip
only single interface
will be used. If $::ipaddress
is not your public IP (e.g. you are using Docker) make sure to setup correct IP:
class { 'zookeeper':
client_ip => $::ipaddress_eth0
}
or in Hiera:
zookeeper::client_ip: "%{::ipaddress_eth0}"
This is a workaround for a a Facter issue.
ZooKeeper service
Use service_provider
to override Puppet detection for starting service.
class { 'zookeeper':
service_provider => 'init',
manage_service_file => false,
}
Some reasonable values are:
init
systemd
runit
exhibitor
- zookeeper process and config will be managed by exhibitor (https://github.com/soabase/exhibitor). Exhibitor is not managed by this module.none
- service won't be installed
Parameter manage_service_file
controls whether service definition should be managed by Puppet (default: false
). Currently supported for systemd
and init
.
Systemd Unit 'After' and 'Want' control
By default the module will create the following Unit section in /etc/systemd/system/multi-user.target.wants/zookeeper.service
[Unit]
Description=Apache ZooKeeper
After=network.target
Both After and Want (omitted when using the module defaults) can be controled using this module.
E.g on CentOS 7 those might have to be configured for 'netwrok-online.target' using the following syntax:
class { 'zookeeper':
systemd_unit_after => 'network-online.target',
systemd_unit_want => 'network-online.target',
}
Which will modify the Unit section to look like:
[Unit]
Description=Apache ZooKeeper
Want=network-online.target
After=network-online.target
Parameters
id
- cluster-unique zookeeper's instance id (1-255)datastore
datalogstore
- DefiningdataLogDir
allows ZooKeeper transaction logs to be stored in a different location, might improve I/O performance (e.g. if path is mounted on dedicated disk)log_dir
purge_interval
- automatically will delete ZooKeeper logs (available since ZooKeeper 3.4.0)snap_retain_count
- number of snapshots that will be kept after purging (since ZooKeeper 3.4.0)min_session_timeout
- the minimum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 2 times the tickTime (since ZooKeeper 3.3.0)max_session_timeout
- the maximum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 20 times the tickTime (since ZooKeeper 3.3.0)global_outstanding_limit
- ZooKeeper will throttle clients so that there is no more thanglobal_outstanding_limit
outstanding requests in the system.manage_service
(default:true
) whether Puppet should ensure running servicemanage_service_file
when enabled on RHEL 7.0 a systemd config will be managedensure_account
controls whetherzookeeper
user and group will be ensured (set tofalse
to disable this feature)install_method
controls whether ZooKeeper is installed from binary (package
) or source (archive
) packagesarchive_version
allows to specify an arbitrary version of ZooKeeper when using source packagesarchive_install_dir
controls the installation directory when using source packages (defaults to/opt
)archive_symlink
controls the name of a version-independent symlink when using source packagesarchive_dl_url
allows to change the download URL for source packages (defaults to apache.org)systemd_path
where to putsystemd
service files (applies only ifmanage_service_file
andservice_provider == 'systemd'
)restart_on_change
whether ZooKeeper service should be restarted on configuration files change (default:true
)remove_host_principal
whether to remove host from Kerberos principal (default:false
)remove_realm_principal
whether to remove relam from Kerberos principal (default:false
)whitelist_4lw
Fine grained control over the set of commands ZooKeeper can execute (an array e.g.whitelist_4lw = ['*']
)
and many others, see the params.pp
file for more details.
If your distribution has multiple packages for ZooKeeper, you can provide all package names as an array.
class { 'zookeeper':
packages => ['zookeeper', 'zookeeper-java']
}
Logging
ZooKeeper uses log4j, following variables can be configured:
class { 'zookeeper':
console_threshold => 'INFO',
rollingfile_threshold => 'INFO',
tracefile_threshold => 'TRACE',
maxfilesize => '256MB',
maxbackupindex => 20,
}
Threshold supported values are: ALL
, DEBUG
, ERROR
, FATAL
, INFO
, OFF
, TRACE
and WARN
.
By default console, rolling file and trace logging can be configured. Additional log appenders (vulgo log methods) can be configured
by adding a hash extra_appenders
. The following sets up syslog logging and points the root logger towards syslog (note that you must
have syslog listening on port 514/udp for this to work):
class { 'zookeeper':
log4j_prop => 'INFO,SYSLOG',
extra_appenders => {
'Syslog' => {
'class' => 'org.apache.log4j.net.SyslogAppender',
'layout' => 'org.apache.log4j.PatternLayout',
'layout.conversionPattern' => "${hostname} zookeeper[id:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n",
'syslogHost' => 'localhost',
'facility' => 'user',
},
},
}
Hiera Support
All parameters could be defined in hiera files, e.g. common.yaml
, Debian.yaml
or zookeeper.yaml
:
zookeeper::id: 1
zookeeper::client_port: 2181
zookeeper::datastore: '/var/lib/zookeeper'
zookeeper::datalogstore: '/disk2/zookeeper'
Custom RPM repository
Optionally you can specify a custom repository, using a hash configuration.
class { 'zookeeper':
repo => {
name => 'myrepo',
url => 'http://custom.url',
descr => 'description'
sslverify => 1,
gpgcheck => true,
}
}
Source package
Source packages provide the ability to install arbitrary versions of ZooKeeper on any platform. Note that you'll likely have to use the manage_service_file
in order to be able to control the ZooKeeper service (because source packages do not install service files).
class { 'zookeeper':
install_method => 'archive',
archive_version => '3.4.8',
}
Optionally you can specify a proxy_server
:
class { 'zookeeper':
install_method => 'archive',
archive_version => '3.4.8',
proxy_server => 'http://10.0.0.1:8080'
}
Java installation
Default: false
By changing these two parameters you can ensure, that given Java package will be installed before ZooKeeper packages.
class { 'zookeeper':
install_java => true,
java_package => 'openjdk-7-jre-headless'
}
Install
Librarian (recommended)
For puppet-librarian just add to Puppetfile
from Forge:
mod 'deric-zookeeper'
latest (development) version from GitHub
mod 'deric-zookeeper', git: 'git://github.com/deric/puppet-zookeeper.git'
submodules
If you are versioning your puppet conf with git just add it as submodule, from your repository root:
git submodule add git://github.com/deric/puppet-zookeeper.git modules/zookeeper
Dependencies
- stdlib
> 2.3.3
- functionensure_resources
is required - puppet-archive
> 0.4.4
- provides capabilities to use archives instead of binary packages
Acceptance testing
Fastest way is to run tests on prepared Docker images:
BEAKER_set=debian9-6.3 bundle exec rake acceptance
For examining system state set Beaker's ENV variable BEAKER_destroy=no
:
BEAKER_destroy=no BEAKER_set=default bundle exec rake acceptance
and after finishing tests connect to container:
docker exec -it adoring_shirley bash
When host machine is NOT provisioned (puppet installed, etc.):
PUPPET_install=yes BEAKER_set=debian-8 bundle exec rake acceptance
Run on specific OS (see spec/acceptance/nodesets
), to see available sets:
rake beaker:sets
Supported platforms
- Debian/Ubuntu
- RedHat/CentOS/Fedora/Rocky
Tested on:
- Debian (8, 9, 10)
- Ubuntu (16.04, 18.04)
- RHEL (6, 7)
- CentOS (6, 7)
- SLES (12)
Change log
All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
v1.5.0 (2023-08-08)
Features
- Allow audit logs (#190)
- Support Puppet 8
- Support puppetlabs/stdlib 9
- Improve CI tests
Fixes
- Fix ssl ciphersuites is optional, and removed when not set (#188)
- Remove anchors, use
contain
v1.4.0 (2023-01-10)
Features
Fixes
- Fix ciphersuite variable on zoo.cfg.erb (#186)
v1.3.0 (2022-09-13)
Features
Fixes
- Fix truststore type parameter used in zoo.cfg ruby template (#180)
v1.2.1 (2021-10-08)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Get rid of validate_string due to deprecation #173 (weastur)
- Change default archive url #172 (weastur)
v1.2.0 (2021-08-04)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v1.1.0 (2021-03-17)
Added
- Add quorum_listen_on_all_ips option #168 (Wiston999)
- Add var for preAllocSize #166 (deemon87)
- Metrics provider #165 (deemon87)
- Allow changing initialize datastore binary path #163 (olevole)
- add port_unification parameter #159 (jduepmeier)
- Add support for parameter secureClientPort #156 (dhoppe)
- Add support for SLES 12 #155 (dhoppe)
- Support CentOS 8 #152 (bjoernhaeuser)
Fixed
- install_method set to archive should not try and install the repository #164 (achevalet)
- Move daemon-reload to restart_on_change #162 (yakirgb)
- Ignore CLASSPATH if systemd is used #157 (dhoppe)
v1.0.0 (2020-04-14)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Modulesync 2.12.0 #148 (dhoppe)
- Add support for Modulesync #146 (dhoppe)
- Drop support for Puppet 4 #145 (dhoppe)
- Drop support for Puppet 3 #144 (dhoppe)
- Drop support for Debian (6, 7) and Ubuntu (10.04, 12.04, 14.04) #143 (dhoppe)
- Support for new distro releases #141 (Hexta)
- allow configuring additional log appenders #139 (automaticserver)
- Symlink not needed if using Exhibitor #114 (maximedevalland)
v0.8.7 (2019-08-13)
v0.8.6 (2019-08-12)
v0.8.5 (2019-06-21)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Allow puppetlabs/stdlib 6.x, puppet/archive 4.x #131 (dhoppe)
- Update archive filename for version 3.5.5+ install #130 (alexconrey)
- Remove require functions #125 (PierreR)
v0.8.4 (2019-02-05)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.8.2 (2019-01-31)
v0.8.3 (2019-01-31)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.8.1 (2018-10-24)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- allow puppet 5.x, puppetlabs/stdlib 5.x and puppet/archive 3.x #116 (bastelfreak)
- Allow to set sasl users in init.pp #115 (simioa)
v0.8.0 (2018-07-22)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.7.7 (2018-03-07)
Fixed
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Fix Minor Version typo in changelog #110 (christek91)
v0.7.6 (2017-11-29)
v0.7.5 (2017-10-17)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- WIP: replace all resource-style class with plain
include
#106 (Andor) - A pair of log4j properties like vars #105 (alvarolmedo)
v0.7.4 (2017-08-30)
Fixed
- 101: do not overwrite the CLASSPATH #102 (denys-mazhar-rp)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Allow service restarts to be skipped on change #100 (quixoten)
- Provide option to remove host and realm from Kerberos principal #99 (dlanza1)
v0.7.3 (2017-06-02)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- enable possibility of system users for zookeeper #98 (Wayneoween)
- Make service run even if bin/zkEnv.sh does not exist #94 (dlanza1)
v0.7.2 (2017-03-20)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Fix service settings when installing from archive #92 (antyale)
- Service filename should be equal to the service name #91 (antyale)
v0.7.1 (2017-01-23)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- [Issue #87] Refactor zookeeper user & group creation #88 (travees)
- fix a typo in template #86 (eyal-lupu)
- Add exhibitor support #85 (travees)
v0.7.0 (2016-12-05)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- parameterize environment file #82 (cristifalcas)
- fix template for el6 server #79 (cristifalcas)
- Proposal: extensive refactoring #74 (fraenki)
v0.6.1 (2016-08-04)
v0.6.0 (2016-08-03)
Added
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Custom zookeeper ids configurable #69 (rohte)
- Replaces "Redhat" by "RedHat" as it won't match #68 (alejandroandreu)
v0.5.5 (2016-05-27)
v0.5.4 (2016-04-25)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.5.3 (2016-03-30)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Tell systemd that this service needs a running process. #60 (deric)
- Update zookeeper.init.erb #59 (bobra200)
- Have $manage_service_file honored for init #58 (RainofTerra)
v0.5.2 (2016-03-12)
v0.5.1 (2016-02-19)
Added
v0.5.0 (2016-02-17)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Align Java options between files #54 (eyal-lupu)
- don't zookeeper service if already exists #52 (deric)
- Create user and group to run zookeeper under. #49 (Vlaszaty)
- Fix for https://github.com/deric/puppet-zookeeper/issues/47 #48 (eyal-lupu)
- Fix logging level setup and styling to config file #45 (eyal-lupu)
v0.4.2 (2016-01-12)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Added ability to configure custom (local) repository for installation #40 (danielvdende)
v0.4.1 (2015-12-16)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Add missing trailing quote #39 (james-masson)
- Added user and group as parameters for zookeeper conf template. #37 (danielvdende)
- add support for cloudera cdh repo version 5 #35 (EslamElHusseiny)
v0.4.0 (2015-09-16)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Update project non-development dependencies. #32 (MrAlias)
- CentOS7 with mesosphere repo installation fix #31 (cornelf)
- replacing debian with redhat in the redhat.pp manifest #30 (jmktam)
- manage systemd unit files optionally #26 (cristifalcas)
- zoo.cfg: Add maxSessionTimeout in the template #25 (Spredzy)
v0.3.9 (2015-06-04)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Support CentOS 7 #24 (domq)
- Fixed dependency in "initialize_datastore" step #23 (stephanmitchev)
v0.3.8 (2015-05-13)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Adding datalogstore param for dataLogDir to split transaction logs onto different directory #21 (redstonemercury)
v0.3.7 (2015-04-23)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.3.6 (2015-04-08)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Fixed missing ports in server line of zoo.cfg.erb #17 (brutus333)
- added = to allow for variable to be set #15 (fin09pcap)
- Support attribute clientPortAddress in zoo.cfg #14 (pbyrne413)
v0.3.5 (2015-02-09)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- fail is a function, not a type #13 (cristifalcas)
v0.3.4 (2015-01-29)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.3.3 (2015-01-16)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Add Cloudera repo installation #8 (coreone)
- Fix issues with future parser in puppet 3.7+ #7 (tayzlor)
v0.3.2 (2014-12-11)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.3.1 (2014-12-04)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Provide options to override service name and initialize the datastore. #4 (tomstockton)
v0.3.0 (2014-11-29)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
- Fix cron package collision if its declared somewhere outside #3 (claudio-walser)
- Add peerType parameter to support zookeeper observers #2 (kscherer)
v0.2.4 (2014-03-15)
UNCATEGORIZED PRS; LABEL THEM ON GITHUB
v0.2.3 (2014-01-29)
v0.2.2 (2014-01-29)
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppet/archive (>= 0.4.4 < 8.0.0)
- puppet/cron (>= 1.3.1 < 5.0.0)
- puppetlabs/stdlib (>= 2.3.3 < 10.0.0)
- puppetlabs/yumrepo_core (>= 1.0.3 < 3.0.0)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.