Giter VIP home page Giter VIP logo

incubator-seata-ctl's Introduction

Introduction

This is a CLI tool for Seata named seata-ctl.

$ seata-ctl -h
seata-ctl is a CLI tool for Seata

Usage:
  seata-ctl [flags]
  seata-ctl [command]

Available Commands:
  version     Print the version number of seata-ctl

Flags:
  -h, --help              help for seata-ctl
      --ip string         Seata Server IP (default "127.0.0.1")
      --password string   Password (default "seata")
      --port int          Seata Server Admin Port (default 7091)
      --username string   Username (default "seata")

Use "seata-ctl [command] --help" for more information about a command.

Build

Dependency: Go 1.19+

go build .

How to use

Login

$ seata-ctl --ip 127.0.0.1 --port 7091 --username seata --password seata
127.0.0.1:7091 > # input command here

Help

127.0.0.1:7091 > help
Usage:
  [command] [flag] 

Available Commands:
  get         Get the resource
  help        Help about any command
  quit        Quit the session
  reload      Reload the configuration
  set         Set the resource
  try         Try example transactions

Get

Usage

127.0.0.1:7091 > get -h    
Get the resource

Usage:
   get [flags]
   get [command]

Available Commands:
  config        Get the configuration
  status        Get the status

Flags:
  -h, --help   help for get

Use "get [command] --help" for more information about a command.

Example

  1. Get the status of the Seata server cluster:
127.0.0.1:7091 > get status
+-------+--------------------+--------+
| TYPE  | ADDRESS            | STATUS |
+-------+--------------------+--------+
| nacos | 192.168.163.1:7091 | ok     |
+-------+--------------------+--------+
| nacos | 192.168.163.2:7091 | ok     |
+-------+--------------------+--------+
  1. Get the configuration server.servicePort:
127.0.0.1:7091 > get config --key '["server.servicePort"]'
+--------------------+-------+
| KEY                | VALUE |
+--------------------+-------+
| server.servicePort | 8091  |
+--------------------+-------+
  1. Get multiple configuration (which could be written in multiple lines by ending with '\'):
127.0.0.1:7091 > get config --key '[ \
    "server.servicePort", \
    "server.recovery.timeoutRetryPeriod", \
    "server.undo.logDeletePeriod" \
]'
+------------------------------------+----------+
| KEY                                | VALUE    |
+------------------------------------+----------+
| server.recovery.timeoutRetryPeriod | 1000     |
| server.servicePort                 | 8091     |
| server.undo.logDeletePeriod        | 86400000 |
+------------------------------------+----------+
  1. Get all configurations
127.0.0.1:7091 > get config
+------------------------------------+----------+
| KEY                                | VALUE    |
+------------------------------------+----------+
...

Set

Usage

127.0.0.1:7091 > set -h                    
Set the resource

Usage:
   set [flags]
   set [command]

Available Commands:
  config        Set the configuration

Flags:
  -h, --help   help for set

Use "set [command] --help" for more information about a command.
127.0.0.1:7091 > set config -h
Set the configuration

Usage:
   set config [flags]

Flags:
      --config-center   If set configuration center conf
      --data string     Configuration map (default "{}")
  -h, --help            help for config
      --registry        If set registry conf

Example

  1. Set the registry config, such as setting type to eureka:
127.0.0.1:7091 > set config --registry --data '{"registry.type": "eureka"}'
+---------------+------+--------+
| KEY           | FROM | TO     |
+---------------+------+--------+
| registry.type | file | eureka |
+---------------+------+--------+

You can found that the Seata server is registered at eureka registry.

  1. Set the configuration center config, such as setting type to nacos
127.0.0.1:7091 > set config --config-center --data '{"config.type": "nacos"}'
+-------------+------+-------+
| KEY         | FROM | TO    |
+-------------+------+-------+
| config.type | file | nacos |
+-------------+------+-------+

You can found that the configuration in nacos is loaded.

  1. Set a configuration item which can be dynamically configured (such as server.undo.logSaveDays):
127.0.0.1:7091 > set config --data '{"server.undo.logSaveDays": "5"}'
+-------------------------+------+----+
| KEY                     | FROM | TO |
+-------------------------+------+----+
| server.undo.logSaveDays | 6    | 5  |
+-------------------------+------+----+
  1. Set multiple configurations at the same time:
127.0.0.1:7091 > set config --data '{ \
    "server.maxCommitRetryTimeout": "3000", \
    "server.maxRollbackRetryTimeout": "3000", \
    "server.undo.logSaveDays": "14" \
}'
+--------------------------------+------+------+
| KEY                            | FROM | TO   |
+--------------------------------+------+------+
| server.maxCommitRetryTimeout   | -1   | 3000 |
| server.maxRollbackRetryTimeout | -1   | 3000 |
| server.undo.logSaveDays        | 5    | 14   |
+--------------------------------+------+------+

Try

Usage

127.0.0.1:7091 > try -h
Try if this node is ready

Usage:
   try [flags]
   try [command]

Available Commands:
  begin       begin a txn
  commit      commit a txn
  rollback    rollback a txn

Flags:
  -h, --help   help for try

Use "try [command] --help" for more information about a command.

Example

  1. Try to begin an example transaction:
127.0.0.1:7091 > try begin --timeout 300000
Try an example txn successfully, xid=192.168.163.1:8091:8755443813836259333
  1. Commit a transaction by xid:
127.0.0.1:7091 > try commit --xid 192.168.163.1:8091:8755443813836259333
Commit txn successfully, xid=192.168.163.1:8091:8755443813836259333
  1. Rollback a transaction by xid:
127.0.0.1:7091 > try rollback --xid 192.168.163.1:8091:8755443813836259333
Rollback txn successfully, xid=192.168.163.1:8091:8755443813836259333

Lifecycle of the transactions could be checked in Web console UI. (exposed at 7091 by default).

Reload

Usage

reload -h
Reload the configuration

Usage:
   reload [flags]

Flags:
  -h, --help   help for reload

Example

127.0.0.1:7091 > reload
Reload Successful!

Quit

Quit the session:

127.0.0.1:7091 > quit
Quit the session

incubator-seata-ctl's People

Contributors

an-dj avatar funky-eyes avatar slievrly avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

incubator-seata-ctl's Issues

Initialize and standardize the repo

Initialize and standardize tasks:

  • Submit initial code #1
  • Introduce code lint, license check tools in CI for PR
  • Introduce e2e test in CI
  • Template for community, such as issue and PR template #3
  • Introduce Build & Delivery function in CI

cc @slievrly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.