From 0d1d3f8813fab5624c8abe3f39d2f0c3c7b1a961 Mon Sep 17 00:00:00 2001 From: itboon Date: Sun, 20 Oct 2024 13:48:53 +0800 Subject: [PATCH] update mkdocs --- docs/docker.md | 42 ------------------------------------------ docs/env.md | 4 +--- docs/helm.md | 22 ++++++++++++++++++---- docs/index.md | 11 ----------- docs/network.md | 47 ----------------------------------------------- 5 files changed, 19 insertions(+), 107 deletions(-) delete mode 100644 docs/docker.md delete mode 100644 docs/network.md diff --git a/docs/docker.md b/docs/docker.md deleted file mode 100644 index 101e7d6..0000000 --- a/docs/docker.md +++ /dev/null @@ -1,42 +0,0 @@ -# Docker 启动 Kafka - -快速启动 Kafka: - -``` shell -docker run -d --network host --name demo-kafka-server kafkace/kafka:v3.5.2 -``` - -## 数据持久化 - -数据存储路径 `/opt/kafka/data`,挂载数据卷: - -``` shell -docker volume create demo-kafka-data - -docker run -d \ - --network host \ - --name demo-kafka-server \ - -v demo-kafka-data:/opt/kafka/data \ - kafkace/kafka:v3.5.2 - -``` - -## docker compose - -``` yaml -version: "3" - -volumes: - kafka-data: {} - -services: - kafka: - image: kafkace/kafka:v3.5.2 - restart: always - network_mode: "host" - volumes: - - kafka-data:/opt/kafka/data - environment: - - KAFKA_HEAP_OPTS=-Xmx1024m -Xms1024m - -``` \ No newline at end of file diff --git a/docs/env.md b/docs/env.md index c46a158..5ce9496 100644 --- a/docs/env.md +++ b/docs/env.md @@ -8,7 +8,7 @@ | `KAFKA_BROKER_LISTENER_PORT` | `9092` | broker 端口号,如果配置了 `KAFKA_CFG_LISTENERS` 则此项失效 | | `KAFKA_CONTROLLER_LISTENER_PORT` | `19091` | controller 端口号,如果配置了 `KAFKA_CFG_LISTENERS` 则此项失效 | | `KAFKA_BROKER_EXTERNAL_HOST` | null | 对外暴露的主机名,可以是域名或IP地址,如果配置了 `KAFKA_CFG_ADVERTISED_LISTENERS` 则此项失效 | -| `KAFKA_BROKER_EXTERNAL_PORT` | `29092` | 对外暴露的端口号,不能跟内部端口重复,如果配置了 `KAFKA_CFG_ADVERTISED_LISTENERS` 则此项失效 | +| `KAFKA_BROKER_EXTERNAL_PORT` | null | 对外暴露的端口号,不能跟内部端口重复,如果配置了 `KAFKA_CFG_ADVERTISED_LISTENERS` 则此项失效 | | `KAFKA_HEAP_OPTS` | `null` | Kafka Java Heap size. 例如: `-Xmx512m -Xms512m`| ## Kafka Configurations @@ -27,5 +27,3 @@ Variable examples: | `KAFKA_CFG_ADVERTISED_LISTENERS` | `advertised.listeners` | | `KAFKA_CFG_CONTROLLER_QUORUM_VOTERS` | `controller.quorum.voters` | | `KAFKA_CFG_LOG_RETENTION_HOURS` | `log.retention.hours` | - -> `log.dir` 和 `log.dirs` 已经被锁定,无法使用环境变量进行覆盖。 diff --git a/docs/helm.md b/docs/helm.md index 03ceb2f..6fbb631 100644 --- a/docs/helm.md +++ b/docs/helm.md @@ -35,19 +35,21 @@ helm upgrade --install kafka \ kafka-repo/kafka ``` -### 将 broker 和 controller 分开部署 +### 独立部署 controller 模块 + +生产环境推荐独立部署 controller 模块, 方便 broker 横向扩缩容。 ``` shell helm upgrade --install kafka \ --namespace kafka-demo \ --create-namespace \ - --set broker.combinedMode.enabled="false" \ + --set controller.enabled="true" \ --set controller.replicaCount="1" \ --set broker.replicaCount="1" \ kafka-repo/kafka ``` -> `broker.combinedMode.enabled` 混部模式,即进程同时具有 broker + controller 角色,单节点服务器启动一个 Pod 即可。`kafka-repo/kafka` 默认开启混部,`kafka-repo/kafka-ha` 默认关闭混部。 +> `kafka-repo/kafka` 默认关闭 controller 独立部署,`kafka-repo/kafka-ha` 默认开启。 ### 部署高可用集群 @@ -98,4 +100,16 @@ broker: ## 集群外访问 -请参考 +```yaml +## NodePort example +broker: + external: + enabled: true + service: + type: "NodePort" + annotations: {} + autoDiscovery: + enabled: true +``` + +更多集群外案例请参考 diff --git a/docs/index.md b/docs/index.md index 2a025b8..f999d96 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,14 +2,3 @@ - [GitHub](https://github.com/itboon/kafka-helm) - [Docker Hub](https://hub.docker.com/r/kafkace/kafka) - -## 关于 Apache Kafka - -[Apache Kafka](https://kafka.apache.org/) 是一个开源分布式事件流平台,已被数千家公司用于高性能数据管道、流分析、数据集成和关键任务应用程序。 - -## 为何选择这个镜像 - -- 全面兼容 `KRaft`, 不依赖 ZooKeeper -- 灵活使用环境变量进行配置覆盖 -- 上手简单 -- 提供 `helm chart`,你可以在 Kubernetes 快速部署高可用 Kafka 集群 diff --git a/docs/network.md b/docs/network.md deleted file mode 100644 index 58327eb..0000000 --- a/docs/network.md +++ /dev/null @@ -1,47 +0,0 @@ -# Kafka 高级网络配置 - - -``` yaml -version: "3" - -volumes: - kafka-data: {} - -services: - kafka: - image: kafkace/kafka:v3.5.2 - # restart: always - ports: - - "29092:29092" - volumes: - - kafka-data:/opt/kafka/data - environment: - - KAFKA_HEAP_OPTS=-Xmx1024m -Xms1024m - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=INTERNAL - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT - - KAFKA_CFG_LISTENERS=CONTROLLER://:9091,INTERNAL://:9092,EXTERNAL://:29092 - ## 将下面 ${KAFKA_BROKER_EXTERNAL_HOST} 替换成你自己的外部主机名,可以是域名或IP地址 - - KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://:9092,EXTERNAL://${KAFKA_BROKER_EXTERNAL_HOST}:29092 - - KAFKA_CFG_NODE_ID=1 - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@kafka:9091 - - ## kafka web 管理 (可选) - kafka-ui: - image: provectuslabs/kafka-ui:v0.7.1 - # restart: always - ports: - - "18080:8080" - environment: - - KAFKA_CLUSTERS_0_NAME=kafka-demo - - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 - #- KAFKA_CLUSTERS_0_READONLY=true - -### 内部网络 -## broker 默认内部端口 9092 -## bootstrap-server: kafka:9092 - -### 外部网络 -## broker 默认外部端口 29092 -## bootstrap-server: ${KAFKA_BROKER_EXTERNAL_HOST}:29092 - -```