1. kafka ACL权限
1.1 要使用 Kafka ACL进行权限验证,要在server.properties 上添加配置(非常重要)
authorizer.class.name = kafka.security.auth.SimpleAclAuthorizer
1.2 创建topic并赋权限
kafka-topics.sh --create --zookeeper hadoop01:2181 --replication-factor 1 --partitions 1 --topic test1
kafka-acls.sh --authorizer-properties zookeeper.connect=localhost:2181 --operation Write --operation Read --allow-principal User:* --allow-host 192.168.8.91 --add --topic test1
1.3 为某个已存在的Topic赋予权限
bin/kafka-acls.sh --authorizer-properties zookeeper.connect=centos11:2181 --add --allow-principal User:Bob --allow-principal User:Alice --allow-host 198.51.100.0 --allow-host 198.51.100.1 --operation Read --operation Write --topic test
bin/kafka-acls.sh --authorizer-properties zookeeper.connect=centos11:2181 --remove --allow-principal User:Bob --allow-principal User:Alice --allow-host 198.51.100.0 --allow-host 198.51.100.1 --operation Read --operation Write --topic test
1.4 查看kafka中所有topic
权限
./kafka-acls.sh --authorizer-properties zookeeper.connect=node1:2181 --list