版本: kafka_2.13-3.2.1
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
requireClientAuthScheme=sasl
jaasLoginRenew=3600000
Server {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin123"
user_admin="admin123"
user_zkclient="zkclient123";
};
admin 是zk之间使用的
zkclient是broker与zk之间使用的
vi /bin/zookeeper-server-start.sh
export KAFKA_OPTS="-Djava.security.auth.login.config=/$path/kafka_2.13-3.2.1/config/zookeeper_jaas.conf -Dzookeeper.sasl.serverconfig=Server"
./bin/zookeeper-server-start.sh config/zookeeper.properties
listeners=SASL_PLAINTEXT://:9092
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN
advertised.listeners=SASL_PLAINTEXT://:9092
auto.create.topics.enable=true
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="kafkaadmin"
password="kafkaadmin123"
user_kafkaadmin="kafkaadmin123"
user_kafkatest="kafkatest000";
};
Client {
org.apache.zookeeper.server.auth.DigestLoginModule required
username="zkclient"
password="zkclient123";
};
vi bin/kafka-server-start.sh
export KAFKA_OPTS=" -Djava.security.auth.login.config=/$path/kafka_2.13-3.2.1/config/kafka_server_jaas.conf"
./bin/kafka-server-start.sh ./config/server.properties
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="kafkaadmin" \
password="kafkaadmin123";
security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN
此处使有kafkaadmin 和kafkatest 都行
./bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092 --command-config ./config/kafka_client.conf
./bin/kafka-topics.sh --describe --topic quickstart-events --bootstrap-server localhost:9092 --command-config ./config/kafka_client.conf
后续自行玩耍各种参数