...
Code Block |
---|
bin/kafka-reassign-partitions.sh Option Description ------ ----------- --broker-list <brokerlist> The list of brokers to which the partitions need to be reassigned in the form "0,1,2". This is required for automatic topic reassignment. --execute [execute] This option does the actual reassignment. By reassignment. By default, default, the tool does a dry run --manual-assignment-json-file <manual The JSON file with the list of manual assignment json file path> reassignmentsThis option or topics- to-move-json-file needs to be specified. The format to use is - {"partitions": [{"topic": "foo", [{"topic": "foo", "partition": 1, "partitionreplicas": [1,2,3] }], "version":1 "replicas": [1,2,3] }], } --topics-to-move-json-file <topics to The JSON file with the list of topics reassign json file path> to reassign.This option "version":1or manual- assignment-json-file needs to be } specified. The format to use is - --topics-to-move-json-file <topics to The JSON file with the list of topics reassign json file path> {"topics": to reassign.This option or manual- [{"topic": "foo"},{"topic": "foo1"}], "version":1 } --zookeeper <urls> REQUIRED: The connection string for the zookeeper connection in the form host:port. Multiple URLS can be given to allow fail-over. |
7. StateChangeLogMerger Tool
What does the tool do ?
The goal of this tool is to collect data from the brokers in a cluster and format it in a central log to help troubleshoot issues with state changes. Every broker in a Kafka cluster emits a state-change.log that logs the lifecycle of every state change received by the broker. Often times, there is some problem with leader election for a subset of topics/partitions and the question is what caused the problem. In order to answer this question, we need a global view of state changes in the kafka cluster, possibly filtered on a time range and/or specific topics/partitions. This is exactly what the StateChangeLogMerger tool does. It takes in a list of state-change.log files, merges them in time order, filters on a certain time range if specified by the user, filters on topics/partitions if specified by the user, and outputs a merged and formatted state-change.log that is easy to query and understand the root cause.
How to use the tool ?
Code Block |
---|
nnarkhed-mn:kafka-git-idea nnarkhed$ ./bin/kafka-run-class.sh kafka.tools.StateChangeLogMerger Provide arguments to exactly one of the two options "[logs]" or "[logs-regex]" Option Description ------ ----------- --end-time <end timestamp in the The latest timestamp of state change format java.text. log entries to be merged (default: SimpleDateFormat@f17a63e7> 9999-12-31 23:59:59,999) --logs <file1,file2,...> Comma separated list of state change assignment-json-file needs to be logs or a regex for the log file specified. The format to use is - names {"topics": --logs-regex <for example: /tmp/state- Regex to match the state change log change.log*> files to be merged [{"topic": "foo"},{"topic": "foo1"}], --partitions <0,1,2,...> Comma separated list of partition ids "version":1 whose state change logs should be } merged --zookeeper <urls> --start-time <start timestamp in the The earliest timestamp REQUIRED:of Thestate connectionchange string for format java.text. log entries to be merged (default: SimpleDateFormat@f17a63e7> the zookeeper connection in the form 0000-00-00 00:00:00,000) --topic <topic> The topic whose state change host:port.logs Multiple URLS can be should be merged given to allow fail-over. |