在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:fgeller/kt开源软件地址:https://github.com/fgeller/kt开源编程语言:Go 97.3%开源软件介绍:kt - a Kafka tool that likes JSONSome reasons why you might be interested:
I'm not using kt actively myself anymore, so if you think it's lacking some feature - please let me know by creating an issue! ExamplesRead details about topics that match a regex$ kt topic -filter news -partitions
{
"name": "actor-news",
"partitions": [
{
"id": 0,
"oldest": 0,
"newest": 0
}
]
} Produce messages$ echo 'Alice wins Oscar' | kt produce -topic actor-news -literal
{
"count": 1,
"partition": 0,
"startOffset": 0
}
$ echo 'Bob wins Oscar' | kt produce -topic actor-news -literal
{
"count": 1,
"partition": 0,
"startOffset": 0
}
$ for i in {6..9} ; do echo Bourne sequel $i in production. | kt produce -topic actor-news -literal ;done
{
"count": 1,
"partition": 0,
"startOffset": 1
}
{
"count": 1,
"partition": 0,
"startOffset": 2
}
{
"count": 1,
"partition": 0,
"startOffset": 3
}
{
"count": 1,
"partition": 0,
"startOffset": 4
} Or pass in JSON object to control key, value and partition$ echo '{"value": "Terminator terminated", "key": "Arni", "partition": 0}' | kt produce -topic actor-news
{
"count": 1,
"partition": 0,
"startOffset": 5
} Read messages at specific offsets on specific partitions$ kt consume -topic actor-news -offsets 0=1:2
{
"partition": 0,
"offset": 1,
"key": "",
"value": "Bourne sequel 6 in production.",
"timestamp": "1970-01-01T00:59:59.999+01:00"
}
{
"partition": 0,
"offset": 2,
"key": "",
"value": "Bourne sequel 7 in production.",
"timestamp": "1970-01-01T00:59:59.999+01:00"
} Follow a topic, starting relative to newest offset$ kt consume -topic actor-news -offsets all=newest-1:
{
"partition": 0,
"offset": 4,
"key": "",
"value": "Bourne sequel 9 in production.",
"timestamp": "1970-01-01T00:59:59.999+01:00"
}
{
"partition": 0,
"offset": 5,
"key": "Arni",
"value": "Terminator terminated",
"timestamp": "1970-01-01T00:59:59.999+01:00"
}
^Creceived interrupt - shutting down
shutting down partition consumer for partition 0 View offsets for a given consumer group$ kt group -group enews -topic actor-news -partitions 0
found 1 groups
found 1 topics
{
"name": "enews",
"topic": "actor-news",
"offsets": [
{
"partition": 0,
"offset": 6,
"lag": 0
}
]
} Change consumer group offset$ kt group -group enews -topic actor-news -partitions 0 -reset 1
found 1 groups
found 1 topics
{
"name": "enews",
"topic": "actor-news",
"offsets": [
{
"partition": 0,
"offset": 1,
"lag": 5
}
]
}
$ kt group -group enews -topic actor-news -partitions 0
found 1 groups
found 1 topics
{
"name": "enews",
"topic": "actor-news",
"offsets": [
{
"partition": 0,
"offset": 1,
"lag": 5
}
]
} Create and delete a topic$ kt admin -createtopic morenews -topicdetail <(jsonify =NumPartitions 1 =ReplicationFactor 1)
$ kt topic -filter news
{
"name": "morenews"
}
$ kt admin -deletetopic morenews
$ kt topic -filter news Change broker address via environment variable$ export KT_BROKERS=brokers.kafka:9092
$ kt <command> <option> InstallationYou can download kt via the Releases section. Alternatively, the usual way via the go tool, for example:
Or via Homebrew on OSX:
Docker@Paxa maintains an image to run kt in a Docker environment - thanks! For more information: https://github.com/Paxa/kt Usage:
Authentication / EncryptionAuthentication configuration is possibly via a JSON file. You indicate the mode
of authentication you need and provide additional information as required for
your mode. You pass the path to your configuration file via the TLSRequired fields:
Example for an authorization configuration that is used for the system tests:
TLS one-wayRequired fields:
Example:
Other modesPlease create an issue with details for the mode that you need. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论