简体   繁体   English

如何在同一个 L2 网络上创建多个 Kafka 集群?

[英]How to create multiple Kafka clusters on same L2 network?

I have 12 Kafka nodes on same L2 Network.我在同一个 L2 网络上有 12 个 Kafka 节点。

I want to create 4 Kafka clusters (each with 3 nodes) on same L2 network.我想在同一个 L2 网络上创建 4 个 Kafka 集群(每个集群有 3 个节点)。

Is it possible to do this and how?是否有可能做到这一点以及如何做到这一点? If not then what's the workaround?如果不是,那么解决方法是什么?

A Kafka cluster is basically defined by the Zookeeper data model that its members use. Kafka 集群基本上由其成员使用的 Zookeeper 数据模型定义。 So, if you want some brokers to belong to a given cluster, you have to make them point to the same Zookeeper namespace.因此,如果您希望某些代理属于给定集群,则必须使它们指向相同的 Zookeeper 命名空间。 In practical terms, if you want to have 4 clusters then you will need 4 different chroots in your Zookeeper ensemble and make each cluster use a different one.实际上,如果您想拥有 4 个集群,那么您的 Zookeeper 集合中将需要 4 个不同的 chroot,并使每个集群使用不同的一个。 For example, members of cluster A will use zookeeper.connect=127.0.0.1:2181/cluster/a , members of cluster B will use zookeeper.connect=127.0.0.1:2181/cluster/b and so on.例如,集群 A 的成员将使用zookeeper.connect=127.0.0.1:2181/cluster/a ,集群 B 的成员将使用zookeeper.connect=127.0.0.1:2181/cluster/b等等。 Of course another alternative is to use a completely separated Zookeeper ensembles for each cluster.当然,另一种选择是为每个集群使用一个完全分离的 Zookeeper 集成。

From ZooKeeper Programmer's Guide来自ZooKeeper 程序员指南

An optional "chroot" suffix may also be appended to the connection string.可选的“chroot”后缀也可以附加到连接字符串。 This will run the client commands while interpreting all paths relative to this root (similar to the unix chroot command).这将在解释与此根相关的所有路径的同时运行客户端命令(类似于 unix chroot 命令)。 If used the example would look like: "127.0.0.1:4545/app/a" or "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a" where the client would be rooted at "/app/a" and all paths would be relative to this root - ie getting/setting/etc... "/foo/bar" would result in operations being run on "/app/a/foo/bar" (from the server perspective).如果使用该示例将类似于:“127.0.0.1:4545/app/a”或“127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a”,其中客户端将植根于“/app/a”和所有路径都将相对于这个根 - 即获取/设置/等...“/foo/bar”将导致在“/app/a/foo/bar”上运行操作(来自服务器视角)。 This feature is particularly useful in multi-tenant environments where each user of a particular ZooKeeper service could be rooted differently.此功能在多租户环境中特别有用,在这种环境中,特定 ZooKeeper 服务的每个用户都可能具有不同的 root 权限。 This makes re-use much simpler as each user can code his/her application as if it were rooted at "/", while actual location (say /app/a) could be determined at deployment time.这使得重用变得更加简单,因为每个用户都可以编码他/她的应用程序,就好像它以“/”为根,而实际位置(比如 /app/a)可以在部署时确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM