Open xuanyuanaosheng opened 3 hours ago
Kafka 支持 SCRAM-SHA-256 和 SCRAM-SHA-512,可以与 TLS 一起使用以执行安全认证。用户名作为被认证的主体用于 ACL 等的配置。Kafka 中的默认 SCRAM 实现将 SCRAM 凭据存储在 Zookeeper 中,适用于 Zookeeper 位于私有网络的 Kafka 安装。
## Create broker user (or admin user)
# kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[password=xxxxxxxx],SCRAM-SHA-512=[password=xxxxxxxx]' --entity-type users --entity-name admin
2. 配置 Kafka 代理
KafkaServer {
org.apache.kafka.common.security.scram.ScramLoginModule required
username="admin"
password="xxxxxxxx";
listeners=SASL_PLAINTEXT://server1:9092
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256
sasl.enabled.mechanisms=SCRAM-SHA-256
advertised.listeners=SASL_PLAINTEXT://server1:9092
allow.everyone.if.no.acl.found=false
super.users=User:admin
### 配置ACL
3. 查看和删除用户
架构
安装
一般Kafka集群是由zookeeper集群和kafka集群组成。Kafka集群一般需要3个节点。
安装zookeeper集群
安装kafka集群
安装管理软件
通过上面的步骤,Kafka集群已经安装完毕,接下来根据情况安装对应的管理软件
Kafka集群常用的命令
Kafka的监控
Kafka集群的升级
更新kafka只需更新二进制包,配置方面无需更改。
Kafka的备份
由于 Kafka 不存储对数据完整性要求很高的数据,所以只需备份 Kafka 和 Zookeeper 的配置文件。
Kafka集群的灾备切换
这两个 Kafka 集群会向配置中心请求 DCleader 和 DCFollower 的状态,并处理领导者和追随者的变动。
生产者
消费者