BIGTOP-2467 Zookeeper Puppet script does not setup Zookeeper node ids correctly
Zookeeper wants its peer ids to be consistent across nodes, but the current puppet script auto-generates ids for nodes, based on their index in a list. This breaks Zookeeper quorum. We fix the issue by requiring that puppet take a list comprising explicit ids and ip addresses, rather than just a list of ip addresses. Added backwards compatibilty for old way of doing ensemble. Should prevent us from breaking existing puppet scripts. Signed-off-by: Olaf Flebbe <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/87e7d01d Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/87e7d01d Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/87e7d01d Branch: refs/heads/BIGTOP-2253 Commit: 87e7d01da2558347f9ea64983506d9d8d944a4b2 Parents: b3526b9 Author: Pete Vander Giessen <[email protected]> Authored: Wed Jun 8 16:02:15 2016 -0400 Committer: Olaf Flebbe <[email protected]> Committed: Thu Aug 4 20:41:26 2016 +0200 ---------------------------------------------------------------------- bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml | 2 +- .../puppet/modules/hadoop_zookeeper/manifests/init.pp | 2 +- .../puppet/modules/hadoop_zookeeper/templates/zoo.cfg | 8 +++++++- bigtop-deploy/puppet/modules/hadoop_zookeeper/tests/init.pp | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/87e7d01d/bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml b/bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml index 55f5bcd..60c59b1 100644 --- a/bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml +++ b/bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml @@ -148,7 +148,7 @@ qfs::common::chunkserver_client_port: "22000" hadoop_zookeeper::server::myid: "0" hadoop_zookeeper::server::ensemble: - - "%{hiera('bigtop::hadoop_head_node')}:2888:3888" + - ["0", "%{hiera('bigtop::hadoop_head_node')}:2888:3888"] hadoop_zookeeper::server::kerberos_realm: "%{hiera('kerberos::site::realm')}" # those are only here because they were present as extlookup keys previously http://git-wip-us.apache.org/repos/asf/bigtop/blob/87e7d01d/bigtop-deploy/puppet/modules/hadoop_zookeeper/manifests/init.pp ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/hadoop_zookeeper/manifests/init.pp b/bigtop-deploy/puppet/modules/hadoop_zookeeper/manifests/init.pp index 6965090..31a609e 100644 --- a/bigtop-deploy/puppet/modules/hadoop_zookeeper/manifests/init.pp +++ b/bigtop-deploy/puppet/modules/hadoop_zookeeper/manifests/init.pp @@ -61,7 +61,7 @@ class hadoop_zookeeper ( class server($myid, $port = "2181", $datadir = "/var/lib/zookeeper", - $ensemble = ["localhost:2888:3888"], + $ensemble = [$myid, "localhost:2888:3888"], $kerberos_realm = $hadoop_zookeeper::kerberos_realm, ) inherits hadoop_zookeeper { include common http://git-wip-us.apache.org/repos/asf/bigtop/blob/87e7d01d/bigtop-deploy/puppet/modules/hadoop_zookeeper/templates/zoo.cfg ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/hadoop_zookeeper/templates/zoo.cfg b/bigtop-deploy/puppet/modules/hadoop_zookeeper/templates/zoo.cfg index 69d98c4..e255a0a 100644 --- a/bigtop-deploy/puppet/modules/hadoop_zookeeper/templates/zoo.cfg +++ b/bigtop-deploy/puppet/modules/hadoop_zookeeper/templates/zoo.cfg @@ -26,8 +26,14 @@ syncLimit=5 dataDir=<%= @datadir %> # the port at which the clients will connect clientPort=<%= @port %> -<% @ensemble.each_with_index do |server,idx| %> +<% if !@ensemble[0].nil? && @ensemble[0].length == 2 %> + <% @ensemble.each do |idx, ip| %> +server.<%= idx %>=<%= ip %> + <% end %> +<% else %> + <% @ensemble.each_with_index do |server,idx| %> server.<%= idx %>=<%= server %> + <% end %> <% end %> # purge snapshots every day autopurge.purgeInterval=24 http://git-wip-us.apache.org/repos/asf/bigtop/blob/87e7d01d/bigtop-deploy/puppet/modules/hadoop_zookeeper/tests/init.pp ---------------------------------------------------------------------- diff --git a/bigtop-deploy/puppet/modules/hadoop_zookeeper/tests/init.pp b/bigtop-deploy/puppet/modules/hadoop_zookeeper/tests/init.pp index 0340f10..7158714 100644 --- a/bigtop-deploy/puppet/modules/hadoop_zookeeper/tests/init.pp +++ b/bigtop-deploy/puppet/modules/hadoop_zookeeper/tests/init.pp @@ -16,5 +16,5 @@ hadoop_zookeeper::client { "zoo visitor": } hadoop_zookeeper::server { "test-oozie-server": myid => "0", - ensemble => ["foo:2888:3888", "bar:2888:3888", "baz:2888:3888"], + ensemble => [[0, "foo:2888:3888"], [1, "bar:2888:3888"], [2, "baz:2888:3888"]], }
