zk_shell


Namezk_shell JSON
Version 1.1.4 PyPI version JSON
download
home_pagehttps://github.com/rgs1/zk_shell
SummaryA Python - Kazoo based - shell for ZooKeeper
upload_time2018-04-04 16:42:25
maintainer
docs_urlNone
authorRaul Gutierrez Segales
requires_python
licenseApache
keywords zookeeper kazoo shell
VCS
bugtrack_url
requirements ansicolors kazoo nose tabulate twitter.common.net xcmd
Travis-CI
coveralls test coverage
            zk-shell
========

.. image:: https://travis-ci.org/rgs1/zk_shell.svg?branch=master
    :target: https://travis-ci.org/rgs1/zk_shell
    :alt: Build Status

.. image:: https://coveralls.io/repos/rgs1/zk_shell/badge.png?branch=master
    :target: https://coveralls.io/r/rgs1/zk_shell?branch=master
    :alt: Coverage Status

.. image:: https://badge.fury.io/py/zk_shell.svg
    :target: http://badge.fury.io/py/zk_shell
    :alt: PyPI version

.. image:: https://requires.io/github/rgs1/zk_shell/requirements.svg?branch=master
    :target: https://requires.io/github/rgs1/zk_shell/requirements/?branch=master
    :alt: Requirements Status

.. image:: https://img.shields.io/pypi/pyversions/zk_shell.svg
    :target: https://pypi.python.org/pypi/zk_shell
    :alt: Python Versions

.. image:: https://codeclimate.com/github/rgs1/zk_shell.png
    :target: https://codeclimate.com/github/rgs1/zk_shell
    :alt: Code Climate

**Table of Contents**

-  `tl;dr <#tldr>`__
-  `Installing <#installing>`__
-  `Usage <#usage>`__
-  `Dependencies <#dependencies>`__

tl;dr
~~~~~

A powerful & scriptable shell for `Apache
ZooKeeper <http://zookeeper.apache.org/>`__

Installing
~~~~~~~~~~

From PyPI:

::

    $ pip install zk-shell

Or running from the source:

::

    # Kazoo is needed
    $ pip install kazoo

    $ git clone https://github.com/rgs1/zk_shell.git
    $ cd zk_shell
    $ export ZKSHELL_SRC=1; bin/zk-shell
    Welcome to zk-shell (0.99.04)
    (DISCONNECTED) />

You can also build a self-contained PEX file:

::

    $ pip install pex

    $ pex -v -e zk_shell.cli -o zk-shell.pex .

More info about PEX `here <https://pex.readthedocs.org>`__.

Usage
~~~~~

::

    $ zk-shell localhost:2181
    (CONNECTED) /> ls
    zookeeper
    (CONNECTED) /> create foo 'bar'
    (CONNECTED) /> get foo
    bar
    (CONNECTED) /> cd foo
    (CONNECTED) /foo> create ish 'barish'
    (CONNECTED) /foo> cd ..
    (CONNECTED) /> ls foo
    ish
    (CONNECTED) /> create temp- 'temp' true true
    (CONNECTED) /> ls
    zookeeper foo temp-0000000001
    (CONNECTED) /> rmr foo
    (CONNECTED) />
    (CONNECTED) /> tree
    .
    ├── zookeeper
    │   ├── config
    │   ├── quota

Line editing and command history is supported via readline (if readline
is available). There's also autocomplete for most commands and their
parameters.

Individual files can be copied between the local filesystem and
ZooKeeper. Recursively copying from the filesystem to ZooKeeper is
supported as well, but not the other way around since znodes can have
content and children.

::

    (CONNECTED) /> cp file:///etc/passwd zk://localhost:2181/passwd
    (CONNECTED) /> get passwd
    (...)
    unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin
    haldaemon:x:68:68:HAL daemon:/:/sbin/nologin

Copying between one ZooKeeper cluster to another is supported, too:

::

    (CONNECTED) /> cp zk://localhost:2181/passwd zk://othercluster:2183/mypasswd

Copying between a ZooKeeper cluster and JSON files is supported as well:

::

    (CONNECTED) /> cp zk://localhost:2181/something json://!tmp!backup.json/ true true

Mirroring paths to between clusters or JSON files is also supported.
Mirroring replaces the destination path with the content and structure
of the source path.

::

    (CONNECTED) /> create /source/znode1/znode11 'Hello' false false true
    (CONNECTED) /> create /source/znode2 'Hello' false false true
    (CONNECTED) /> create /target/znode1/znode12 'Hello' false false true
    (CONNECTED) /> create /target/znode3 'Hello' false false true
    (CONNECTED) /> tree
    .
    ├── target
    │   ├── znode3
    │   ├── znode1
    │   │   ├── znode12
    ├── source
    │   ├── znode2
    │   ├── znode1
    │   │   ├── znode11
    ├── zookeeper
    │   ├── config
    │   ├── quota
    (CONNECTED) /> mirror /source /target
    Are you sure you want to replace /target with /source? [y/n]:
    y
    Mirroring took 0.04 secs
    (CONNECTED) /> tree
    .
    ├── target
    │   ├── znode2
    │   ├── znode1
    │   │   ├── znode11
    ├── source
    │   ├── znode2
    │   ├── znode1
    │   │   ├── znode11
    ├── zookeeper
    │   ├── config
    │   ├── quota
    (CONNECTED) /> create /target/znode4 'Hello' false false true
    (CONNECTED) /> mirror /source /target false false true
    Mirroring took 0.03 secs
    (CONNECTED) />

Debugging watches can be done with the watch command. It allows
monitoring all the child watches that, recursively, fire under :

::

    (CONNECTED) /> watch start /
    (CONNECTED) /> create /foo 'test'
    (CONNECTED) /> create /bar/foo 'test'
    (CONNECTED) /> rm /bar/foo
    (CONNECTED) /> watch stats /

    Watches Stats

    /foo: 1
    /bar: 2
    /: 1
    (CONNECTED) /> watch stop /

Searching for paths or znodes which match a given text can be done via
find:

::

    (CONNECTED) /> find / foo
    /foo2
    /fooish/wayland
    /fooish/xorg
    /copy/foo

Or a case-insensitive match using ifind:

::

    (CONNECTED) /> ifind / foo
    /foo2
    /FOOish/wayland
    /fooish/xorg
    /copy/Foo

Grepping for content in znodes can be done via grep:

::

    (CONNECTED) /> grep / unbound true
    /passwd: unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin
    /copy/passwd: unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin

Or via igrep for a case-insensitive version.

Non-interactive mode can be used passing commands via ``--run-once``:

::

    $ zk-shell --run-once "create /foo 'bar'" localhost
    $ zk-shell --run-once "get /foo" localhost
    bar

Or piping commands through stdin:

::

    $ echo "get /foo" | zk-shell --run-from-stdin localhost
    bar

It's also possible to connect using an SSH tunnel, by specifying a host
to use:

::

    $ zk-shell --tunnel ssh-host zk-host

Dependencies
~~~~~~~~~~~~

-  Python 2.7, 3.3, 3.4, 3.5 or 3.6
-  Kazoo >= 2.2

Testing and Development
~~~~~~~~~~~~~~~~~~~~~~~

Please see `CONTRIBUTING.rst <CONTRIBUTING.rst>`__.

            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "ZooKeeper Kazoo shell", 
    "upload_time": "2018-04-04 16:42:25", 
    "requirements": [
        {
            "name": "ansicolors", 
            "specs": [
                [
                    "==", 
                    "1.0.2"
                ]
            ]
        }, 
        {
            "name": "kazoo", 
            "specs": [
                [
                    "==", 
                    "2.2.1"
                ]
            ]
        }, 
        {
            "name": "nose", 
            "specs": [
                [
                    "==", 
                    "1.3.7"
                ]
            ]
        }, 
        {
            "name": "tabulate", 
            "specs": [
                [
                    "==", 
                    "0.7.7"
                ]
            ]
        }, 
        {
            "name": "twitter.common.net", 
            "specs": [
                [
                    "==", 
                    "0.3.9"
                ]
            ]
        }, 
        {
            "name": "xcmd", 
            "specs": [
                [
                    "==", 
                    "0.0.3"
                ]
            ]
        }
    ], 
    "author": "Raul Gutierrez Segales", 
    "home_page": "https://github.com/rgs1/zk_shell", 
    "github_user": "rgs1", 
    "download_url": "https://pypi.python.org/packages/c5/21/667cf64f5620e4ab78f6e0960632eb850de7f72ed05f861a25807a08189e/zk_shell-1.1.4.tar.gz", 
    "platform": "", 
    "version": "1.1.4", 
    "cheesecake_documentation_id": null, 
    "description": "zk-shell\n========\n\n.. image:: https://travis-ci.org/rgs1/zk_shell.svg?branch=master\n    :target: https://travis-ci.org/rgs1/zk_shell\n    :alt: Build Status\n\n.. image:: https://coveralls.io/repos/rgs1/zk_shell/badge.png?branch=master\n    :target: https://coveralls.io/r/rgs1/zk_shell?branch=master\n    :alt: Coverage Status\n\n.. image:: https://badge.fury.io/py/zk_shell.svg\n    :target: http://badge.fury.io/py/zk_shell\n    :alt: PyPI version\n\n.. image:: https://requires.io/github/rgs1/zk_shell/requirements.svg?branch=master\n    :target: https://requires.io/github/rgs1/zk_shell/requirements/?branch=master\n    :alt: Requirements Status\n\n.. image:: https://img.shields.io/pypi/pyversions/zk_shell.svg\n    :target: https://pypi.python.org/pypi/zk_shell\n    :alt: Python Versions\n\n.. image:: https://codeclimate.com/github/rgs1/zk_shell.png\n    :target: https://codeclimate.com/github/rgs1/zk_shell\n    :alt: Code Climate\n\n**Table of Contents**\n\n-  `tl;dr <#tldr>`__\n-  `Installing <#installing>`__\n-  `Usage <#usage>`__\n-  `Dependencies <#dependencies>`__\n\ntl;dr\n~~~~~\n\nA powerful & scriptable shell for `Apache\nZooKeeper <http://zookeeper.apache.org/>`__\n\nInstalling\n~~~~~~~~~~\n\nFrom PyPI:\n\n::\n\n    $ pip install zk-shell\n\nOr running from the source:\n\n::\n\n    # Kazoo is needed\n    $ pip install kazoo\n\n    $ git clone https://github.com/rgs1/zk_shell.git\n    $ cd zk_shell\n    $ export ZKSHELL_SRC=1; bin/zk-shell\n    Welcome to zk-shell (0.99.04)\n    (DISCONNECTED) />\n\nYou can also build a self-contained PEX file:\n\n::\n\n    $ pip install pex\n\n    $ pex -v -e zk_shell.cli -o zk-shell.pex .\n\nMore info about PEX `here <https://pex.readthedocs.org>`__.\n\nUsage\n~~~~~\n\n::\n\n    $ zk-shell localhost:2181\n    (CONNECTED) /> ls\n    zookeeper\n    (CONNECTED) /> create foo 'bar'\n    (CONNECTED) /> get foo\n    bar\n    (CONNECTED) /> cd foo\n    (CONNECTED) /foo> create ish 'barish'\n    (CONNECTED) /foo> cd ..\n    (CONNECTED) /> ls foo\n    ish\n    (CONNECTED) /> create temp- 'temp' true true\n    (CONNECTED) /> ls\n    zookeeper foo temp-0000000001\n    (CONNECTED) /> rmr foo\n    (CONNECTED) />\n    (CONNECTED) /> tree\n    .\n    \u251c\u2500\u2500 zookeeper\n    \u2502   \u251c\u2500\u2500 config\n    \u2502   \u251c\u2500\u2500 quota\n\nLine editing and command history is supported via readline (if readline\nis available). There's also autocomplete for most commands and their\nparameters.\n\nIndividual files can be copied between the local filesystem and\nZooKeeper. Recursively copying from the filesystem to ZooKeeper is\nsupported as well, but not the other way around since znodes can have\ncontent and children.\n\n::\n\n    (CONNECTED) /> cp file:///etc/passwd zk://localhost:2181/passwd\n    (CONNECTED) /> get passwd\n    (...)\n    unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin\n    haldaemon:x:68:68:HAL daemon:/:/sbin/nologin\n\nCopying between one ZooKeeper cluster to another is supported, too:\n\n::\n\n    (CONNECTED) /> cp zk://localhost:2181/passwd zk://othercluster:2183/mypasswd\n\nCopying between a ZooKeeper cluster and JSON files is supported as well:\n\n::\n\n    (CONNECTED) /> cp zk://localhost:2181/something json://!tmp!backup.json/ true true\n\nMirroring paths to between clusters or JSON files is also supported.\nMirroring replaces the destination path with the content and structure\nof the source path.\n\n::\n\n    (CONNECTED) /> create /source/znode1/znode11 'Hello' false false true\n    (CONNECTED) /> create /source/znode2 'Hello' false false true\n    (CONNECTED) /> create /target/znode1/znode12 'Hello' false false true\n    (CONNECTED) /> create /target/znode3 'Hello' false false true\n    (CONNECTED) /> tree\n    .\n    \u251c\u2500\u2500 target\n    \u2502   \u251c\u2500\u2500 znode3\n    \u2502   \u251c\u2500\u2500 znode1\n    \u2502   \u2502   \u251c\u2500\u2500 znode12\n    \u251c\u2500\u2500 source\n    \u2502   \u251c\u2500\u2500 znode2\n    \u2502   \u251c\u2500\u2500 znode1\n    \u2502   \u2502   \u251c\u2500\u2500 znode11\n    \u251c\u2500\u2500 zookeeper\n    \u2502   \u251c\u2500\u2500 config\n    \u2502   \u251c\u2500\u2500 quota\n    (CONNECTED) /> mirror /source /target\n    Are you sure you want to replace /target with /source? [y/n]:\n    y\n    Mirroring took 0.04 secs\n    (CONNECTED) /> tree\n    .\n    \u251c\u2500\u2500 target\n    \u2502   \u251c\u2500\u2500 znode2\n    \u2502   \u251c\u2500\u2500 znode1\n    \u2502   \u2502   \u251c\u2500\u2500 znode11\n    \u251c\u2500\u2500 source\n    \u2502   \u251c\u2500\u2500 znode2\n    \u2502   \u251c\u2500\u2500 znode1\n    \u2502   \u2502   \u251c\u2500\u2500 znode11\n    \u251c\u2500\u2500 zookeeper\n    \u2502   \u251c\u2500\u2500 config\n    \u2502   \u251c\u2500\u2500 quota\n    (CONNECTED) /> create /target/znode4 'Hello' false false true\n    (CONNECTED) /> mirror /source /target false false true\n    Mirroring took 0.03 secs\n    (CONNECTED) />\n\nDebugging watches can be done with the watch command. It allows\nmonitoring all the child watches that, recursively, fire under :\n\n::\n\n    (CONNECTED) /> watch start /\n    (CONNECTED) /> create /foo 'test'\n    (CONNECTED) /> create /bar/foo 'test'\n    (CONNECTED) /> rm /bar/foo\n    (CONNECTED) /> watch stats /\n\n    Watches Stats\n\n    /foo: 1\n    /bar: 2\n    /: 1\n    (CONNECTED) /> watch stop /\n\nSearching for paths or znodes which match a given text can be done via\nfind:\n\n::\n\n    (CONNECTED) /> find / foo\n    /foo2\n    /fooish/wayland\n    /fooish/xorg\n    /copy/foo\n\nOr a case-insensitive match using ifind:\n\n::\n\n    (CONNECTED) /> ifind / foo\n    /foo2\n    /FOOish/wayland\n    /fooish/xorg\n    /copy/Foo\n\nGrepping for content in znodes can be done via grep:\n\n::\n\n    (CONNECTED) /> grep / unbound true\n    /passwd: unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin\n    /copy/passwd: unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin\n\nOr via igrep for a case-insensitive version.\n\nNon-interactive mode can be used passing commands via ``--run-once``:\n\n::\n\n    $ zk-shell --run-once \"create /foo 'bar'\" localhost\n    $ zk-shell --run-once \"get /foo\" localhost\n    bar\n\nOr piping commands through stdin:\n\n::\n\n    $ echo \"get /foo\" | zk-shell --run-from-stdin localhost\n    bar\n\nIt's also possible to connect using an SSH tunnel, by specifying a host\nto use:\n\n::\n\n    $ zk-shell --tunnel ssh-host zk-host\n\nDependencies\n~~~~~~~~~~~~\n\n-  Python 2.7, 3.3, 3.4, 3.5 or 3.6\n-  Kazoo >= 2.2\n\nTesting and Development\n~~~~~~~~~~~~~~~~~~~~~~~\n\nPlease see `CONTRIBUTING.rst <CONTRIBUTING.rst>`__.\n", 
    "lcname": "zk_shell", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": true, 
    "name": "zk_shell", 
    "license": "Apache", 
    "travis_ci": true, 
    "github_project": "zk_shell", 
    "summary": "A Python - Kazoo based - shell for ZooKeeper", 
    "split_keywords": [
        "zookeeper", 
        "kazoo", 
        "shell"
    ], 
    "author_email": "rgs@itevenworks.net", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2018-04-04T16:42:25", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/c5/21/667cf64f5620e4ab78f6e0960632eb850de7f72ed05f861a25807a08189e/zk_shell-1.1.4.tar.gz", 
            "md5_digest": "422bc41f9402dfb7312d76cc121dc96a", 
            "downloads": 0, 
            "filename": "zk_shell-1.1.4.tar.gz", 
            "packagetype": "sdist", 
            "path": "c5/21/667cf64f5620e4ab78f6e0960632eb850de7f72ed05f861a25807a08189e/zk_shell-1.1.4.tar.gz", 
            "digests": {
                "sha256": "d037f950a81eeab0af5409417fa5edfb10a257a293f4d6f24b2405ade45dd595", 
                "md5": "422bc41f9402dfb7312d76cc121dc96a"
            }, 
            "sha256_digest": "d037f950a81eeab0af5409417fa5edfb10a257a293f4d6f24b2405ade45dd595", 
            "size": 53169
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}