Exception in thread "main" joptsimple.UnrecognizedOptionException: bootstrap-server is not a recognized option
时间: 2023-10-24 21:22:30 浏览: 282
如果使用`kafka-topics.sh`命令时出现`bootstrap-server is not a recognized option`错误,可能是因为您使用的是较旧的Kafka版本,该版本不支持`bootstrap-server`选项。
在较旧的Kafka版本中,应该使用`zookeeper`选项指定Zookeeper服务的地址和端口,例如:
```bash
$ kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic my-topic
```
如果您使用的是较新的Kafka版本(0.10.0及以上),则应该使用`bootstrap-server`选项指定Kafka服务的地址和端口,例如:
```bash
$ kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic my-topic
```
请注意,如果您使用的是较新的Kafka版本,但仍然出现`bootstrap-server is not a recognized option`错误,可能是因为您的命令行中存在语法错误或拼写错误,建议检查命令行参数是否正确。
相关问题
Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option
这个错误是因为在使用较新版本的Kafka时,使用了不再被识别的选项"--zookeeper-server"。\[2\]新版本的Kafka已经不需要依赖Zookeeper来查看或创建主题,而是使用"--bootstrap-server"选项。所以,你需要将命令中的"--zookeeper-server"替换为"--bootstrap-server"。例如,使用以下命令来查看主题:bin/kafka-topics.sh --list --bootstrap-server kafkahost:9092。\[3\]这样就可以避免出现"joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option"的错误了。
#### 引用[.reference_title]
- *1* [kafka报错:Exception in thread “main“ joptsimple.UnrecognizedOptionException: zookeeper is not a ...](https://blog.csdn.net/zhangphil/article/details/123093909)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [Kafka报错:Exception in thread “main“ joptsimple.UnrecognizedOptionException: zookeeper is not a ...](https://blog.csdn.net/xp871038951/article/details/127334561)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![crx](https://img-home.csdnimg.cn/images/20250102104920.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)