• Kafka安装


    一、下载kafka和JDK

    Kafka地址:https://dlcdn.apache.org/kafka/3.0.0/kafka-3.0.0-src.tgz

    JDK下载地址:https://www.oracle.com/java/technologies/downloads/#java8

    https://download.oracle.com/otn/java/jdk/8u311-b11/4d5417147a92418ea8b615e228bb6935/jdk-8u311-linux-x64.tar.gz

    JDK比较麻烦,需要登录。方可下载。

    二、安装JDK

    安装kafka之前需要安装JAVA环境:

    # 解压

    tar -zxvf jdk-8u311-linux-x64.tar.gz

    # 移动到安装目录下:

    mv jdk1.8.0_311/ /usr/local/

    # 编辑/etc/profile

    vi /etc/profile
    # JAVA ENV
    
    export JAVA_HOME=/usr/local/jdk1.8.0_311  #jdk安装目录
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
    export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
    export PATH=$PATH:${JAVA_PATH}

    # 重新加载配置文件
    source /etc/profile
    安装完成之后,可以尝试javac和java -version试试。

    三、安装kafka

    # 解压
    tar
    -zxvf kafka_2.12-3.0.0.tgz
    # 移动解压收的文件到安装路径
    mv kafka_2.12-3.0.0 /home/apps/
    # 编辑配置文件
    vi /etc/profile

    # Kafka ENV

    export KAFKA_HOME=/home/apps/kafka_2.12-3.0.0
    export PATH=$PATH:$KAFKA_HOME/bin

    # 重新加载配置文件

    source /etc/profile

    启动:

    1.启动zookeeper

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

    2.启动kafka

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

    这样就搞定了。

    3.尝试创建一个topic:

    kafka-topics.sh --create --topic quickstart-events --partitions 3 --replication-factor 1 --bootstrap-server localhost:9092

    4.查看topic

    [root@localhost kafka_2.12-3.0.0]# bin/kafka-topics.sh --describe --topic quickstart-events --bootstrap-server localhost:9092
    Topic: quickstart-events        TopicId: QsD1g54rQqie4L8iELngtg PartitionCount: 3       ReplicationFactor: 1    Configs: segment.bytes=1073741824
            Topic: quickstart-events        Partition: 0    Leader: 0       Replicas: 0     Isr: 0
            Topic: quickstart-events        Partition: 1    Leader: 0       Replicas: 0     Isr: 0
            Topic: quickstart-events        Partition: 2    Leader: 0       Replicas: 0     Isr: 0

     5.删除topic

     bin/kafka-topics.sh --delete --topic quickstart-events --bootstrap-server localhost:9092

  • 相关阅读:
    jquery中$.get()提交和$.post()提交有区别吗?
    数据库连接池的原理。为什么要使用连接池。
    execute,executeQuery,executeUpdate的区别是什么?
    数据库的三级模式与二级映像
    KMP算法(超容易理解的next数组求法)
    软件危机(含通俗理解帮助记忆)
    O(1)复杂度求一个栈的最小值
    操作系统进程状态模型
    判断单链表是否有环,如果有环则找到其环的入口
    两个单链表判断是否相交
  • 原文地址:https://www.cnblogs.com/tortoise512/p/15651926.html
Copyright © 2020-2023  润新知