下载响应包,进行解压
新建jass.conf如zookeeper与kafka都需要用到
分别将该文件复制到zookeeper与kafka相应配置文件同级
KafkaServer{ org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="ss" user_admin="ss" user_reader="reader" user_writer="writer"; }; KafkaClient { org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="ss"; };zookeeper配置如下
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/root/app/zk_data # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 #server.1=casic.zookeeper1.com:2888:3888 #server.2=casic.zookeeper2.com:2888:3888 #server.3=casic.zookeeper3.com:2888:3888bin目录下新建java.env文件
export SERVER_JVMFLAGS="-Djava.security.auth.login.config=/home/app/Zookeeper/apache-zookeeper-3.6.1-bin/conf/zk_jaas.conf"lib包复制
cp如下文件至zookeeper 中的lib包中
kafka-clients-3.0.0.jar
lz4-java-1.7.1.jar
slf4j-api-1.7.30.jar
slf4j-log4j12-1.7.30.jar
snappy-java-1.1.8.1.jar
# Licensed to the Apache Software Foundation (ASF) under one or more # limitations under the License. # see kafka.server.KafkaConfig for additional details and defaults ############################# Server Basics ############################# # The id of the broker. This must be set to a unique integer for each broker. broker.id=0 ############################# Socket Server Settings ############################# # The address the socket server listens on. It will get the value returned from # java.net.InetAddress.getCanonicalHostName() if not configured. # FORMAT: # listeners = listener_name://host_name:port # EXAMPLE: # listeners = PLAINTEXT://your.host.name:9092 实际端口号 listeners=SASL_PLAINTEXT://0.0.0.0:9092 #advertised.listeners=PLAINTEXT://your.host.name:9092 # 请求端口号 advertised.listeners=SASL_PLAINTEXT://casic.kafka1.com:20104 advertised.host.name=casic.kafka1.com #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL listener.security.protocol.map=SASL_PLAINTEXT:SASL_PLAINTEXT security.inter.broker.protocol=SASL_PLAINTEXT sasl.mechanism.inter.broker.protocol=PLAIN sasl.enabled.mechanisms=PLAIN allow.everyone.if.no.acl.found=true auto.create.topics.enable=true super.users=User:admin # The number of threads that the server uses for receiving requests from the network and sending responses to the network num.network.threads=3 # The number of threads that the server uses for processing requests, which may include disk I/O num.io.threads=8 # The send buffer (SO_SNDBUF) used by the socket server socket.send.buffer.bytes=102400 # The receive buffer (SO_RCVBUF) used by the socket server socket.receive.buffer.bytes=102400 # The maximum size of a request that the socket server will accept (protection against OOM) socket.request.max.bytes=104857600 ############################# Log Basics ############################# # A comma separated list of directories under which to store log files log.dirs=/tmp/kafka-logs # The default number of log partitions per topic. More partitions allow greater # parallelism for consumption, but this will also result in more files across # the brokers. num.partitions=1 # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown. # This value is recommended to be increased for installations with data dirs located in RAID array. num.recovery.threads.per.data.dir=1 ############################# Internal Topic Settings ############################# # The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state" # For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3. offsets.topic.replication.factor=1 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 # The minimum age of a log file to be eligible for deletion due to age log.retention.hours=168 # A size-based retention policy for logs. Segments are pruned from the log unless the remaining # segments drop below log.retention.bytes. Functions independently of log.retention.hours. #log.retention.bytes=1073741824 # The maximum size of a log segment file. When this size is reached a new log segment will be created. log.segment.bytes=1073741824 # The interval at which log segments are checked to see if they can be deleted according # to the retention policies log.retention.check.interval.ms=300000 ############################# Zookeeper ############################# # Zookeeper connection string (see zookeeper docs for details). # This is a comma separated host:port pairs, each corresponding to a zk # server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002". # You can also append an optional chroot string to the urls to specify the # root directory for all kafka znodes. zookeeper.connect=casic.zookeeper1.com:2181 # Timeout in ms for connecting to zookeeper zookeeper.connection.timeout.ms=18000 ############################# Group Coordinator Settings ############################# group.initial.rebalance.delay.ms=0修改kafka启动文件kafka-server-start.sh
if [ $# -lt 1 ]; then echo "USAGE:$EXTRA_ARGS -Djava.security.auth.login.config=/home/app/kafka_2.13-3.0.0/config/jaas.conf kafka.Kafka[-daemon] server.properties [--override property=value]*" exit 1 fi base_dir=$(dirname./zkServer.sh start ./kafka-server-start.sh -daemon ../config/server.properties) if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties" fi if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" fi EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'} COMMAND= case $COMMAND in -daemon) EXTRA_ARGS="-daemon "$EXTRA_ARGS shift ;; *) ;; esac exec $base_dir/kafka-run-class.sh $EXTRA_ARGS -Djava.security.auth.login.config=/home/app/kafka_2.13-3.0.0/config/jaas.conf kafka.Kafka "$@"
主要增加
启动服务欢迎分享,转载请注明来源:内存溢出
评论列表(0条)