Merge lp:~bigdata-dev/charms/trusty/hdp-zookeeper/trunk into lp:charms/trusty/hdp-zookeeper

Proposed by amir sanjar
Status: Merged
Merged at revision: 20
Proposed branch: lp:~bigdata-dev/charms/trusty/hdp-zookeeper/trunk
Merge into: lp:charms/trusty/hdp-zookeeper
Diff against target: 145 lines (+31/-17)
7 files modified
README.md (+5/-0)
bundles.yaml (+0/-10)
config.yaml (+5/-0)
hooks/bdutils.py (+4/-1)
hooks/hooks.py (+5/-4)
tests/10-deploy (+2/-2)
tests/bundles.yaml (+10/-0)
To merge this branch: bzr merge lp:~bigdata-dev/charms/trusty/hdp-zookeeper/trunk
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
charmers Pending
Review via email: mp+243358@code.launchpad.net

Description of the change

adding single node support - having single node zookeeper is NOT RECOMMENDED for production

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

Greetings Amir,

While this is a nice addition to the zookeeper charm, supporting single node deployment - it doesn't appear there was a test added to validate this configuration, nor was the readme updated to reflect the option of a single node deployment.

If you could get those added I'd be more than happy to re-review this branch for inclusion in the upstream charm.

review: Needs Fixing
21. By amir sanjar

merging code review suggestion

Revision history for this message
Charles Butler (lazypower) wrote :

+1 LGTM

Thanks for the fixes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README.md'
--- README.md 2014-09-09 02:07:17 +0000
+++ README.md 2014-12-08 20:19:18 +0000
@@ -13,6 +13,11 @@
13To learn more about ZooKeeper visit the upstream [docs](http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.1.3/bk_installing_manually_book/content/rpm-zookeeper.html)13To learn more about ZooKeeper visit the upstream [docs](http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.1.3/bk_installing_manually_book/content/rpm-zookeeper.html)
1414
15# Deployment Strategy15# Deployment Strategy
16
17Instruction to create a zookeeper node :
18
19 juju deploy hdp-zookeeper hdp-zookeeper
20
16 21
17Step by step instructions to create a zookeeper quorum :22Step by step instructions to create a zookeeper quorum :
1823
1924
=== removed file 'bundles.yaml'
--- bundles.yaml 2014-08-27 17:02:39 +0000
+++ bundles.yaml 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1hdp-zookeeper-quorum:
2 services:
3 "hdp-zookeeper":
4 charm: "cs:~asanjar/trusty/hdp-zookeeper"
5 num_units: 3
6 annotations:
7 "gui-x": "1201.0940759645143"
8 "gui-y": "462.5"
9 relations: []
10 series: trusty
110
=== modified file 'config.yaml'
--- config.yaml 2014-08-02 02:02:26 +0000
+++ config.yaml 2014-12-08 20:19:18 +0000
@@ -3,3 +3,8 @@
3 type: string3 type: string
4 default: "/grid/hadoop/zookeeper/data"4 default: "/grid/hadoop/zookeeper/data"
5 description: "Directory where ZooKeeper will store data." 5 description: "Directory where ZooKeeper will store data."
6 zk-port:
7 type: int
8 default: 2181
9 description: ZooKeeper Client Access Port
10
611
=== modified file 'hooks/bdutils.py'
--- hooks/bdutils.py 2014-08-02 02:02:26 +0000
+++ hooks/bdutils.py 2014-12-08 20:19:18 +0000
@@ -58,14 +58,17 @@
58 f.writelines(contents)58 f.writelines(contents)
5959
60def fileRemoveKey(filePath, key):60def fileRemoveKey(filePath, key):
61 log ("===> fileRemoveK ({}, {})".format(filePath, key))61 log ("===> fileRemoveKey ({}, {})".format(filePath, key))
62 found = False62 found = False
63 print key
63 with open(filePath) as f:64 with open(filePath) as f:
64 contents = f.readlines()65 contents = f.readlines()
66 print contents
65 for l in range(0, len(contents)):67 for l in range(0, len(contents)):
66 if contents[l].startswith(key):68 if contents[l].startswith(key):
67 contents.pop(l)69 contents.pop(l)
68 found = True70 found = True
71 break
69 if found:72 if found:
70 with open(filePath, 'wb') as f:73 with open(filePath, 'wb') as f:
71 f.writelines(contents)74 f.writelines(contents)
7275
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2014-10-23 00:40:20 +0000
+++ hooks/hooks.py 2014-12-08 20:19:18 +0000
@@ -9,7 +9,7 @@
9from hdputils import install_base_pkg, updateHDPDirectoryScript, config_all_nodes, setHadoopEnvVar, home, hdpScript 9from hdputils import install_base_pkg, updateHDPDirectoryScript, config_all_nodes, setHadoopEnvVar, home, hdpScript
10from bdutils import setDirPermission, fileSetKV, fileRemoveKey10from bdutils import setDirPermission, fileSetKV, fileRemoveKey
11from charmhelpers.lib.utils import config_get11from charmhelpers.lib.utils import config_get
12from charmhelpers.core.hookenv import log, Hooks, relation_get, open_port, related_units, local_unit, unit_get12from charmhelpers.core.hookenv import log, Hooks, relation_get, open_port, related_units, local_unit, unit_get, relation_set
13from charmhelpers.core.host import add_user_to_group13from charmhelpers.core.host import add_user_to_group
1414
15sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))15sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))
@@ -79,6 +79,8 @@
79 df.writelines(getid(local_unit()))79 df.writelines(getid(local_unit()))
80 zkhost = unit_get('private-address')80 zkhost = unit_get('private-address')
81 fileSetKV(zoocfg, "dataDir=", data_path)81 fileSetKV(zoocfg, "dataDir=", data_path)
82 # cleaning up zookeeper config
83 fileRemoveKey(zoocfg, "server.1=")
82 fileSetKV(zoocfg, "server"+"."+getid(local_unit())+"=", zkhost+":2888:3888")84 fileSetKV(zoocfg, "server"+"."+getid(local_unit())+"=", zkhost+":2888:3888")
83 setZKConf()85 setZKConf()
84 86
@@ -98,12 +100,10 @@
98 packages =['ntp', 'openjdk-7-jdk',"zookeeper"]100 packages =['ntp', 'openjdk-7-jdk',"zookeeper"]
99 install_base_pkg(packages)101 install_base_pkg(packages)
100 config_zk_nodes()102 config_zk_nodes()
101 fileSetKV(zoocfg, "server"+"."+getid(local_unit())+"=", unit_get('private-address')+":2888:3888")103 open_port(config_get('zk-port'))
102 open_port(2181)
103 open_port(2888)104 open_port(2888)
104 open_port(3888)105 open_port(3888)
105 106
106 log('Installing hdp-zookeeper')
107107
108108
109@hooks.hook('config-changed')109@hooks.hook('config-changed')
@@ -152,6 +152,7 @@
152@hooks.hook('zookeeper-relation-joined')152@hooks.hook('zookeeper-relation-joined')
153def zookeeper_relation_joined():153def zookeeper_relation_joined():
154 log('==> zookeeper_relation_joined')154 log('==> zookeeper_relation_joined')
155 relation_set(port=config_get('zk-port'))
155 156
156if __name__ == "__main__":157if __name__ == "__main__":
157 # execute a hook based on the name the program is called by158 # execute a hook based on the name the program is called by
158159
=== modified file 'tests/10-deploy'
--- tests/10-deploy 2014-08-27 23:52:36 +0000
+++ tests/10-deploy 2014-12-08 20:19:18 +0000
@@ -8,7 +8,7 @@
8class TestDeployment(object):8class TestDeployment(object):
9 def __init__(self):9 def __init__(self):
10 self.d = amulet.Deployment(series='trusty')10 self.d = amulet.Deployment(series='trusty')
11 f = open('bundles.yaml')11 f = open(os.path.join(os.path.dirname(__file__), 'bundles.yaml'))
12 bun = f.read()12 bun = f.read()
13 self.d.load(yaml.safe_load(bun))13 self.d.load(yaml.safe_load(bun))
14 #self.d.add('hdp-zookeeper', charm='~/development/charms/trusty/hdp-zookeeper', units=3)14 #self.d.add('hdp-zookeeper', charm='~/development/charms/trusty/hdp-zookeeper', units=3)
@@ -50,4 +50,4 @@
50 50
51if __name__ == '__main__':51if __name__ == '__main__':
52 runner = TestDeployment()52 runner = TestDeployment()
53 runner.run()
54\ No newline at end of file53\ No newline at end of file
54 runner.run()
5555
=== added file 'tests/bundles.yaml'
--- tests/bundles.yaml 1970-01-01 00:00:00 +0000
+++ tests/bundles.yaml 2014-12-08 20:19:18 +0000
@@ -0,0 +1,10 @@
1hdp-zookeeper-quorum:
2 services:
3 "hdp-zookeeper":
4 charm: "cs:~asanjar/trusty/hdp-zookeeper"
5 num_units: 3
6 annotations:
7 "gui-x": "1201.0940759645143"
8 "gui-y": "462.5"
9 relations: []
10 series: trusty

Subscribers

People subscribed via source and target branches