CentOS上Kafka的安全設置主要包括以下方面:
server.properties中設置security.protocol為sasl_plaintext或sasl_ssl,并配置sasl.mechanism(如PLAIN、SCRAM-SHA-256等),需創建JAAS配置文件(如kafka_server_jaas.conf)。ssl.truststore.location、ssl.keystore.location等參數,使用security.protocol=ssl。kafka-acls.sh工具通過ACL限制用戶對Topic的訪問權限,配置authorizer.class.name為SimpleAclAuthorizer。min.insync.replicas確保數據可靠性(如≥2)。firewall-cmd開放Kafka端口(默認9092/9093),建議部署在VPC或專用子網中。chattr保護口令文件。unclean.leader.election.enable參數,防止非ISR副本成為Leader導致數據丟失。參考來源: