{"id":6980,"date":"2014-09-17T09:08:20","date_gmt":"2014-09-17T07:08:20","guid":{"rendered":"http:\/\/code.openark.org\/blog\/?p=6980"},"modified":"2014-09-17T09:08:20","modified_gmt":"2014-09-17T07:08:20","slug":"zookeepercli-lightweight-powerful-controlled-command-line-client-for-zookeeper","status":"publish","type":"post","link":"https:\/\/code.openark.org\/blog\/linux\/zookeepercli-lightweight-powerful-controlled-command-line-client-for-zookeeper","title":{"rendered":"zookeepercli: lightweight, powerful, controlled command line client for ZooKeeper"},"content":{"rendered":"<p>I&#8217;m happy to announce the availability of <a href=\"https:\/\/github.com\/outbrain\/zookeepercli\"><strong>zookeepercli<\/strong><\/a>: a lightweight, simple, fast and controlled command line client for ZooKeeper.<\/p>\n<p><strong>zookeepercli<\/strong> allows for:<\/p>\n<ul class=\"task-list\">\n<li>Basic CRUD-like operations: <strong><code>create<\/code><\/strong>,\u00a0 <strong><code>set<\/code><\/strong>,\u00a0 <strong><code>delete<\/code><\/strong>,\u00a0 <strong><code>exists<\/code><\/strong>,\u00a0 <strong><code>get<\/code><\/strong>,\u00a0 <strong><code>ls<\/code><\/strong> (aka <strong><code>children<\/code><\/strong>).<\/li>\n<li>Extended operations: <strong><code>lsr<\/code><\/strong> (ls recursive),\u00a0 <strong><code>creater<\/code><\/strong> (create recursively)<\/li>\n<li>Well formatted and controlled output: supporting either <strong><code>txt<\/code><\/strong> or <strong><code>json<\/code><\/strong> format<\/li>\n<li>Single, no-dependencies binary file, based on a native Go ZooKeeper library by <a href=\"http:\/\/github.com\/samuel\/go-zookeeper\">github.com\/samuel\/go-zookeeper<\/a> (<a href=\"https:\/\/github.com\/outbrain\/zookeepercli\/blob\/master\/go-zookeeper-LICENSE\">LICENSE<\/a>)<\/li>\n<\/ul>\n<p>I was dissatisfied with existing command line access to ZooKeeper. Uncontrolled and noisy output as well as large footprint were among the reasons. <strong>zookeepercli<\/strong> overcomes the above and provides with often required powers.<\/p>\n<p>Usage samples:<\/p>\n<blockquote>\n<pre><code>\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c create \/demo_only \"path placeholder\"\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c create \/demo_only\/key1 \"value1\"\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c create \/demo_only\/key2 \"value2\"\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c create \/demo_only\/key3 \"value3\"\r\n\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c ls \/demo_only\r\n<span style=\"color: #808000;\">key3\r\nkey2\r\nkey1\r\n<\/span>\r\n<span style=\"color: #ff6600;\"># Same as above, JSON format output:<\/span>\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 --format=json -c ls \/demo_only\r\n<span style=\"color: #808000;\">[\"key3\",\"key2\",\"key1\"]<\/span>\r\n\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c delete \/demo_only\/key1\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c delete \/demo_only\/key2\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c delete \/demo_only\/key3\r\n$ zookeepercli --servers srv-1,srv-2,srv-3 -c delete \/demo_only\r\n\r\n<span style=\"color: #ff6600;\"># Create a path recursively (auto-generate parent directories if not exist):<\/span>\r\n$ zookeepercli --servers=srv-1,srv-2,srv-3 -c creater \"\/demo_only\/child\/key1\" \"val1\"\r\n$ zookeepercli --servers=srv-1,srv-2,srv-3 -c creater \"\/demo_only\/child\/key2\" \"val2\"\r\n\r\n$ zookeepercli --servers=srv-1,srv-2,srv-3 -c get \"\/demo_only\/child\/key1\"\r\n<span style=\"color: #808000;\">val1<\/span>\r\n\r\n<span style=\"color: #ff6600;\"># This path was auto generated due to recursive create:<\/span>\r\n$ zookeepercli --servers=srv-1,srv-2,srv-3 -c get \"\/demo_only\" \r\n<span style=\"color: #808000;\">zookeepercli auto-generated<\/span>\r\n\r\n<span style=\"color: #ff6600;\"># ls recursively a path and all sub children:<\/span>\r\n$ zookeepercli --servers=srv-1,srv-2,srv-3 -c lsr \"\/demo_only\" \r\n<span style=\"color: #808000;\">child\r\nchild\/key1\r\nchild\/key2\u00a0<\/span><\/code><\/pre>\n<\/blockquote>\n<p><strong>zookeepercli<\/strong> is released as open source by <a href=\"https:\/\/github.com\/outbrain\">Outbrain<\/a> under the <a href=\"https:\/\/github.com\/outbrain\/zookeepercli\/blob\/master\/LICENSE\">Apache 2.0 license<\/a>.<\/p>\n<p>Quick links:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/outbrain\/zookeepercli\">Project page<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/outbrain\/zookeepercli\/releases\">Pre-built binaries<\/a> for download<\/li>\n<li><a href=\"https:\/\/github.com\/outbrain\/zookeepercli\/blob\/master\/LICENSE\">License<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m happy to announce the availability of zookeepercli: a lightweight, simple, fast and controlled command line client for ZooKeeper. zookeepercli allows for: Basic CRUD-like operations: create,\u00a0 set,\u00a0 delete,\u00a0 exists,\u00a0 get,\u00a0 ls (aka children). Extended operations: lsr (ls recursive),\u00a0 creater (create recursively) Well formatted and controlled output: supporting either txt or json format Single, no-dependencies binary [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[53,32],"tags":[78,111,57,110],"class_list":["post-6980","post","type-post","status-publish","format-standard","hentry","category-development","category-linux","tag-command-line","tag-go","tag-open-source","tag-zookeeper"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bZZp-1OA","_links":{"self":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/6980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/comments?post=6980"}],"version-history":[{"count":17,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/6980\/revisions"}],"predecessor-version":[{"id":7000,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/6980\/revisions\/7000"}],"wp:attachment":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/media?parent=6980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/categories?post=6980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/tags?post=6980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}