如何设置多个代理节点?
How to set up multiple broker nodes?
我尝试了以下 -
./confluent start
这给出了-
This CLI is intended for development only, not for production
https://docs.confluent.io/current/cli/index.html
Using CONFLUENT_CURRENT: /tmp/confluent.w1S9B10m
Starting zookeeper
zookeeper is [UP]
Starting kafka
kafka is [UP]
Starting schema-registry
schema-registry is [UP]
Starting kafka-rest
kafka-rest is [UP]
Starting connect
connect is [UP]
Starting ksql-server
ksql-server is [UP]
在此之后,./kafka-topics --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic users
为主题 "users" 创建 3 个分区。但这给出了错误-
Error while executing topic command : Replication factor: 3 larger
than available brokers: 1. [2018-10-03 02:47:19,079] ERROR
org.apache.kafka.common.errors.InvalidReplicationFactorException:
Replication factor: 3 larger than available brokers: 1.
(kafka.admin.TopicCommand$)
如何设置 3 个代理? This post 类似,但我不知道如何实现它。
编辑
现在我在不同的 linux 终端 windows 上使用 ./confluent start
然后 kafka-server-start /path/to/server-1.properties
和 server-2.properties。但是当我尝试启动 server-2 时出现 "JVM cannot allocate memory" 错误。
OpenJDK 64-Bit Server VM warning: INFO:
os::commit_memory(0x00000000c0000000, 1073741824, 0) failed;
error='Cannot allocate memory' (errno=12)
There is insufficient memory for the Java Runtime Environment to
continue.
Native memory allocation (mmap) failed to map 1073741824
bytes for committing reserved memory.
您收到该错误是因为您请求的复制因子为三,但只有一个代理。由于 Kafka 无法满足请求的复制因子(因为您没有 >= 3 个代理),它拒绝创建主题。
安装多节点环境有steps shown here个。其他两个相关文档:
- http://kafka.apache.org/quickstart#quickstart_multibroker
- http://kafka.apache.org/documentation/#basic_ops_cluster_expansion
如果您只想使用单个代理(例如用于开发),您可以降低复制因子:
./kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic users
有一个使用 terraform 和 ansible 启动 5 个 AWS 实例然后在 GitHub
上部署一个 3-broker 集群的简单示例
请注意,这只是为了玩玩,我们需要做一些更多的工作,使它在您想要公开到互联网的各种服务(REST 代理)之前使用 ELB 变得更像生产, C3).
Now I am using ./confluent start and then kafka-server-start /path/to/server-1.properties and server-2.properties on different linux terminal windows. But I get a "JVM cannot allocate memeory" sometimes.
您正在耗尽内存,因为您总共启动了 3 个代理、1 个 Zookeeper、1 个架构注册表、1 个 Kafka 连接服务器、1 个 Kafka REST 服务器、KSQL 服务器,总内存使用量为某处超过 8 GB...如果您下载了 Confluent Enterprise,那么您将获得 Control Center 以获得更多用途。
强烈建议不要 运行 一台机器上的每一个服务,甚至一台机器上的多个 Kafka 代理,因为如果你只有一个磁盘,那么你将IO 无论如何都受一个实例约束
如果你只想要Kafka,你不需要confluent cli命令。 运行 Zookeeper 启动命令,然后运行 Kafka 启动命令。
You're welcome to start either of those in separate terminals on different ports and pointing to different storage locations,但是,两者都是内存密集型应用程序,因此您应该为它们提供大量可用堆 space(在 Apache Kafka 页面上,它表示在生产部署中至少有 6G)
我尝试了以下 -
./confluent start
这给出了-
This CLI is intended for development only, not for production
https://docs.confluent.io/current/cli/index.htmlUsing CONFLUENT_CURRENT: /tmp/confluent.w1S9B10m Starting zookeeper
zookeeper is [UP] Starting kafka
kafka is [UP]
Starting schema-registry schema-registry is [UP]
Starting kafka-rest
kafka-rest is [UP]
Starting connect
connect is [UP] Starting ksql-server
ksql-server is [UP]
在此之后,./kafka-topics --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic users
为主题 "users" 创建 3 个分区。但这给出了错误-
Error while executing topic command : Replication factor: 3 larger than available brokers: 1. [2018-10-03 02:47:19,079] ERROR
org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 3 larger than available brokers: 1.
(kafka.admin.TopicCommand$)
如何设置 3 个代理? This post 类似,但我不知道如何实现它。
编辑
现在我在不同的 linux 终端 windows 上使用 ./confluent start
然后 kafka-server-start /path/to/server-1.properties
和 server-2.properties。但是当我尝试启动 server-2 时出现 "JVM cannot allocate memory" 错误。
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
您收到该错误是因为您请求的复制因子为三,但只有一个代理。由于 Kafka 无法满足请求的复制因子(因为您没有 >= 3 个代理),它拒绝创建主题。
安装多节点环境有steps shown here个。其他两个相关文档:
- http://kafka.apache.org/quickstart#quickstart_multibroker
- http://kafka.apache.org/documentation/#basic_ops_cluster_expansion
如果您只想使用单个代理(例如用于开发),您可以降低复制因子:
./kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic users
有一个使用 terraform 和 ansible 启动 5 个 AWS 实例然后在 GitHub
上部署一个 3-broker 集群的简单示例请注意,这只是为了玩玩,我们需要做一些更多的工作,使它在您想要公开到互联网的各种服务(REST 代理)之前使用 ELB 变得更像生产, C3).
Now I am using ./confluent start and then kafka-server-start /path/to/server-1.properties and server-2.properties on different linux terminal windows. But I get a "JVM cannot allocate memeory" sometimes.
您正在耗尽内存,因为您总共启动了 3 个代理、1 个 Zookeeper、1 个架构注册表、1 个 Kafka 连接服务器、1 个 Kafka REST 服务器、KSQL 服务器,总内存使用量为某处超过 8 GB...如果您下载了 Confluent Enterprise,那么您将获得 Control Center 以获得更多用途。
强烈建议不要 运行 一台机器上的每一个服务,甚至一台机器上的多个 Kafka 代理,因为如果你只有一个磁盘,那么你将IO 无论如何都受一个实例约束
如果你只想要Kafka,你不需要confluent cli命令。 运行 Zookeeper 启动命令,然后运行 Kafka 启动命令。
You're welcome to start either of those in separate terminals on different ports and pointing to different storage locations,但是,两者都是内存密集型应用程序,因此您应该为它们提供大量可用堆 space(在 Apache Kafka 页面上,它表示在生产部署中至少有 6G)