Skip to main content
Version: 1.9.0

Command-line Tools

Overview

TubeMQ provides command line tools to manage topics, produce and consume messages, and manage consumer groups.
The command line tool tubectl can be found in the bin directory of the TubeMQ installation path.

usage:

$ bin/tubectl [options] [command] [command options]

command:

  • topic
  • message
  • group

    You can also use --help or -h to get help for the above commands, for example:

$ bin/tubectl topic -h

Topic

topic is used to manage topics, including adding, deleting, modifying, checking, etc.

command:

  • list
  • update
  • create
  • delete

list

$ bin/tubectl topic list

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic name
-sid, --topic-status-idIntTopic status ID0
-bid, --broker-idStringBrokers' ID, separated by commas
-dp, --delete-policyStringFile aging strategy
-np, --num-partitionsIntNumber of partitions3
-nts, --num-topic-storesIntNumber of topic stores1
-uft, --unflush-thresholdIntMaximum allowed disk unflushing message count1000
-ufi, --unflush-intervalIntMaximum allowed disk unflushing interval10000
-ufd, --unflush-dataHoldIntMaximum allowed disk unflushing data size0
-mc, --memcache-msgcnt-inkIntMaximum allowed memory cache unflushing message count10
-ms, --memcache-msgsize-inmbIntMaximum allowed memory cache size in MB2
-mfi, --memcache-flush-intvlIntMaximum allowed disk unflushing data size20000
-c, --creatorStringRecord creator
-m, --modifierStringRecord modifier

update

$ bin/tubectl topic update

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic nameyes
-bid, --broker-idStringBrokers' ID, separated by commasyes
-m, --modifierStringRecord modifieryes
-at, --auth-tokenStringAdmin api operation authorization codyes
-dp, --delete-policyStringFile aging strategy
-np, --num-partitionsIntNumber of partitions3
-uft, --unflush-thresholdIntMaximum allowed disk unflushing message count1000
-ufi, --unflush-intervalIntMaximum allowed disk unflushing interval10000
-ufd, --unflush-dataholdIntMaximum allowed disk unflushing data size0
-nts, --num-topic-storesIntNumber of topic stores1
-mc, --memcache-msgcnt-inkIntMaximum allowed memory cache unflushing message count10
-ms, --memcache-msgsize-inmbIntMaximum allowed memory cache size in MB2
-mfi, --memcache-flush-intvlIntMaximum allowed disk unflushing data size20000
-ap, --accept-publishBooleanEnable publishingtrue
-as, --accept-subscribeBooleanEnable subscriptiontrue
-mms, --max-msgsize-inmbIntMaximum allowed message length, unit MB1
-md, --modify-dateStringRecord modification date

create

$ bin/tubectl topic create

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic nameyes
-bid, --broker-idStringBrokers' ID, separated by commasyes
-c, --creatorStringRecord creatoryes
-at, --auth-tokenStringAdmin api operation authorization codyes
-dp, --delete-policyStringFile aging strategy
-np, --num-partitionsIntNumber of partitions-1
-uft, --unflush-thresholdIntMaximum allowed disk unflushing message count-1
-ufi, --unflush-intervalIntMaximum allowed disk unflushing interval-1
-ufd, --unflush-dataholdIntMaximum allowed disk unflushing data size0
-nts, --num-topic-storesIntNumber of topic stores1
-mc, --memcache-msgcnt-inkIntMaximum allowed memory cache unflushing message count10
-ms, --memcache-msgsize-inmbIntMaximum allowed memory cache size in MB2
-mfi, --memcache-flush-intvlIntMaximum allowed disk unflushing data size20000
-ap, --accept-publishBooleanEnable publishingtrue
-as, --accept-subscribeBooleanEnable subscriptiontrue
-mms, --max-msgsize-inmbIntMaximum allowed message length, unit MB1
-cd, --create-dateStringRecord creation date

delete

$ bin/tubectl topic delete

options:

parametertypedescriptiondefaultrequired
-o, --delete-optStringDelete option, optional values: soft, redo,hardsoft
-t, --topicStringTopic nameyes
-bid, --broker-idStringBrokers' ID, separated by commasyes
-m, --modifierStringRecord modifieryes
-at, --auth-tokenStringAdmin api operation authorization codeyes
-md, --modify-dateStringRecord modification date
delete option type
delete options typedescription
softsoft deletion
redorollback a previous soft delete
hardhard deletion

Message

message is used to produce and consume messages.

command:

  • produce
  • consume

produce

$ bin/tubectl message produce

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic nameyes
-ms, --master-serversStringThe master address to connect to. Format is master1_ip:port[,master2_ip:port]yes
-mt, --msg-totalLongThe total number of messages to be produced, -1 means unlimited-1
-m, --modeStringProduce mode, optional values: sync, asyncasync
produce mode type
produce mode typedescription
syncsync mode
asyncasync mode

consume

$ bin/tubectl message consume

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic nameyes
-g, --groupStringConsumer groupyes
-ms, --master-serversStringThe master address to connect to. Format is master1_ip:port[,master2_ip:port]yes
-p, --positionStringConsume position, optional values: first, latest, maxfirst
-po, --partitions-offsetsStringAssign consume partition ids and their offsets. Format is id1:offset1[,id2:offset2], for example: 0:0,1:0,2:0
-m, --modeStringConsume mode, optional values: pull, push, balance. When the -po parameter is specified, balance mode is used by default.pull
consume position type
consume positiondescription
firstStart from 0 for the first time. Otherwise start from last consume position.
latestStart from the latest position for the first time. Otherwise start from last consume position.
maxAlways start from the max consume position.
consume mode type
consume modedescription
pullpull mode
pushpush mode
balanceclient balance mode

Group

group is used for consumer group management. It currently supports query, addition, and deletion.

command:

  • list
  • create
  • delete

list

$ bin/tubectl group list 

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic name
-g, --groupStringConsumer group
-c, --creatorStringRecord creator

create

$ bin/tubectl group create

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic nameyes
-g, --groupStringConsumer groupyes
-at, --auth-tokenStringAdmin api operation authorization codeyes
c, --creatorStringRecord creatoryes
-cd, --create-dateStringRecord creation date

delete

$ bin/tubectl group delete

options:

parametertypedescriptiondefaultrequired
-t, --topicStringTopic nameyes
-at, --auth-tokenStringAdmin api operation authorization codeyes
-m, --modifierStringRecord modifieryes
-g, --groupStringConsumer group