首页 > 其他 > 详细

搭建kafka消息队列

时间:2019-03-07 12:40:37      阅读:142      评论:0      收藏:0      [点我收藏+]

需要先搭建zookeeper 协助其做容灾 选举等工作

搭建zookeeper流程如下

 

Install the Java JDK. You can use the native packaging system for your system, or download the JDK from

下载jdk 用wget装jdk wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

然后 tar -zxvf 解压  安装oscent jdk自己百度。

 

  1. Set the Java heap size. This is very important to avoid swapping, which will seriously degrade ZooKeeper performance. To determine the correct value, use load tests, and make sure you are well below the usage limit that would cause you to swap. Be conservative - use a maximum heap size of 3GB for a 4GB machine.

  2. Install the ZooKeeper Server Package. It can be downloaded from:

    zk包 也可用wget装

  3. Create a configuration file. This file can be called anything. Use the following settings as a starting point:

    tickTime=2000
    dataDir=/var/lib/zookeeper/  /**这里不放data*/
    clientPort=2181
    initLimit=5
    syncLimit=2
    server.1=zoo1:2888:3888
    server.2=zoo2:2888:3888
    server.3=zoo3:2888:3888

    You can find the meanings of these and other configuration settings in the section Configuration Parameters. A word though about a few here:

    Every machine that is part of the ZooKeeper ensemble should know about every other machine in the ensemble. You accomplish this with the series of lines of the form server.id=host:port:port. The parameters host and port are straightforward. You attribute the server id to each machine by creating a file named myid, one for each server, which resides in that server‘s data directory, as specified by the configuration file parameter dataDir.

    在dataDir路径下创建一个${dataDir}/data/myid文件 里面指定的数字 对应自己的server.后面的数字    

  1. The myid file consists of a single line containing only the text of that machine‘s id. So myid of server 1 would contain the text "1" and nothing else. The id must be unique within the ensemble and should have a value between 1 and 255.

  2. If your configuration file is set up, you can start a ZooKeeper server:

    $ java -cp zookeeper.jar:lib/slf4j-api-1.6.1.jar:lib/slf4j-log4j12-1.6.1.jar:lib/log4j-1.2.15.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.cfg

    QuorumPeerMain starts a ZooKeeper server, JMX management beans are also registered which allows management through a JMX management console. The ZooKeeper JMX document contains details on managing ZooKeeper with JMX.//上面的内容 放置到conf/zoo.cfg中。

  3. See the script bin/zkServer.sh, which is included in the release, for an example of starting server instances. //启动zk bin目录下 ./zkServer.sh start

  4. ./zkServer.sh status的状态 是
  5. 技术分享图片

     

  6. Test your deployment by connecting to the hosts:

    In Java, you can run the following command to execute simple operations:

    $ bin/zkCli.sh -server 127.0.0.1:2181 //./zkCli.sh -server 127.0.0.1:2181

搭建kafka消息队列

原文:https://www.cnblogs.com/tecnologycc/p/10488836.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!