kafka3.9 kraft sasl
时间: 2025-01-22 22:00:58 浏览: 112
### Kafka 3.9 KRaft Mode SASL Configuration and Setup Guide
#### Overview of KRaft Mode
Apache Kafka introduced the KRaft (Kafka Raft Metadata) protocol as an alternative to ZooKeeper for managing cluster metadata starting from version 2.8, with improvements continuing through later versions including 3.9. In this new mode, all brokers participate directly in electing leaders for partitions responsible for storing topic data and internal metadata.
#### Prerequisites Before Installation
Before proceeding with setting up a Kafka cluster using KRaft mode along with SASL security configurations:
- Ensure Java Development Kit is installed on each node.
- Verify network connectivity between nodes within the intended Kafka cluster.
- Confirm that firewalls allow traffic over required ports such as `9092` for client connections or `9093` when SSL/TLS encryption is enabled[^1].
#### Installing Kafka Without Zookeeper Support
To deploy Kafka without relying on ZooKeeper, download the appropriate tarball specifically built for KRaft operation instead of traditional packages which include dependencies on ZooKeeper services. For example:
```bash
wget https://archive.apache.org/dist/kafka/3.9.0/kafka_2.13-3.9.0.tar.gz
tar -xf kafka_2.13-3.9.0.tar.gz
cd kafka_2.13-3.9.0/
```
Modify the startup script similar to what was done previously but ensure paths point towards correct locations where JAAS files reside relative to your installation directory structure[^2]:
```bash
sed -i 's|exec $base_dir/kafka-run-class.sh.*$|exec $base_dir/kafka-run-class.sh \
-Djava.security.auth.login.config=$base_dir/config/kraft/server.properties \
kafka.Kafka "$@"|' bin/kafka-server-start.sh
```
#### Configuring Security Settings Using SASL Mechanisms
For securing communication channels among broker peers plus external clients connecting into topics hosted inside clusters running under KRaft control plane management, apply settings outlined below per server properties file located typically at `$KAFKA_HOME/config/kraft/server.properties`.
Enable listener authentication mechanisms by specifying desired protocols like PLAINTEXT/SASL_PLAINTEXT depending upon whether encrypted transport layer protection will be utilized alongside message-level confidentiality measures provided via GSSAPI/Kerberos tickets exchange mechanism or SCRAM-SHA algorithms family members supporting password-based exchanges securely authenticated against remote LDAP directories etc.[^4]:
```properties
listeners=SASL_PLAINTEXT://:9092
listener.name.sasl_plaintext.scram-sha-512.sasl.enabled.mechanisms=SCRAM-SHA-512
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512
authorizer.class.name=kafka.security.authorizer.AclAuthorizer
allow.everyone.if.no.acl.found=true
super.users=User:admin;User:kafka
```
Create corresponding entries inside `/etc/kafka/jaas.conf`, adjusting principal names according to actual usernames defined earlier during ACL rules creation process[^3]:
```conf
KafkaServer {
org.apache.kafka.common.security.scram.ScramLoginModule required
username="admin"
password="yourpassword";
};
Client {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="clientuser"
password="anothersecret";
};
```
After completing these steps restart affected daemons ensuring changes take effect properly before attempting any further operations involving producer/consumer applications interacting programmatically across secured endpoints established above.
--related questions--
1. How does one verify successful deployment after configuring Kafka Cluster in KRaft mode?
2. What are common pitfalls encountered while enabling SASL authentication methods on Apache Kafka installations?
3. Can you provide guidance regarding performance tuning parameters available once switching away from legacy ZooKeeper coordination service models toward modernized approaches offered since recent releases?
4. Is there support for mutual TLS verification combined together with other forms of access controls implemented through custom plugin extensions developed externally outside official distributions?
阅读全文
相关推荐


















