linux系统kafka集群搭建(3个节点192.168.204.128、192.168.204.129、192.168.204.130)
    本篇文章kafka集群采用外部zookeeper,没采用自带zookeeper
1、创建文件夹/usr/local/kafka,下载kafka2.11-2.0.0至/usr/local/kafka,解压重命名为kafka;
2、进入kafka文件中的config,即/usr/local/kafka/kafka/config, 编辑文件server.properties
        #############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=PLAINTEXT://:9092
        # Hostname and port the broker will advertise to producers and consumers. If not set,
        # it uses the value for "listeners" if configured.  Otherwise, it will use the value
        # returned from java.net.InetAddress.getCanonicalHostName().
        #advertised.listeners=PLAINTEXT://your.host.name:9092
        # Maps listener names to security protocols, .......
        #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,......
        # The number of threads that the server uses for receiving ......
        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=/var/log/kafka
        # 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 for to
        # ensure availability such as 3.
        offsets.topic.replication.factor=1
        transaction.state.log.replication.factor=1
        transaction.state.log.min.isr=1
        ########Log Retention Policy ##########
        # The following configurations control the disposal of log segments. The policy can
        # be set to delete segments after a period of time, or after a given size has accumulated.
        # A segment will be deleted whenever *either* of these......
        # from the end of the log.
        # 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集群的连接
        # (本篇的zookeeper集群3个节点分别为192.168.204.128、192.168.204.129、192.168.204.130)
        zookeeper.connect=192.168.204.128:2181,192.168.204.129:2181,192.168.204.130:2181
        # Timeout in ms for connecting to zookeeper
        # 与zookeeper连接超时时间
        zookeeper.connection.timeout.ms=6000
        # 该值最好设置大于15000,否则kafka某个节点可能会连不上zookeeper,sessionTimeout
        zookeeper.session.timeout.ms=25000
        ############ Group Coordinator Settings ###########
        # The following configuration specifies the time, in milliseconds, that the GroupCoordinator
        # will delay the initial consumer rebalance.
        # The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members ...
        # The default value for this is 3 seconds.
        # We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
        # However, in production environments the default value of 3 seconds is more suitable as this will help to

#   avoid unnecessary, and potentially expensive, rebalances during application startup.
        group.initial.rebalance.delay.ms=0
3、开启防火墙
      在防火墙中增加端口项vi /etc/sysconfig/iptables
          -A INPUT -m state --state NEW -m tcp -p tcp --dport 9092 -j ACCEPT
     然后重启防火墙 service iptables restart
4、配置环境变量
      在 /etc/profile 中添加如下配置:
      vi  etc/profile 在最后添加如下两个。
      export KAFKA_HOME=/usr/local/kafka/kafka
      export PATH=$PATH:$KAFKA_HOME/bin
   保存后进入cd /etc目录下,输入source profile命令使修改生效。
5、在其它两个节点作上述同样操作,记得server.properties文件中的broker.id要不一样,
      同时在/var/log/中创建文件夹kafka。
6、进入每个节点的/usr/local/kafka/kafka/bin/
      输入./kafka-server-start.sh ../config/server.properties &
      即启动kafka节点,出现如下,则成功启动
      ........
         [2018-10-11 20:22:17,663] INFO [TransactionCoordinator id=0] Starting up.
      (kafka.coordinator.transaction.TransactionCoordinator)
      [2018-10-11 20:22:17,681] INFO [TransactionCoordinator id=0] Startup complete.
      (kafka.coordinator.transaction.TransactionCoordinator)
      [2018-10-11 20:22:17,708] INFO [Transaction Marker Channel Manager 0]: Starting
      (kafka.coordinator.transaction.TransactionMarkerChannelManager)
      [2018-10-11 20:22:18,159] INFO [/config/changes-event-process-thread]: Starting
      (kafka.common.ZkNodeChangeNotificationListener$ChangeEventProcessThread)
      [2018-10-11 20:22:18,185] INFO [SocketServer brokerId=0] Started processors for 1 acceptors
      (kafka.network.SocketServer)
      [2018-10-11 20:22:18,203] INFO Kafka version : 2.0.0 (org.apache.kafka.common.utils.AppInfoParser)
      [2018-10-11 20:22:18,204] INFO Kafka commitId : 3402a8361b734732
      (org.apache.kafka.common.utils.AppInfoParser)
      [2018-10-11 20:22:18,219] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

消息队列kafka集群搭建的更多相关文章

  1. 消息队列之 kafka 集群搭建

    我们先弄清楚kafka集群环境首先需要些什么 JDK 10+ Zookeeper Kafka 2.x 首先准备三台虚拟机 centos7 ,更改IP地址为静态地址分别为,29.30.31 cd /et ...

  2. Kafka【第一篇】Kafka集群搭建

    Kafka初识 1.Kafka使用背景 在我们大量使用分布式数据库.分布式计算集群的时候,是否会遇到这样的一些问题: 我们想分析下用户行为(pageviews),以便我们设计出更好的广告位 我想对用户 ...

  3. 【转】kafka集群搭建

    转:http://www.cnblogs.com/luotianshuai/p/5206662.html Kafka初识 1.Kafka使用背景 在我们大量使用分布式数据库.分布式计算集群的时候,是否 ...

  4. zookeeper与Kafka集群搭建及python代码测试

    Kafka初识 1.Kafka使用背景 在我们大量使用分布式数据库.分布式计算集群的时候,是否会遇到这样的一些问题: 我们想分析下用户行为(pageviews),以便我们设计出更好的广告位 我想对用户 ...

  5. kafka学习(三)-kafka集群搭建

    kafka集群搭建 下面简单的介绍一下kafka的集群搭建,单个kafka的安装更简单,下面以集群搭建为例子. 我们设置并部署有三个节点的 kafka 集合体,必须在每个节点上遵循下面的步骤来启动 k ...

  6. 大数据 --> Kafka集群搭建

    Kafka集群搭建 下面是以三台机器搭建为例,(扩展到4台以上一样,修改下配置文件即可) 1.下载kafka http://apache.fayea.com/kafka/0.9.0.1/ ,拷贝到三台 ...

  7. Kafka 集群搭建 (自用)

    Zookeeper集群搭建 1.软件环境 (3台服务器-测试环境) 192.168.56.9 192.168.56.6 192.168.56.7 1.Linux服务器一台.三台.五台.(2*n+1), ...

  8. Linux下kafka集群搭建过程记录

    环境准备 zookeeper集群环境kafka是依赖于zookeeper注册中心的一款分布式消息对列,所以需要有zookeeper单机或者集群环境. 三台服务器: 172.16.18.198 k8s- ...

  9. Linux下kafka集群搭建

    环境准备 zookeeper集群环境 kafka是依赖于zookeeper注册中心的一款分布式消息对列,所以需要有zookeeper单机或者集群环境. 三台服务器: 172.16.18.198 k8s ...

随机推荐

  1. Jvm类的加载机制

    1.概述 虚拟机加载Class文件(二进制字节流)到内存,并对数据进行校验.转换解析和初始化,最终形成可被虚拟机直接使用的Java类型,这一系列过程就是类的加载机制. 2.类的加载时机 类从被虚拟机加 ...

  2. 四、ConcurrentHashMap 锁分段机制

    回顾: HashMap与Hashtable的底层都是哈希表,但是 HashMap:线程不安全 Hashtable:线程安全,但是效率非常低,且存在[复合操作](如"若存在则删除") ...

  3. 201806 数据处理 SQL、python、shell 哪家强...速度PK(上篇)

    最近在工作中,进行大量的数据处理,使用的是mysql5.7.22,发现当数据量级达到几十万之后,SQL执行速度明显变慢.尤其是当多个表join时,于是就尝试用python pandas进行数据处理,发 ...

  4. Git Learning2 GitHub upload

    1.在自己的github上创建一个仓库 2.git remote add [name] [link] 使用git来增加一个link的别名 3.git push [linkname] [分支名] 4.g ...

  5. [名词解释 ] transparent

    1.材质,效果透明. 2.思想透明,容易获取(思维简单,单纯) 3.后台静默(of a process or interface) functioning without the user being ...

  6. [数据结构] 2.7 Heap 堆

    * 注: 本文/本系列谢绝转载,如有转载,本人有权利追究相应责任. 1.堆是什么? (如图所示是一个小堆) 1)堆是一颗完全二叉树,它的最后一层不是满的,其他每一层都是满的,最后一层从左到右也没有空隙 ...

  7. 解决Git Revert操作后再次Merge代码被冲掉的问题

    转:https://blog.csdn.net/paul_wei2008/article/details/77477932 https://blog.csdn.net/cxn945/article/d ...

  8. vue页面传值

    第一种情况:例:消息列表页(路由)跳转: methods: { goTo(){ this.$router.push({ name:'/My/Info', query:{ 'tellSeq':this. ...

  9. linux bash array list

    #定义array ptpArray=()while read linedo #将文件读取内容放到array中,注意作为字符串放,否则空格会被分隔成行ptpArray+=("$line&quo ...

  10. react .net core 发布 Access-Control-Allow-Origin Cors

    本案例用IIS部署 1. 在react上先publish: npm run build 生成了build文件,在此文件里添加web.config,注意httpProtocol是用来跨域的. <? ...