kafka的zookeeper.connect参数带路径

  • 常见的kafka配置文件server.properties的zookeeper连接配置

    zookeeper.connect=hostname1:2181,hostname2:2181,hostname2:2181
    log.dirs=/data01/kafka/log,/data02/kafka/log,/data03/kafka/log
    
  • 有时可能会看到类似下面的配置

    zookeeper.connect=hostname1:2181,hostname2:2181/kafka_cluster1
    

    那么我们程序或者命令中的zk连接地址必须写成--zookeeper hostname1:2181,hostname2:2181/kafka_cluster1 的形式。

    zk的连接地址中带一个路径“/kafka_cluster1”,是因为多个kafka集群注册到了一个zk集群中,不同路径代表将不同kafka集群信息注册到zk的不同节点上。

  • 这个路径叫做chroot path。kfk官方文档上提到zk的连接路径中可以带有chroot path。下面是kfk官方文档的链接以及对于zookeeper.connect参数的原文描述。
    http://kafka.apache.org/documentation/#brokerconfigs

    zookeeper.connect
    Specifies the ZooKeeper connection string in the form hostname:port where host and port are the host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is down you can also specify multiple hosts in the form hostname1:port1,hostname2:port2,hostname3:port3.
    The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. For example to give a chroot path of /chroot/path you would give the connection string as hostname1:port1,hostname2:port2,hostname3:port3/chroot/path.
    
    Type:	string
    Default:	null
    Valid Values:	
    Importance:	high
    Update Mode:	read-only
    
  • chroot是linux中的一种操作,即Change Root,也就是改变程序执行时参考的根目录的位置。我理解为一种路径映射,例如将路径“/”映射为“/hello”。

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值