当前位置:   article > 正文

linux安装zookeeper和kafka_setting -d jdk.tls.rejectclientinitiatedrenegotiat

setting -d jdk.tls.rejectclientinitiatedrenegotiation=tru

        安装zookeeper和kafka之前,先检查是否安装java。如果没有,可以在如下链接中下载对应版本的jdk。

Java Downloads | Oracle

一、安装java

        我这里下载的是jdk-8u271-linux-x64.tar.gz,操作如下:

  1. [root@lucas src]# ll | grep jdk
  2. -rw-r--r-- 1 root root 143142634 Dec 30 10:23 jdk-8u271-linux-x64.tar.gz
  3. [root@lucas src]# tar -zxvf jdk-8u271-linux-x64.tar.gz
  4. ...
  5. [root@lucas src]# ll | grep jdk
  6. drwxr-xr-x 8 root root 4096 Sep 17 01:14 jdk1.8.0_271
  7. -rw-r--r-- 1 root root 143142634 Dec 30 10:23 jdk-8u271-linux-x64.tar.gz
  8. [root@lucas src]# mv jdk1.8.0_271 /usr/local/java
  9. [root@lucas src]# cd /usr/local/
  10. [root@lucas local]# ll | grep java
  11. drwxr-xr-x 8 root root 4096 Sep 17 01:14 java

        经过以上操作,java已经装好,下面就是在/etc/bashrc设置环境变量:

  1. export JAVA_HOME=/usr/local/java
  2. export PATH=$PATH:$JAVA_HOME/bin

        保存退出后,执行以下命令即可。

source /etc/bashrc

        此时可查看java版本:

  1. [root@lucas local]# java -version
  2. java version "1.8.0_271"
  3. Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
  4. Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

二、安装zookeeper

        zookeeper可从该页面下载:Apache ZooKeeper

       这里下载的是3.6.1_bin版本,操作如下:

  1. [root@lucas src]# wget https://archive.apache.org/dist/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
  2. [root@lucas src]# tar -zxvf apache-zookeeper-3.6.1-bin.tar.gz
  3. [root@lucas src]# mv ./apache-zookeeper-3.6.1-bin /usr/local/zookeeper
  4. [root@lucas local]# cd /usr/local/zookeeper/
  5. [root@lucas zookeeper]# mkdir data
  6. [root@lucas zookeeper]# cd ./conf/
  7. [root@lucas conf]# cp zoo_sample.cfg zoo.cfg
  8. [root@ucas conf]# vim zoo.cfg
  9. # The number of milliseconds of each tick
  10. tickTime=2000
  11. # The number of ticks that the initial
  12. # synchronization phase can take
  13. initLimit=10
  14. # The number of ticks that can pass between
  15. # sending a request and getting an acknowledgement
  16. syncLimit=5
  17. # the directory where the snapshot is stored.
  18. # do not use /tmp for storage, /tmp here is just
  19. # example sakes.
  20. dataDir=/usr/local/zookeeper/data
  21. # the port at which the clients will connect
  22. clientPort=2181

       将参数dataDir路径设置为/usr/local/zookeeper/data,保存退出。然后启动zookeeper:

  1. [root@lucas conf]# cd ..
  2. [root@lucas zookeeper]# ./bin/zkServer.sh start
  3. ZooKeeper JMX enabled by default
  4. Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
  5. Starting zookeeper ... STARTED

        至此,zookeeper服务端启动成功。再启动客户端可看到如下响应:

  1. [root@lucas zookeeper]# ./bin/zkCli.sh
  2. Connecting to localhost:2181
  3. 2021-01-10 14:50:58,253 [myid:] - INFO [main:Environment@98] - Client environment:zookeeper.version=3.6.1--104dcb3e3fb464b30c5186d229e00af9f332524b, built on 04/21/2020 15:01 GMT
  4. 2021-01-10 14:50:58,258 [myid:] - INFO [main:Environment@98] - Client environment:host.name=lucas
  5. 2021-01-10 14:50:58,258 [myid:] - INFO [main:Environment@98] - Client environment:java.version=1.8.0_271
  6. ......
  7. Welcome to ZooKeeper!
  8. ......
  9. WatchedEvent state:SyncConnected type:None path:null
  10. [zk: localhost:2181(CONNECTED) 0]

三、安装kafka

        kafka可从该页面中下载:Index of /kafka

        这里下载的版本是2.12-2.6.0。操作如下:

  1. [root@lucas src]# tar -zxvf kafka_2.12-2.6.0.tgz
  2. [root@lucas src]# mv ./kafka_2.12-2.6.0 /usr/local/kafka
  3. [root@lucas src]# cd /usr/local/kafka
  4. [root@lucas kafka]# ./bin/kafka-server-start.sh config/server.properties
  5. [2021-01-10 15:03:36,495] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
  6. [2021-01-10 15:03:37,315] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
  7. [2021-01-10 15:03:37,422] INFO starting (kafka.server.KafkaServer)
  8. [2021-01-10 15:03:37,423] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer)
  9. [2021-01-10 15:03:37,451] INFO [ZooKeeperClient Kafka server] Initializing a new session to localhost:2181. (kafka.zookeeper.ZooKeeperClient)
  10. .....
  11. [2021-01-10 15:03:39,298] INFO [LogDirFailureHandler]: Starting (kafka.server.ReplicaManager$LogDirFailureHandler)
  12. [2021-01-10 15:03:39,336] INFO Creating /brokers/ids/0 (is it secure? false) (kafka.zk.KafkaZkClient)
  13. [2021-01-10 15:03:39,381] INFO Stat of the created znode at /brokers/ids/0 is: 28,28,1610262219353,1610262219353,1,0,0,73595441757552641,188,0,28
  14. (kafka.zk.KafkaZkClient)
  15. ......
  16. [2021-01-10 15:03:40,191] INFO Kafka version: 2.6.0 (org.apache.kafka.common.utils.AppInfoParser)
  17. [2021-01-10 15:03:40,191] INFO Kafka commitId: 62abe01bee039651 (org.apache.kafka.common.utils.AppInfoParser)
  18. [2021-01-10 15:03:40,191] INFO Kafka startTimeMs: 1610262220187 (org.apache.kafka.common.utils.AppInfoParser)
  19. [2021-01-10 15:03:40,192] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

        至此kafka服务端启动成功,可启动如下命令终止kafka服务:

[root@lucas kafka]# ./bin/kafka-server-stop.sh config/server.properties

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/580144
推荐阅读
相关标签
  

闽ICP备14008679号