diff --git a/.travis.yml b/.travis.yml index 7bd2a2b..f8e6911 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,22 +2,14 @@ before_install: - gem update --system 2.1.11 - gem --version rvm: - - 1.8.7 - - 1.9.3 - 2.0.0 + - 2.1.0 script: 'bundle exec rake spec' env: - - PUPPET_VERSION="~> 2.7.0" - - PUPPET_VERSION="~> 3.0.0" - - PUPPET_VERSION="~> 3.1.0" - - PUPPET_VERSION="~> 3.2.0" - - PUPPET_VERSION="~> 3.3.0" - PUPPET_VERSION="~> 3.4.0" + - PUPPET_VERSION="~> 4.3.0" matrix: exclude: - # No support for Ruby 1.9 before Puppet 2.7 - - rvm: 1.9.3 - env: PUPPET_VERSION=2.6.0 # No support for Ruby 2.0 before Puppet 3.2 - rvm: 2.0.0 env: PUPPET_VERSION="~> 2.7.0" diff --git a/Gemfile b/Gemfile index 5d48d5c..8175c8a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,14 @@ source 'https://rubygems.org' -gem 'puppet', '>= 2.7.0' -gem 'puppet-lint', '>=0.3.2' -gem 'puppetlabs_spec_helper', '>=0.2.0' -gem 'rake', '>=0.9.2.2' +gem 'puppet', '4.5.3' +gem 'puppet-lint', '2.0.2' +gem 'puppetlabs_spec_helper', '~> 1.1.0' +gem 'rake', '11.1.1' +gem 'rake-hooks', '1.2.3' gem 'librarian-puppet', '>=0.9.10' -gem 'rspec-system-puppet', :require => false -gem 'serverspec', :require => false -gem 'rspec-system-serverspec', :require => false gem 'hiera-puppet-helper', :git => 'https://github.com/mmz-srf/hiera-puppet-helper.git' gem 'puppet-blacksmith', :git => 'https://github.com/maestrodev/puppet-blacksmith.git' -gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' + +gem 'rspec', '~> 3.4.0' # MIT +gem 'rspec-core', '~> 3.4.4' # MIT +gem 'rspec-puppet', '2.6.10' # MIT diff --git a/Gemfile.lock b/Gemfile.lock index 7e4d939..cbcc5a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,9 @@ GIT remote: https://github.com/maestrodev/puppet-blacksmith.git - revision: adeb613d78dc1e9971ad175ecd5d3b66465ba927 + revision: d62d39dac4620cf4542a10cbba7328555726dc7d specs: - puppet-blacksmith (2.0.2) - nokogiri - puppet (>= 2.7.16) - rest-client + puppet-blacksmith (4.1.2) + rest-client (~> 2.0) GIT remote: https://github.com/mmz-srf/hiera-puppet-helper.git @@ -13,101 +11,96 @@ GIT specs: hiera-puppet-helper (2.0.1) -GIT - remote: https://github.com/rodjek/rspec-puppet.git - revision: 03e94422fb9bbdd950d5a0bec6ead5d76e06616b - specs: - rspec-puppet (1.0.1) - rspec - GEM remote: https://rubygems.org/ specs: - builder (3.2.2) - diff-lcs (1.2.5) - excon (0.31.0) - facter (1.7.4) - fog (1.19.0) - builder - excon (~> 0.31.0) - formatador (~> 0.2.0) - mime-types - multi_json (~> 1.0) - net-scp (~> 1.1) - net-ssh (>= 2.1.3) - nokogiri (~> 1.5) - ruby-hmac - formatador (0.2.4) - hiera (1.3.1) - json_pure - highline (1.6.20) - json (1.8.1) - json_pure (1.8.1) - kwalify (0.7.2) - librarian-puppet (0.9.10) - json + CFPropertyList (2.2.8) + diff-lcs (1.3) + domain_name (0.5.20180417) + unf (>= 0.0.5, < 1.0.0) + facter (2.5.1) + CFPropertyList (~> 2.2) + faraday (0.13.1) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.12.2) + faraday (>= 0.7.4, < 1.0) + fast_gettext (1.1.2) + gettext (3.2.9) + locale (>= 2.0.5) + text (>= 1.3.0) + gettext-setup (0.30) + fast_gettext (~> 1.1.0) + gettext (>= 3.0.2) + locale + hiera (3.4.3) + http-cookie (1.0.3) + domain_name (~> 0.5) + json_pure (2.1.0) + librarian-puppet (3.0.0) + librarianp (>= 0.6.3) + puppet_forge (~> 2.1) + rsync + librarianp (0.6.4) thor (~> 0.15) - metaclass (0.0.2) - mime-types (1.25.1) - mocha (1.0.0) + locale (2.1.2) + metaclass (0.0.4) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + minitar (0.6.1) + mocha (1.5.0) metaclass (~> 0.0.1) - multi_json (1.8.4) - net-scp (1.1.2) - net-ssh (>= 2.6.5) - net-ssh (2.7.0) - nokogiri (1.5.11) - puppet (3.4.2) - facter (~> 1.6) - hiera (~> 1.0) - rgen (~> 0.6.5) - puppet-lint (0.3.2) - puppetlabs_spec_helper (0.4.1) - mocha (>= 0.10.5) + multipart-post (2.0.0) + netrc (0.11.0) + puppet (4.5.3) + CFPropertyList (~> 2.2.6) + facter (> 2.0, < 4) + hiera (>= 2.0, < 4) + json_pure + puppet-lint (2.0.2) + puppet-syntax (2.4.1) + rake + puppet_forge (2.2.9) + faraday (>= 0.9.0, < 0.14.0) + faraday_middleware (>= 0.9.0, < 0.13.0) + gettext-setup (~> 0.11) + minitar + semantic_puppet (~> 1.0) + puppetlabs_spec_helper (1.1.1) + mocha + puppet-lint + puppet-syntax + rake + rspec-puppet + rake (11.1.1) + rake-hooks (1.2.3) rake - rspec (>= 2.9.0) - rspec-puppet (>= 0.1.1) - rake (10.1.1) - rbvmomi (1.8.1) - builder - nokogiri (>= 1.4.1) - trollop - rest-client (1.6.7) - mime-types (>= 1.16) - rgen (0.6.6) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.7) - rspec-expectations (2.14.4) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.4) - rspec-system (2.8.0) - fog (~> 1.18) - kwalify (~> 0.7.2) - mime-types (~> 1.16) - net-scp (~> 1.1) - net-ssh (~> 2.7) - nokogiri (~> 1.5.10) - rbvmomi (~> 1.6) - rspec (~> 2.14) - systemu (~> 2.5) - rspec-system-puppet (2.2.1) - rspec-system (~> 2.0) - rspec-system-serverspec (2.0.1) - rspec-system (~> 2.0) - serverspec (~> 0.0) - specinfra (~> 0.0) - ruby-hmac (0.4.0) - serverspec (0.14.4) - highline - net-ssh - rspec (>= 2.13.0) - specinfra (>= 0.1.0) - specinfra (0.4.1) - systemu (2.6.0) - thor (0.18.1) - trollop (2.0) + rest-client (2.0.2) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) + rspec (3.4.0) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-core (3.4.4) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-puppet (2.6.10) + rspec + rspec-support (3.4.1) + rsync (1.0.9) + semantic_puppet (1.0.2) + text (1.3.1) + thor (0.20.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.5) PLATFORMS ruby @@ -115,12 +108,15 @@ PLATFORMS DEPENDENCIES hiera-puppet-helper! librarian-puppet (>= 0.9.10) - puppet (>= 2.7.0) + puppet (= 4.5.3) puppet-blacksmith! - puppet-lint (>= 0.3.2) - puppetlabs_spec_helper (>= 0.2.0) - rake (>= 0.9.2.2) - rspec-puppet! - rspec-system-puppet - rspec-system-serverspec - serverspec + puppet-lint (= 2.0.2) + puppetlabs_spec_helper (~> 1.1.0) + rake (= 11.1.1) + rake-hooks (= 1.2.3) + rspec (~> 3.4.0) + rspec-core (~> 3.4.4) + rspec-puppet (= 2.6.10) + +BUNDLED WITH + 1.12.5 diff --git a/Modulefile b/Modulefile index 2099522..ef41556 100644 --- a/Modulefile +++ b/Modulefile @@ -10,3 +10,4 @@ project_page 'https://github.com/deric/puppet-zookeeper' ## Add dependencies, if any: dependency 'puppetlabs/stdlib', '>= 0.1.6' +dependency 'camptocamp/puppet-systemd' diff --git a/Rakefile b/Rakefile index f8ccea6..d7d579a 100644 --- a/Rakefile +++ b/Rakefile @@ -2,12 +2,13 @@ require 'bundler' Bundler.require(:rake) require 'puppet-lint/tasks/puppet-lint' -require 'rspec-system/rake_task' require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet_blacksmith/rake_tasks' +require 'rake/dsl_definition' +require 'rake/hooks' -PuppetLint.configuration.ignore_paths = ["spec/fixtures/modules/cron/manifests/*.pp"] +PuppetLint.configuration.ignore_paths = ["spec/fixtures/modules/cron/manifests/*.pp", "vendor/**/*"] PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' PuppetLint.configuration.send("disable_80chars") diff --git a/files/zookeeper.service b/files/zookeeper.service new file mode 100644 index 0000000..56b6667 --- /dev/null +++ b/files/zookeeper.service @@ -0,0 +1,17 @@ +[Unit] +Description=Zookeeper distributed coordination server +After=network.target +Wants=network.target + +[Service] +User=zookeeper +Group=zookeeper +SyslogIdentifier=zookeeper +ExecStart=/bin/bash -c 'source /etc/default/zookeeper && exec /usr/share/zookeeper/bin/zkServer.sh start-foreground' +Restart=always +# This is due to zookeeper exiting with 143 when SIGTERM is sent by init. +SuccessExitStatus=143 +LimitNOFILE=120000 + +[Install] +WantedBy=multi-user.target diff --git a/manifests/config.pp b/manifests/config.pp index 5ca6d05..64d61db 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -12,6 +12,12 @@ # server.2=zookeeper2:2888:3888 # server.3=zookeeper3:2888:3888 # +# [* log4j_file *] Set to undef by default, if not full path to log4j +# properties file is required, that will be the target of symlink from +# $cfg_dir/log4j.properties. This file needs to be present and deployed +# beforehand. This is useful when one wants to template and deploy their +# own log4j properties for zookeeper logging. +# # # Actions: None # @@ -22,6 +28,7 @@ class zookeeper::config( $id = '1', $datastore = '/var/lib/zookeeper', + $datalogstore = undef, $client_port = 2181, $snap_count = 10000, $log_dir = '/var/log/zookeeper', @@ -43,9 +50,21 @@ $rollingfile_threshold = 'ERROR', $tracefile_threshold = 'TRACE', $max_allowed_connections = 10, + $quorum_listen_on_all_ips = true, + $tick_time = 2000, + $init_limit = 10, + $sync_limit = 5, + $log4j_file = undef, ) { require zookeeper::install + if $log4j_file { + validate_absolute_path($log4j_file) + if $log4j_file == "${cfg_dir}/log4j.properties" { + fail('log4j_file should not be same as ' + "${cfg_dir}/log4j.properties") + } + } + file { $cfg_dir: ensure => directory, owner => $user, @@ -55,19 +74,26 @@ } file { $log_dir: - ensure => directory, - owner => $user, - group => $group, - recurse => true, - mode => '0644', + ensure => directory, + owner => $user, + group => $group, + mode => '0644', } file { $datastore: - ensure => directory, - owner => $user, - group => $group, - mode => '0644', - recurse => true, + ensure => directory, + owner => $user, + group => $group, + mode => '0644', + } + + if $datalogstore { + file { $datalogstore: + ensure => directory, + owner => $user, + group => $group, + mode => '0644', + } } file { "${cfg_dir}/myid": @@ -77,7 +103,6 @@ group => $group, mode => '0644', require => File[$cfg_dir], - notify => Class['zookeeper::service'], } file { "${cfg_dir}/zoo.cfg": @@ -85,7 +110,7 @@ group => $group, mode => '0644', content => template('zookeeper/conf/zoo.cfg.erb'), - notify => Class['zookeeper::service'], + require => File[$cfg_dir], } file { "${cfg_dir}/environment": @@ -93,15 +118,25 @@ group => $group, mode => '0644', content => template('zookeeper/conf/environment.erb'), - notify => Class['zookeeper::service'], + require => File[$cfg_dir], } - file { "${cfg_dir}/log4j.properties": - owner => $user, - group => $group, - mode => '0644', - content => template('zookeeper/conf/log4j.properties.erb'), - notify => Class['zookeeper::service'], + if $log4j_file { + file { "${cfg_dir}/log4j.properties": + ensure => 'link', + owner => $user, + group => $group, + mode => '0644', + target => $log4j_file, + require => File[$log4j_file], + } + } else { + file { "${cfg_dir}/log4j.properties": + owner => $user, + group => $group, + mode => '0644', + content => template('zookeeper/conf/log4j.properties.erb'), + } } } diff --git a/manifests/init.pp b/manifests/init.pp index c07f1be..75ad2ae 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,6 +6,7 @@ # user # group # log_dir +# restart_zookeeper: enables automatic restarts of zookeeper after config changes # # Requires: # N/A @@ -16,6 +17,7 @@ class zookeeper( $id = '1', $datastore = '/var/lib/zookeeper', + $datalogstore = undef, $client_port = 2181, $log_dir = '/var/log/zookeeper', $cfg_dir = '/etc/zookeeper/conf', @@ -36,44 +38,55 @@ # interval in hours, purging enabled when >= 1 $purge_interval = 0, # log4j properties + $log4j_file = undef, $rollingfile_threshold = 'ERROR', $tracefile_threshold = 'TRACE', $max_allowed_connections = 10, + $quorum_listen_on_all_ips = true, + $tick_time = 2000, + $init_limit = 10, + $sync_limit = 5, + $restart_zookeeper = true, ) { - anchor { 'zookeeper::start': }-> - class { 'zookeeper::install': + validate_bool($quorum_listen_on_all_ips) + + anchor { 'zookeeper::start': } + -> class { 'zookeeper::install': ensure => $ensure, snap_retain_count => $snap_retain_count, datastore => $datastore, user => $user, cleanup_sh => $cleanup_sh, - }-> - class { 'zookeeper::config': - id => $id, - datastore => $datastore, - client_port => $client_port, - log_dir => $log_dir, - cfg_dir => $cfg_dir, - user => $user, - group => $group, - java_bin => $java_bin, - java_opts => $java_opts, - pid_dir => $pid_dir, - zoo_main => $zoo_main, - log4j_prop => $log4j_prop, - servers => $servers, - snap_count => $snap_count, - snap_retain_count => $snap_retain_count, - purge_interval => $purge_interval, - rollingfile_threshold => $rollingfile_threshold, - tracefile_threshold => $tracefile_threshold, - max_allowed_connections => $max_allowed_connections, - }-> - class { 'zookeeper::service': - cfg_dir => $cfg_dir, - } - -> - anchor { 'zookeeper::end': } + } -> class { 'zookeeper::config': + id => $id, + datastore => $datastore, + datalogstore => $datalogstore, + client_port => $client_port, + log_dir => $log_dir, + cfg_dir => $cfg_dir, + user => $user, + group => $group, + java_bin => $java_bin, + java_opts => $java_opts, + pid_dir => $pid_dir, + zoo_main => $zoo_main, + log4j_prop => $log4j_prop, + servers => $servers, + snap_count => $snap_count, + snap_retain_count => $snap_retain_count, + purge_interval => $purge_interval, + rollingfile_threshold => $rollingfile_threshold, + tracefile_threshold => $tracefile_threshold, + max_allowed_connections => $max_allowed_connections, + quorum_listen_on_all_ips => $quorum_listen_on_all_ips, + tick_time => $tick_time, + init_limit => $init_limit, + sync_limit => $sync_limit, + log4j_file => $log4j_file, + }-> class { 'zookeeper::service': + cfg_dir => $cfg_dir, + restart_zookeeper => $restart_zookeeper, + } -> anchor { 'zookeeper::end': } } diff --git a/manifests/install.pp b/manifests/install.pp index 579a944..07f645c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -23,15 +23,23 @@ ensure => $ensure } - package { ['zookeeperd']: #init.d scripts for zookeeper - ensure => $ensure, - require => Package['zookeeper'] + if $::lsbdistcodename == 'xenial' { + systemd::unit_file { 'zookeeper.service': + # enable/active => true is not required here since + # that also enables the automated restarted of zookeeper + # which we manage through service.pp and notify. + source => 'puppet:///modules/zookeeper/zookeeper.service', + require => Package['zookeeper'], + } + } else { + package { ['zookeeperd']: #init.d scripts for zookeeper + ensure => $ensure, + require => Package['zookeeper'], + } } # if !$cleanup_count, then ensure this cron is absent. if ($snap_retain_count > 0 and $ensure != 'absent') { - ensure_packages(['cron']) - cron { 'zookeeper-cleanup': ensure => present, command => "${cleanup_sh} ${datastore} ${snap_retain_count}", diff --git a/manifests/service.pp b/manifests/service.pp index e24fc23..fbe04e1 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -2,8 +2,12 @@ class zookeeper::service( $cfg_dir = '/etc/zookeeper/conf', + $restart_zookeeper = true, ){ require zookeeper::install + require zookeeper::config + validate_bool($restart_zookeeper) + service { 'zookeeper': ensure => 'running', @@ -11,8 +15,14 @@ hasrestart => true, enable => true, require => [ - Package['zookeeperd'], File["${cfg_dir}/zoo.cfg"] ] } -} \ No newline at end of file + + if $restart_zookeeper { + File["${cfg_dir}/myid"] ~> Service['zookeeper'] + File["${cfg_dir}/zoo.cfg"] ~> Service['zookeeper'] + File["${cfg_dir}/environment"] ~> Service['zookeeper'] + File["${cfg_dir}/log4j.properties"] ~> Service['zookeeper'] + } +} diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 424869e..2cb22bf 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -4,7 +4,7 @@ shared_examples 'debian-install' do |os, codename| let(:facts) {{ :operatingsystem => os, - :osfamily => 'Debian', + :osfamily => 'Ubuntu', :lsbdistcodename => codename, }} @@ -26,6 +26,11 @@ 'group' => group, }).with_content(myid) } + it { should contain_file(env_file).with({ + 'owner' => user, + 'group' => group, + }).with_content(/NAME=zookeeper/) } + end context 'on debian-like system' do @@ -34,9 +39,10 @@ let(:cfg_dir) { '/etc/zookeeper/conf' } let(:log_dir) { '/var/lib/zookeeper' } let(:id_file) { '/etc/zookeeper/conf/myid' } + let(:env_file) { '/etc/zookeeper/conf/environment' } let(:myid) { /1/ } - it_behaves_like 'debian-install', 'Debian', 'wheezy' + it_behaves_like 'debian-install', 'Ubuntu', 'trusty' end context 'custom parameters' do @@ -56,8 +62,9 @@ let(:log_dir) { '/var/lib/zookeeper/log' } let(:id_file) { '/var/lib/zookeeper/conf/myid' } let(:myid) { /2/ } + let(:env_file) { '/var/lib/zookeeper/conf/environment' } - it_behaves_like 'debian-install', 'Debian', 'wheezy' + it_behaves_like 'debian-install', 'Ubuntu', 'trusty' end context 'extra parameters' do @@ -77,6 +84,19 @@ } end + context 'log4j file' do + let(:params) { { + :log4j_file => "/nail/etc/zookeeper/log4j.properties", + } } + + it do + should contain_file('/etc/zookeeper/conf/log4j.properties').with( + 'ensure' => 'link', + 'target' => '/nail/etc/zookeeper/log4j.properties', + ) + end + end + context 'max allowed connections' do max_conn = 15 @@ -88,4 +108,26 @@ '/etc/zookeeper/conf/zoo.cfg' ).with_content(/maxClientCnxns=#{max_conn}/) } end + + context 'quorum listen on all ips' do + quorum_listen_on_all_ips = false + + let(:params) {{ + :quorum_listen_on_all_ips => quorum_listen_on_all_ips + }} + + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).with_content(/quorumListenOnAllIPs=#{quorum_listen_on_all_ips}/) } + end + + context 'datalogstore' do + let(:params) {{ + :datalogstore => '/tmp/log' + + }} + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).with_content(/dataLogDir=\/tmp\/log/) } + end end diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 8d938a9..44d1807 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -10,7 +10,6 @@ it { should contain_package('zookeeper') } it { should contain_package('zookeeperd') } - it { should contain_package('cron') } it { should contain_cron('zookeeper-cleanup').with({ @@ -30,11 +29,10 @@ let(:params) { { :snap_retain_count => 1, + :ensure => 'present', } } - it_behaves_like 'debian-install', 'Debian', 'squeeze' - it_behaves_like 'debian-install', 'Debian', 'wheezy' - it_behaves_like 'debian-install', 'Ubuntu', 'precise' + it_behaves_like 'debian-install', 'Ubuntu', 'trusty' end context 'without cron' do @@ -47,7 +45,6 @@ it { should contain_package('zookeeper') } it { should contain_package('zookeeperd') } - it { should_not contain_package('cron') } end @@ -70,7 +67,6 @@ 'ensure' => 'absent', }) } - it { should_not contain_package('cron') } end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index f7787ff..dd6f2f3 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -12,4 +12,47 @@ :ensure => 'running', :enable => true )} + + + context 'restart zookeeper default' do + it { should contain_file( + '/etc/zookeeper/conf/myid' + ).that_notifies('Service[zookeeper]') } + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).that_notifies('Service[zookeeper]') } + it { should contain_file( + '/etc/zookeeper/conf/environment' + ).that_notifies('Service[zookeeper]') } + it { should contain_file( + '/etc/zookeeper/conf/log4j.properties' + ).that_notifies('Service[zookeeper]') } + end + + context 'restart zookeeper false' do + let(:params) {{ + :restart_zookeeper => false + + }} + it { should contain_file( + '/etc/zookeeper/conf/myid') } + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg') } + it { should contain_file( + '/etc/zookeeper/conf/environment') } + it { should contain_file( + '/etc/zookeeper/conf/log4j.properties') } + it { should_not contain_file( + '/etc/zookeeper/conf/myid' + ).that_notifies('Service[zookeeper]') } + it { should_not contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).that_notifies('Service[zookeeper]') } + it { should_not contain_file( + '/etc/zookeeper/conf/environment' + ).that_notifies('Service[zookeeper]') } + it { should_not contain_file( + '/etc/zookeeper/conf/log4j.properties' + ).that_notifies('Service[zookeeper]') } + end end diff --git a/templates/conf/zoo.cfg.erb b/templates/conf/zoo.cfg.erb index e33e4bb..7c95bb9 100644 --- a/templates/conf/zoo.cfg.erb +++ b/templates/conf/zoo.cfg.erb @@ -1,18 +1,20 @@ # http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html # The number of milliseconds of each tick -tickTime=2000 +tickTime=<%= scope.lookupvar('zookeeper::config::tick_time') %> # The number of ticks that the initial # synchronization phase can take -initLimit=10 +initLimit=<%= scope.lookupvar('zookeeper::config::init_limit') %> # The number of ticks that can pass between # sending a request and getting an acknowledgement -syncLimit=5 +syncLimit=<%= scope.lookupvar('zookeeper::config::sync_limit') %> # the directory where the snapshot is stored. dataDir=<%= scope.lookupvar('zookeeper::config::datastore') %> # Place the dataLogDir to a separate physical disc for better performance # dataLogDir=/disk2/zookeeper - +<% if scope.lookupvar('zookeeper::config::datalogstore') %> +dataLogDir=<%= scope.lookupvar('zookeeper::config::datalogstore') %> +<% end%> # the port at which the clients will connect clientPort=<%= scope.lookupvar('zookeeper::config::client_port') %> @@ -64,3 +66,7 @@ autopurge.purgeInterval=<%= scope.lookupvar('zookeeper::config::purge_interval') # Maximum allowed connections maxClientCnxns=<%= scope.lookupvar('zookeeper::config::max_allowed_connections') %> + +# Listen for connections from peers on all available IPs +# Default is false; but, at Yelp, via Puppet the default is set to true +quorumListenOnAllIPs=<%= scope.lookupvar('zookeeper::config::quorum_listen_on_all_ips') %>