<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

def commands_usage():
    return """
  server-list       list all servers in a cluster
  server-info       show details on one server
  server-add        add one or more servers to the cluster
  server-readd      readd a server that was failed over
  rebalance         start a cluster rebalancing
  rebalance-stop    stop current cluster rebalancing
  rebalance-status  show status of current cluster rebalancing
  failover          failover one or more servers
  cluster-init      set the username,password and port of the cluster
  node-init         set node specific parameters
  bucket-list       list all buckets in a cluster
  bucket-create     add a new bucket to the cluster
  bucket-edit       modify an existing bucket
  bucket-delete     delete an existing bucket
  bucket-flush      flush a given bucket
  help              show longer usage/help and examples
"""

def short_usage():
    print "usage: membase COMMAND CLUSTER [OPTIONS]"
    print ""
    print "CLUSTER is --cluster=HOST[:PORT] or -c HOST[:PORT]"
    print ""
    print "COMMAND's include" + commands_usage()

    sys.exit(2)

def usage(error_msg=''):
    if error_msg:
        print "ERROR: %s" % error_msg
        sys.exit(2)

    print """membase - command-line cluster administration tool

usage: membase COMMAND CLUSTER [OPTIONS]

COMMAND:""" + commands_usage() + """
CLUSTER:
  --cluster=HOST[:PORT] or -c HOST[:PORT]

OPTIONS:
  -u USERNAME, --user=USERNAME      admin username of the cluster
  -p PASSWORD, --password=PASSWORD  admin password of the cluster
  -o KIND, --output=KIND            KIND is json or standard
  -d, --debug

server-add OPTIONS:
  --server-add=HOST[:PORT]          server to be added
  --server-add-username=USERNAME    admin username for the
                                    server to be added
  --server-add-password=PASSWORD    admin password for the
                                    server to be added

server-readd OPTIONS:
  --server-add=HOST[:PORT]          server to be added
  --server-add-username=USERNAME    admin username for the
                                    server to be added
  --server-add-password=PASSWORD    admin password for the
                                    server to be added

rebalance OPTIONS:
  --server-add*                     see server-add OPTIONS
  --server-remove=HOST[:PORT]       the server to be removed

failover OPTIONS:
  --server-failover=HOST[:PORT]     server to failover

cluster-init OPTIONS:
  --cluster-init-username=USER      new admin username
  --cluster-init-password=PASSWORD  new admin password
  --cluster-init-port=PORT          new cluster port (must be at least 6 characters)
  --cluster-init-ramsize=RAMSIZEMB  per node ram quota in MB

node-init OPTIONS:
  --node-init-data-path=PATH        per node path to store data

bucket-* OPTIONS:
  --bucket=BUCKETNAME               bucket to act on
  --bucket-type=TYPE                memcached or membase
  --bucket-port=PORT                supports ASCII protocol and is auth-less
  --bucket-password=PASSWORD        standard port, exclusive with bucket-port
  --bucket-ramsize=RAMSIZEMB        ram quota in MB
  --bucket-replica=COUNT            replication count

The default PORT number is 8091.

EXAMPLES:
  List servers in a cluster:
    membase server-list -c 192.168.0.1:8091<commit_msg>MB-3248 - updated cluster-init-port help message<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

def commands_usage():
    return """
  server-list       list all servers in a cluster
  server-info       show details on one server
  server-add        add one or more servers to the cluster
  server-readd      readd a server that was failed over
  rebalance         start a cluster rebalancing
  rebalance-stop    stop current cluster rebalancing
  rebalance-status  show status of current cluster rebalancing
  failover          failover one or more servers
  cluster-init      set the username,password and port of the cluster
  node-init         set node specific parameters
  bucket-list       list all buckets in a cluster
  bucket-create     add a new bucket to the cluster
  bucket-edit       modify an existing bucket
  bucket-delete     delete an existing bucket
  bucket-flush      flush a given bucket
  help              show longer usage/help and examples
"""

def short_usage():
    print "usage: membase COMMAND CLUSTER [OPTIONS]"
    print ""
    print "CLUSTER is --cluster=HOST[:PORT] or -c HOST[:PORT]"
    print ""
    print "COMMAND's include" + commands_usage()

    sys.exit(2)

def usage(error_msg=''):
    if error_msg:
        print "ERROR: %s" % error_msg
        sys.exit(2)

    print """membase - command-line cluster administration tool

usage: membase COMMAND CLUSTER [OPTIONS]

COMMAND:""" + commands_usage() + """
CLUSTER:
  --cluster=HOST[:PORT] or -c HOST[:PORT]

OPTIONS:
  -u USERNAME, --user=USERNAME      admin username of the cluster
  -p PASSWORD, --password=PASSWORD  admin password of the cluster
  -o KIND, --output=KIND            KIND is json or standard
  -d, --debug

server-add OPTIONS:
  --server-add=HOST[:PORT]          server to be added
  --server-add-username=USERNAME    admin username for the
                                    server to be added
  --server-add-password=PASSWORD    admin password for the
                                    server to be added

server-readd OPTIONS:
  --server-add=HOST[:PORT]          server to be added
  --server-add-username=USERNAME    admin username for the
                                    server to be added
  --server-add-password=PASSWORD    admin password for the
                                    server to be added

rebalance OPTIONS:
  --server-add*                     see server-add OPTIONS
  --server-remove=HOST[:PORT]       the server to be removed

failover OPTIONS:
  --server-failover=HOST[:PORT]     server to failover

cluster-init OPTIONS:
  --cluster-init-username=USER      new admin username
  --cluster-init-password=PASSWORD  new admin password
  --cluster-init-port=PORT          new cluster REST/http port
  --cluster-init-ramsize=RAMSIZEMB  per node ram quota in MB

node-init OPTIONS:
  --node-init-data-path=PATH        per node path to store data

bucket-* OPTIONS:
  --bucket=BUCKETNAME               bucket to act on
  --bucket-type=TYPE                memcached or membase
  --bucket-port=PORT                supports ASCII protocol and is auth-less
  --bucket-password=PASSWORD        standard port, exclusive with bucket-port
  --bucket-ramsize=RAMSIZEMB        ram quota in MB
  --bucket-replica=COUNT            replication count

The default PORT number is 8091.

EXAMPLES:
  List servers in a cluster:
    membase server-list -c 192.168.0.1:8091
{'fraction_non_alphanumeric': 0.07913669064748201, 'fraction_numerical': 0.006313316693583908, 'mean_word_length': 2.2469018112488084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3412534', 'n_tokens_mistral': 1952, 'n_tokens_neox': 1885, 'n_words': 678}