• kafka集群部署


    1.安装好zookeeper集群

    2.下载kafaka安装包,上传到服务器并解压

    wget https://archive.apache.org/dist/kafka/0.8.2.2/kafka_2.11-0.8.2.2.tgz
    scp kafka_2.11-0.8.2.2.tgz mini1:/root/apps/
    tar -zxvf /kafka_2.11-0.8.2.2.tgz -C install
    mv /kafka_2.11-0.8.2.2 kafka
    

    3.配置环境变量

    vim /etc/profile
    export KAFKA_HOME=/root/apps/install/kafka
    export PATH=$PATH:$KAFKA_HOME/bin
    

    4.修改配置文件

    改三处,分别是broker_id,log_dirs,host.name以及zookeeper地址

    vim /root/apps/install/kafka/config/server.properties
    
    
    ############################# Server Basics #############################
    #每台机器的brocker.id要不同
    broker.id=0
    
    ############################# Socket Server Settings #############################
    
    port=9092
    
    #host.name=localhost
    
    num.network.threads=2
    
    num.io.threads=2
    
    socket.send.buffer.bytes=1048576
    
    socket.receive.buffer.bytes=1048576
    
    socket.request.max.bytes=104857600
    
    
    ############################# Log Basics #############################
    
    #自定义一个日志目录
    log.dirs=/root/apps/install/kafka/kafka-logs
    
    num.partitions=2
    
    ############################# Log Flush Policy #############################
    log.flush.interval.messages=10000
    
    log.flush.interval.ms=1000
    
    ############################# Log Retention Policy #############################
    
    log.retention.hours=168
    
    #log.retention.bytes=1073741824
    
    log.segment.bytes=536870912
    
    log.cleanup.interval.mins=1
    
    ############################# Zookeeper #############################
    #zookeeper集群地址
    zookeeper.connect=mini1:2181,mini2:2181,mini3:2181
    
    zookeeper.connection.timeout.ms=1000000
    
    host.name=localhost
    

    5.分发

    scp -r kafka mini2:/root/apps/install/
    scp -r kafka mini3:/root/apps/install/ 
    scp -r kafka mini4:/root/apps/install/
    
    scp /etc/profile mini2:/etc/
    source /etc/profile
    scp /etc/profile mini3:/etc/
    source /etc/profile
    scp /etc/profile mini4:/etc/
    source /etc/profile
    

    6.启动与关闭

    #启动
    kafka-server-start.sh /root/apps/install/kafka/config/server.properties &
    
    #关闭
    pkill -9 -f server.properties
  • 相关阅读:
    java中商业数据计算时用到的类BigDecimal和DecimalFormat
    Git和SVN之间的区别
    ubuntu 交叉编译arm linux 内核小例子
    交叉编译工具链介绍《Building Embedded Linux Systems》
    交叉编译工具链命名详解
    oracle数据库分页总结
    oracle随机数(转)
    oracle函数nvl, nvl2, nullif
    反转数字, 即输入123, 返回321
    java试题
  • 原文地址:https://www.cnblogs.com/52mm/p/p22.html
Copyright © 2020-2023  润新知