kafka 3.3.1 kraft server.properties 如何配置SASL_PLANTEXT
时间: 2025-01-02 20:45:18 浏览: 34
在Kafka 3.3.1版本中,如果你想要启用SASL PLAINTEXT安全模式,你需要在`server.properties`文件中进行以下配置:
1. **启用SASL支持**:
```properties
security.inter.broker.protocol=SASL_PLAINTEXT
```
2. **配置SASL机制**:
SASL PLAINTEXT支持的是未加密的简单身份验证,所以不需要特定的机制,但需要将`sasl.mechanism.inter.broker.protocol`设为`PLAIN`,默认就是如此。
3. **配置SASL客户端认证**:
如果你的客户端也需要使用SASL PLAINTEXT,你需要创建一个Jaas配置文件,例如`jaas-server.conf`:
```properties
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required username="your_username" password="your_password";
}
```
然后在`server.properties`中指定该Jaas配置文件的位置:
```properties
sasl.kerberos.login.conf=/path/to/your/jaas-server.conf
```
4. **配置SASL密码**:
如果你在生产环境中使用,你可能需要提供Kafka服务端使用的SASL用户名和密码,通常通过环境变量设置,如:
```bash
export KAFKA_SASL_JAAS_CONFIG="org.apache.kafka.common.security.plain.PlainLoginModule required username=\"your_username\" password=\"your_password\";";
```
5. **启动服务**:
完成上述配置后,重启Kafka服务使其应用新的配置。
注意:在生产环境中,建议使用更安全的SASL机制,如SASL_SSL,而不是SASL_PLAINTEXT,除非你确定所有节点之间的网络都是私有且安全的。
阅读全文
相关推荐















