版本 2.11-1.0.0
1.kafka-console-consumer.sh
--blacklist | <string blacklist > Blacklist of topics to exclude from onsumption. |
--bootstrap-server | <String: server to REQUIRED (unless old consumer is connect to> used): The server to connect to. |
--consumer-property | <String: A mechanism to pass user-defined consumer_prop> properties in the form key=value to the consumer. |
--consumer.config | <String: config file> Consumer config properties file. Note that [consumer-property] takes precedence over this config. |
--csv-reporter-enabled | If set, the CSV metrics reporter will be enabled |
--delete-consumer-offsets | If specified, the consumer path in zookeeper is deleted when starting up |
--enable-systest-events | Log lifecycle events of the consumer in addition to logging consumed messages. (This is specific for system tests.) |
--formatter | <String: class> The name of a class to use for formatting kafka messages for display. (default: kafka.tools. DefaultMessageFormatter) |
--from-beginning | 如果消费者没有设置过offset,则从头开始读;否则从latest读;比如group A有个消费者组A1,A1消费者线程激活后被关闭,CURRENT-OFFSET=2, LOG-END-OFFSET=4,若此时groupA的新的A2消费者线程,会从3读;若是groupB线程,会从0读 |
--group | <String: consumer group id > The consumer group id of the consumer. |
--isolation-level | <String> Set to read_committed in order to filter out transactional messages which are not committed. Set to read_uncommittedto read all messages. (default: read_uncommitted) |
--key-deserializer | --key-deserializerString: deserializer for key> |
--max-messages | <Integer: num_messages> The maximum number of messages to consume before exiting. If not set, consumption is continual. |
--metrics-dir | <String: metrics If csv-reporter-enable is set, and directory> this parameter isset, the csv metrics will be output here |
--new-consumer | Use the new consumer implementation. This is the default, so this option is deprecated and will be removed in a future release. |
--offset | <String: consume offset> The offset id to consume from (a non- negative number), or 'earliest' which means from beginning, or 'latest' which means from end (default: latest) |
--partition | <Integer: partition> The partition to consume from. Consumption starts from the end of the partition unless '--offset' is specified. |
--property | <String: prop> The properties to initialize the message formatter. |
--skip-message-on-error | If there is an error when processing a message, skip it instead of halt. |
--timeout-ms | <Integer: timeout_ms> If specified, exit if no message is available for consumption for the specified interval. |
--topic | <String: topic> The topic id to consume on. |
--value-deserializer | <String: deserializer for values> |
--whitelist | <String: whitelist> Whitelist of topics to include for consumption. |
--zookeeper | <String: urls> REQUIRED (only when using old consumer): The connection string for the zookeeper connection in the form host:port. Multiple URLS can be given to allow fail-over. |
2.kafka-consumer-groups.sh
默认里面列出的都是java新api方式产生的数据
每个命令前面2个短横线
参数 | |
---|---|
–topics | Consider all topics assigned to a group in the reset-offsets process. |
–bootstrap-server <String: server to | REQUIRED (for consumer groups based on connect to> the new consumer): The server to connect to. |
–by-duration <String: duration> | Reset offsets to offset by duration from current timestamp. Format: ‘PnDTnHnMnS’ |
–command-config <String: command | Property file containing configs to be config property file> passed to Admin Client and Consumer. |
–delete | Pass in groups to delete topic partition offsets and ownership information over the entire consumer group. For instance --group g1 – group g2 Pass in groups with a single topic to just delete the given topic’s partition offsets and ownership information for the given consumer groups. For instance --group g1 – group g2 |
–topic t1 Pass in just a topic to delete the given topic’s partition offsets and ownership information for every consumer group. For instance | |
–topic t1 WARNING: Group deletion only works for old ZK-based consumer groups, and one has to use it carefully to only delete groups that are not active. | |
–describe | Describe consumer group and list offset lag (number of messages not yet processed) related to given group. |
–execute | Execute operation. Supported operations: reset-offsets. |
–export | Export operation execution to a CSV file. Supported operations: reset- offsets. |
–from-file <String: path to CSV file> | Reset offsets to values defined in CSV file. |
–group <String: consumer group> | The consumer group we wish to act on. |
–list | List all consumer groups. |
–new-consumer | Use the new consumer implementation. This is the default, so this option is deprecated and will be removed in a future release. |
–reset-offsets | Reset offsets of consumer group. Supports one consumer group at the time, and instances should be inactive Has 3 execution options: (default) to plan which offsets to reset, |
– execute to execute the reset-offsets process, and | |
–export to export the results to a CSV format. Has the following scenarios to choose: | |
–to-datetime, --by-period, --to- earliest, --to-latest, --shift-by, – from-file, | |
–to-current. One scenario must be choose To define the scope use: --all-topics or --topic. . One scope must be choose, unless you use ’ | |
–from-file’ scenario | |
–shift-by <Long: number-of-offsets> | Reset offsets shifting current offset by ‘n’, where ‘n’ can be positive or negative |
–timeout <Long: timeout (ms)> | The timeout that can be set for some use cases. For example, it can be used when describing the group to specify the maximum amount of time in milliseconds to wait before the group stabilizes (when the group is just created, or is going through some changes). (default: 5000) |
–to-current | Reset offsets to current offset. |
–to-datetime <String: datetime> | Reset offsets to offset from datetime. Format: ‘YYYY-MM-DDTHH:mm:SS.sss’ |
–to-earliest | Reset offsets to earliest offset. |
–to-latest | Reset offsets to latest offset. |
–to-offset <Long: offset> | Reset offsets to a specific offset. |
–topic <String: topic> | The topic whose consumer group information should be deleted or topic whose should be included in the reset offset process. In reset- offsets case, partitions can be specified using this format: topic1: 0,1,2 , where 0,1,2 are the partition to be included in the process. Reset-offsets also supports multiple topic inputs. |
–zookeeper <String: urls> | REQUIRED (for consumer groups based on the old consumer): The connection string for the zookeeper connection in the form host:port. Multiple URLS can be given to allow fail-over. |