zoukankan      html  css  js  c++  java
  • kafka安装

    1 下载解压

    http://kafka.apache.org/downloads.html 选择合适的包

    wget -q http://www-us.apache.org/dist/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz

    tar -xzvf kafka_2.11-0.11.0.0.tgz

    rm kafka_2.11-0.11.0.0.tgz 

    2 启动

    cd kafka_2.11-0.11.0.0

    启动zookeeper

    bin/zookeeper-server-start.sh config/zookeeper.properties & 

    可能会提示下面的错误

    root@host kafka_2.11-0.11.0.0]# Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e0000000, 536870912, 0) failed; error='Cannot allocate memory' (errno=12)
    #
    # There is insufficient memory for the Java Runtime Environment to continue.
    # Native memory allocation (mmap) failed to map 536870912 bytes for committing reserved memory.
    # An error report file with more information is saved as:
    # /home/kafaka/kafka_2.11-0.11.0.0/hs_err_pid22906.log

    可以修改 bin/zookeeper-server-start.sh   里面的内存大小,这里指为128M, export KAFKA_HEAP_OPTS="-Xmx128M -Xms128M"

    启动kafka 

    bin/kafka-server-start.sh config/server.properties &

    可能会报如下错误

    [2017-08-21 03:53:36,632] FATAL [Kafka Server 0], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
    java.net.UnknownHostException: host.localdomain: host.localdomain: Name or service not known
    at java.net.InetAddress.getLocalHost(InetAddress.java:1505)

    修改/etc/host

    127.0.0.1 host.localdomain localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 host.localdomain localhost localhost.localdomain localhost6 localhost6.localdomain6

    3 停止

    停止Kafka server bin/kafka-server-stop.sh
    停止Zookeeper server: bin/zookeeper-server-stop.sh

    4 测试连通性

    运行producer: bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 

    运行consumer: bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

    在producer端输入字符串并回车,查看consumer端是否显示。

  • 相关阅读:
    Mysql 触发器
    Mysql 的变量
    Mysql 事务
    重置mysql管理员密码
    mysql数据备份
    Mysql的联合查询
    Mysql的存储引擎
    数据库的视图
    数据库子查询
    数据库外键
  • 原文地址:https://www.cnblogs.com/sysnap/p/7404925.html
Copyright © 2011-2022 走看看