Kafka(三) CenterOs安装jdk,zookeeper,kafka以及相关配置

一.安装zookeeper


  1. 在线下载zookeeper 
    wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
  2. 解压该压缩包
    tar -zxvf zookeeper-3.4.14.tar.gz
  3.  启动zookeeper
    1.在zookeeper的目录中找到bin这个目录,zookeeper启动脚本就在这里。
    查看都有什么命令
    bin/zkServer.sh
    启动
    bin/zkServer.sh start

    注意:默认的/bin/../conf/zoo_sample.cfg,我们需要把这个文件重命名为zoo.cfg,不然启动不成功

    重命名
    mv zoo_sample.cfg zoo.cfg

     

  4. 查看启动是否成功,如下图表示已经启动成功

  5. 需要知道的zookeeper配置信息:

  • # The number of milliseconds of each tick
    #zk服务器的心跳时间
    tickTime=2000
    # The number of ticks that the initial
    # synchronization phase can take
    #投票选举新leader的初始化时间
    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=/tmp/zookeeper
    # the port at which the clients will connect
    #zk对外服务端口
    clientPort=2181
    # the maximum number of client connections.
    # increase this if you need to handle more clients
    #maxClientCnxns=60
    #
    # Be sure to read the maintenance section of the
    # administrator guide before turning on autopurge.
    #
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    #
    # The number of snapshots to retain in dataDir
    #autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    #autopurge.purgeInterval=1

linux下载安装zookeeper更详细地址


二.安装kafka


  • 下载kafka
  • wget https://mirror.bit.edu.cn/apache/kafka/2.4.1/kafka_2.13-2.4.1.tgz
  • 解压
  • tar -zxvf kafka_2.13-2.4.1.tgz
  • 修改配置
  • #表示broker的编号,如果集群中有多个broker,那么broker的编号需要设置的不同。
    broker.id=0
    #对外提供的服务入口地址
    listeners=PLAINTEXT://9092 brooder,
    #设置存放消息日志的文件地址
    log.dirs=/tmp/kafka/log
    #kafka所需要的zookeeper集群地址:
    zookeeper.connet=ip:2181
    
  • 启动
    bin/kafka-server-start.sh start config/server.properties 

    缺点:console关闭后,kafka也会被关闭,换为后台启动就可以了

  • 后台启动

  •  bin/kafka-server-start.sh -daemon config/server.properties

     

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值