zoukankan      html  css  js  c++  java
  • kafka单机部署

    上传安装jdk

    [root@jenkins ~]# ls

    anaconda-ks.cfg  jdk-8u181-linux-x64.rpm

    [root@jenkins ~]# yum -y install jdk-8u181-linux-x64.rpm

    Loaded plugins: fastestmirror

    Examining jdk-8u181-linux-x64.rpm: 2000:jdk1.8-1.8.0_181-fcs.x86_64

    [root@jenkins ~]# java -version

    java version "1.8.0_181"

    配置zookeeper

    [root@jenkins ~]# wget http://apache.forsale.plus/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

    --2018-11-08 15:43:19--  http://apache.forsale.plus/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

    [root@jenkins ~]# tar zxf zookeeper-3.4.10.tar.gz

    [root@jenkins ~]# mkdir /data

    [root@jenkins ~]# mv zookeeper-3.4.10 /data/zk

    [root@jenkins conf]# cp zoo_sample.cfg zoo.cfg

    [root@jenkins conf]# cat zoo_sample.cfg |grep -v '^#'>zoo.cfg

    [root@jenkins conf]# cat zoo.cfg

    tickTime=2000

    initLimit=10

    syncLimit=5

    clientPort=2181

    dataDir=/data/zk/data/zookeeper

    dataLogDir=/data/zk/data/logs

    启动

    [root@jenkins zk]# sh bin/zkServer.sh start

    ZooKeeper JMX enabled by default

    Using config: /data/zk/bin/../conf/zoo.cfg

    Starting zookeeper ... STARTED

    [root@jenkins zk]# jps

    14518 Jps

    14493 QuorumPeerMain

    [root@jenkins zookeeper]# cat zookeeper_server.pid

    14493[root@jenkins zookeeper]#

    [root@jenkins zookeeper]#

    [root@jenkins zookeeper]#

    [root@jenkins zookeeper]# ps -ef |grep 14493

    root     14493     1  1 15:55 pts/1    00:00:01 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /data/zk/bin/../build/classes:/data/zk/bin/../build/lib/*.jar:/data/zk/bin/../lib/slf4j-log4j12-1.6.1.jar:/data/zk/bin/../lib/slf4j-api-1.6.1.jar:/data/zk/bin/../lib/netty-3.10.5.Final.jar:/data/zk/bin/../lib/log4j-1.2.16.jar:/data/zk/bin/../lib/jline-0.9.94.jar:/data/zk/bin/../zookeeper-3.4.10.jar:/data/zk/bin/../src/java/lib/*.jar:/data/zk/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /data/zk/bin/../conf/zoo.cfg

    root     14666 13519  0 15:57 pts/1    00:00:00 grep --color=auto 14493

    上传kafka

    [root@jenkins ~]# ls

    anaconda-ks.cfg  jdk-8u181-linux-x64.rpm  kafka_2.11-2.0.0  kafka_2.11-2.0.0.tgz  zookeeper-3.4.10.tar.gz

    [root@jenkins ~]# tar xf kafka_2.11-2.0.0.tgz

    [root@jenkins kafka]# yum -y install screen

    配置kafka

    [root@jenkins config]# cat server.properties|grep -Ev "^#|^$"

    broker.id=0

    listeners=PLAINTEXT://localhost:9092

    num.network.threads=3

    num.io.threads=8

    socket.send.buffer.bytes=102400

    socket.receive.buffer.bytes=102400

    socket.request.max.bytes=104857600

    log.dirs=/data/kafka/logs

    num.partitions=1

    num.recovery.threads.per.data.dir=1

    offsets.topic.replication.factor=1

    transaction.state.log.replication.factor=1

    transaction.state.log.min.isr=1

    log.retention.hours=168

    log.segment.bytes=1073741824

    log.retention.check.interval.ms=300000

    zookeeper.connect=localhost:2181

    zookeeper.connection.timeout.ms=6000

    group.initial.rebalance.delay.ms=0

    [root@jenkins kafka]# screen

    [root@jenkins kafka]# pwd

    /data/kafka

    [root@jenkins kafka]# ls

    bin  config  libs  LICENSE  logs  NOTICE  site-docs

    [root@jenkins kafka]# ./bin/kafka-server-start.sh config/server.properties

    Ctrl + a + d 退出后台

    测试

    [root@jenkins kafka]# bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

    Created topic "test".

    [root@jenkins kafka]# bin/kafka-topics.sh --list --zookeeper localhost:2181

    test

    [root@jenkins kafka]# bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

    >hello

    >world

    [root@jenkins kafka]# bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

    hello

    world

  • 相关阅读:
    《架构师》反思:系统可靠性
    表现力(转)
    4月反思
    30天敏捷结果(10) 强化你的一周
    认真对待学习(2月反思)
    Sort By Double
    12月反思 组内设计评审会议
    WPF框架的内存泄漏BUG
    OpenExpressApp 框架结构(2)
    绑定子类的泛型基类,反模式?
  • 原文地址:https://www.cnblogs.com/Honeycomb/p/9930093.html
Copyright © 2011-2022 走看看