Title

kafka04-单机部署1.0.4

1 前提准备

1.1 jdk及环境变量

[root@lew1 ~]# java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

1.2 zookeeper及环境变量

[root@lew1 ~]# echo stat|nc localhost 2181
Zookeeper version: 3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf, built on 03/06/2019 16:18 GMT
Clients:
 /0:0:0:0:0:0:0:1:51420[0](queued=0,recved=1,sent=0)
Latency min/avg/max: 0/0/0
Received: 2
Sent: 1
Connections: 1
Outstanding: 0
Zxid: 0x900000002
Mode: follower
Node count: 43

2 kafka安装

下载链接

  • 上传解压

    [root@lew1 src]# tar kafka_2.12-1.0.2.tgz -C ../app/
    # 创建软连接
    [root@lew1 app]# cd /opt/app/
    [root@lew1 app]# ln -s kafka_2.12-1.0.2 kafka
    
  • 环境变量配置

    vi /etc/profile

    export KAFKA_HOME=/opt/app/kafka
    export PATH=$PATH:$KAFKA_HOME/bin
    
    [root@lew1 app]# source /etc/profile
    
  • kafka配置

    vi /opt/app/kafka/config/server.properties

    持久化目录位置

    log.dirs=/data/kafka/kafka-logs
    
    #创建目录
    mkdir -p /data/kafka/kafka-logs
    
  • 启动方式

    • 独占模式

      [root@lew1 app]# kafka-server-start.sh /opt/app/kafka/config/server.properties 
      [2021-08-15 17:13:05,040] INFO KafkaConfig values: 
      	advertised.host.name = null
      	advertised.listeners = null
      	advertised.port = null
      	alter.config.policy.class.name = null
      	authorizer.class.name = 
      	auto.create.topics.enable = true
      	auto.leader.rebalance.enable = true
      	background.threads = 10
      	broker.id = 0
      	broker.id.generation.enable = true
      ....
      [2021-08-15 17:13:06,987] WARN No meta.properties file under dir /data/kafka/kafka-logs/meta.properties (kafka.server.BrokerMetadataCheckpoint)
      [2021-08-15 17:13:07,017] INFO [SocketServer brokerId=0] Started processors for 1 acceptors (kafka.network.SocketServer)
      [2021-08-15 17:13:07,025] INFO Kafka version : 1.0.2 (org.apache.kafka.common.utils.AppInfoParser)
      [2021-08-15 17:13:07,025] INFO Kafka commitId : 2a121f7b1d402825 (org.apache.kafka.common.utils.AppInfoParser)
      [2021-08-15 17:13:07,038] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)
      
      
    • daemon模式

      [root@lew1 app]# kafka-server-start.sh -daemon  /opt/app/kafka/config/server.properties 
      [root@lew1 app]# jps
      1507 QuorumPeerMain
      954 -- process information unavailable
      2206 Kafka
      2270 Jps
      
  • 测试

    当前刚安装kafka,topic为空,命令不报错则无问题

    [root@lew1 app]# kafka-topics.sh --zookeeper lew1:2181 --list
    [root@lew1 app]# 
    
posted @ 2021-08-15 18:08  apeGcWell  阅读(48)  评论(0编辑  收藏  举报