github.com/m3db/m3@v1.5.0/src/cmd/tools/m3ctl/README.md (about)

     1  # M3DB CLI Tool
     2  
     3  This is a CLI tool to do some things that may be desirable for
     4  cluster introspection, or for operational purposes.
     5  
     6  Where configuration data is required its provided via YAML.
     7  
     8  You can:
     9  
    10  * create a database per the simplified database create API
    11  * list namespaces
    12  * delete namespaces
    13  * list placements
    14  * delete placements
    15  * list topics
    16  * delete topics
    17  * add nodes
    18  * remove nodes
    19  
    20  NOTE: This tool can delete namespaces and placements.  It can be
    21  quite hazardous if used without adequate understanding of your m3db
    22  cluster's topology, or without a decent understanding of how m3db
    23  works.
    24  
    25  ## Examples
    26  
    27  ```
    28  # show help
    29  m3ctl -h
    30  # create a database
    31  m3ctl apply -f ./database/examples/dbcreate.yaml
    32  # list namespaces
    33  m3ctl get ns
    34  # delete a namespace
    35  m3ctl delete ns -id default
    36  # list service placements (m3db/m3coordinator/m3aggregator)
    37  m3ctl get pl <service>
    38  # list topics
    39  m3ctl get topic --header 'Cluster-Environment-Name: namespace/m3db-cluster-name, Topic-Name: aggregator_ingest'
    40  # point to some remote and list namespaces
    41  m3ctl -endpoint http://localhost:7201 get ns
    42  # check the namespaces in a kubernetes cluster
    43  # first setup a tunnel via kubectl port-forward ... 7201
    44  m3ctl -endpoint http://localhost:7201 get ns
    45  # list the ids of the m3db placements
    46  m3ctl -endpoint http://localhost:7201 get pl m3db | jq .placement.instances[].id
    47  ```
    48  
    49  Some example yaml files for the "apply" subcommand are provided in the yaml/examples directory.
    50  Here's one to initialize a topology:
    51  
    52  ```yaml
    53  ---
    54  operation: init
    55  service: m3db
    56  num_shards: 64
    57  replication_factor: 1
    58  instances:
    59    - id: nodeid1
    60      isolation_group: isogroup1
    61      zone: etcd1
    62      weight: 100
    63      endpoint: node1:9000
    64      hostname: node1
    65      port: 9000
    66    - id: nodeid2
    67      isolation_group: isogroup2
    68      zone: etcd1
    69      weight: 100
    70      endpoint: node2:9000
    71      hostname: node2
    72      port: 9000
    73    - id: nodeid3
    74      isolation_group: isogroup3
    75      zone: etcd1
    76      weight: 100
    77      endpoint: node3:9000
    78      hostname: node3
    79      port: 9000
    80  ```
    81  
    82  See the examples directories below.
    83  
    84  # References
    85  
    86   * [Operational guide](https://docs.m3db.io/operational_guide)
    87   * [API docs](https://www.m3db.io/openapi/)