Kafka萨斯勒/快滚

flvtvl50  于 2021-06-05  发布在  Kafka
关注(0)|答案(0)|浏览(238)

就在那天,我已经连续尝试为Kafka配置sasl/scram,但都没有成功。我将感谢所有能帮助我的人。我有Kafka2.5.0版-https://www.apache.org/dyn/closer.cgi?path=/kafka/2.5.0/kafka_2.12-2.5.0.tgz我还有最新版本的zookeeper-https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
首先,我设置了zoo.cfg,如下所示:

dataDir=/home/duck/Public/zookeeper_logs
maxClientCnxns=0
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
requireClientAuthScheme=sasl
jaasLoginRenew=3600000

接下来,我创建了一个zookeeper jaas文件:
zookeeper\ u jaas.conf文件

Server {
   org.apache.kafka.common.security.scram.ScramLoginModule required
   username="admin"
   password="admin-secret"
   user_admin="admin-secret";
};
QuorumServer {
       org.apache.zookeeper.server.auth.DigestLoginModule required
       user_admin="admin-secret";
};

QuorumLearner {
       org.apache.zookeeper.server.auth.DigestLoginModule required
       username="admin"
    password="admin-secret"
    user_admin="admin-secret";
};

接下来,我设置jvm:server_jvmflags=“-djava.security.auth.login.config=/home/duck/public/zookeeper/zk_jaas.conf”,然后启动zookeeper:$zkhome/bin/skserver.sh start
接下来,我为Kafka创建了一个jaas文件:
Kafka\服务器\ jaas.conf:

KafkaServer {
   org.apache.kafka.common.security.scram.ScramLoginModule required
   username="admin"
   password="admin-secret"
   user_admin="admin-secret";
};

Client {
   org.apache.kafka.common.security.scram.ScramLoginModule required
   username="admin"
   password="admin-secret";
};

在我处决之后:

export KAFKA_OPTS="-Djava.security.auth.login.config=/home/duck/Public/kafka/config/kafka_server_jaas.conf"

kafka broker的设置如下:
服务器属性


############################# Server Basics #############################

# The id of the broker. This must be set to a unique integer for each broker.

broker.id=0

# Use below for SASL/SCRAM only (No SSL)

# For rest of the brokers change port (highlighted below) to 9091 and 9092

# Using SASL_PLAINTEXT as we do not have SSL

listeners=SASL_PLAINTEXT://localhost:9092
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256
sasl.enabled.mechanisms=SCRAM-SHA-256

############################# Socket Server Settings #############################

num.network.threads=3
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600

############################# Log Basics #############################

log.dirs=/tmp/kafka-logs
num.partitions=1
num.recovery.threads.per.data.dir=1

############################# Internal Topic Settings  #############################

offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1

############################# Log Retention Policy #############################

log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000

############################# Zookeeper #############################

zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=18000

如果有关系的话,我使用java-13在完成所有设置后,kafka服务器启动,甚至工作一段时间,之后它会生成以下类型的错误:
[2020-06-03 20:23:30096]信息客户端environment:java.io.tmpdir=/tmp (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30097]信息客户端environment:java.compiler= (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30097]信息客户端environment:os.name=linux (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30,097]信息客户端environment:os.arch=amd64 (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30097]信息客户端environment:os.version=5.3.0-55-generic (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30097]信息客户端environment:user.name=duck (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30,097]信息客户端environment:user.home=/home/duck (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30097]信息客户端environment:user.dir=/home/duck/public/kafka (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30097]信息客户端environment:os.memory.free=980mb (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30,097]信息客户端environment:os.memory.max=1024mb (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30098]信息客户端environment:os.memory.total=1024mb (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30101]启动客户端连接的信息,连接字符串=localhost:2181 sessiontimeout=18000 watcher=kafka.zookeeper。zookeeperclient$zookeeperclientwatcher$@24105dc5 (org.apache.zookeeper.zookeeper)[2020-06-03 20:23:30108]info jute.maxbuffer值为4194304字节(org.apache.zookeeper.clientcnxnsocket)[2020-06-03 20:23:30116]info zookeeper.request.timeout值为0。feature enabled=(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:30120]信息[zookeeperclient kafka server]等待连接(kafka.zookeeper.zookeeperclient)[2020-06-03 20:23:30187]信息客户端已成功登录(org.apache.zookeeper.login)[2020-06-03 20:23:30190]信息客户端将使用digest-md5作为sasl机制(org.apache.zookeeper.client.zookeepersaslclient)[2020-06-03 20:23:30194]打开到服务器localhost的套接字连接的信息/127.0.0.1:2181。将尝试使用登录上下文节“client”(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:30202]信息套接字错误:localhost/127.0.0.1:2181:连接被拒绝(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:31307]信息客户端成功登录(org.apache.zookeeper.login)[2020-06-03 20:23:31307]信息客户端将使用digest-md5作为sasl机制(org.apache.zookeeper.client.zookeepersaslclient)[2020-06-03 20:23:31309]打开到服务器localhost的套接字连接的信息/127.0.0.1:2181。将尝试使用登录上下文节“client”(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:31310]信息套接字进行sasl身份验证发生错误:localhost/127.0.0.1:2181:连接被拒绝(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:32413]信息客户端已成功登录(org.apache.zookeeper.login)[2020-06-03 20:23:32414]信息客户端将使用digest-md5作为sasl机制(org.apache.zookeeper.client.zookeepersaslclient)[2020-06-03 20:23:32415]打开到服务器localhost的套接字连接的信息/127.0.0.1:2181。将尝试使用登录上下文节“client”(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:32416]信息套接字错误:localhost/127.0.0.1:2181:连接被拒绝(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:33519]信息客户端已成功登录(org.apache.zookeeper.login)[2020-06-03 20:23:33519]信息客户端将使用digest-md5作为sasl机制(org.apache.zookeeper.client.zookeepersaslclient)[2020-06-03 20:23:33522]打开到服务器localhost的套接字连接的信息/127.0.0.1:2181。将尝试使用登录上下文节“client”(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:33523]进行sasl身份验证发生信息套接字错误:localhost/127.0.0.1:2181:连接被拒绝(org.apache.zookeeper.clientcnxn)
[2020-06-03 20:23:34626]信息客户端已成功登录(org.apache.zookeeper.login)[2020-06-03 20:23:34626]信息客户端将使用digest-md5作为sasl机制(org.apache.zookeeper.client.zookeepersaslclient)[2020-06-03 20:23:34628]打开到服务器localhost的套接字连接的信息/127.0.0.1:2181。将尝试使用登录上下文节“client”(org.apache.zookeeper.clientcnxn)[2020-06-03 20:23:34629]进行sasl身份验证发生信息套接字错误:localhost/127.0.0.1:2181:连接被拒绝(org.apache.zookeeper.clientcnxn)
[2020-06-03 20:23:35445]由于signal sigint(org.apache.kafka.common.utils.loggingsignalhandler)[2020-06-03 20:23:35450]关闭信息(kafka.server.kafkaserver)[2020-06-03 20:23:35455]关闭kafkaserver期间出现错误致命错误(kafka.server.kafkaserver)java.lang.illegalstateexception:kafka服务器仍在启动,无法关闭!在kafka.server.kafkaserver.shutdown(kafkaserver。scala:602)在kafka.server.kafkaserverstartable.shutdown(kafkaserverstartable。scala:54)在Kafka。Kafka$。$anonfun$main$3(Kafka。scala:80)在kafka.utils.exit$.$anonfun$addshutdownhook$1(exit。scala:38)在java.base/java.lang.thread.run(thread。java:830)[2020-06-03 20:23:35459]错误停止Kafka(kafka.server.kafkaserverstartable)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题