• 重新装kafka


    Linux搭建kafka

     

    一、安装Java

    1、查看linux 的系统版本

    root@aliyun:~# uname --m
    x86_64

    2、安装java

    mkdir -p /usr/local/java
    tar -xf jdk-8u181-linux-x64.tar.gz
    mv jdk1.8.0_181 java
    
    vim ~/.bashrc
    
    #set oracle jdk environment
    export JAVA_HOME=/usr/local/java  ## 这里要注意目录要换成自己解压的jdk 目录
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export PATH=${JAVA_HOME}/bin:$PATH
    
    
    
    update-alternatives --install /usr/bin/java java /usr/local/java/bin/java 300  
    update-alternatives --install /usr/bin/javac javac /usr/local/java/bin/javac 300  
    update-alternatives --install /usr/bin/jar jar /usr/local/java/bin/jar 300   
    update-alternatives --install /usr/bin/javah javah /usr/local/java/bin/javah 300   
    update-alternatives --install /usr/bin/javap javap /usr/local/java/bin/javap 300
    
    source ~/.bashrc

    3、查看自己的java版本

    root@aliyun:/usr/local# java -version
    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

    二、安装zookeeper

    wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
    tar -xf zookeeper-3.4.10.tar.gz
    mv zookeeper-3.4.10 zookeeper
    cd zookeeper/src/c
    ./configure
    make && make install

    三、安装Kafka

    wget http://mirror.bit.edu.cn/apache/kafka/2.0.0/kafka_2.11-2.0.0.tgz
    mv kafka_2.11-2.0.0.tgz kafka
    tar -xf kafka_2.11-2.0.0.tgz
    mv kafka_2.11-2.0.0 kafka

    四、设置zookeeper 和 kafka的全局命令

    vim ~/.bashrc
    
    export PATH=/usr/local/kafka/bin:/usr/local/zookeeper/bin:$PATH
    
    source ~/.bashrc
    

    启动服务

    1、启动zookeeper

    zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties >> /dev/null &

    2、启动kafka

    kafka-server-start.sh /usr/local/kafka/config/server.properties >> /dev/null &

    3、生产一个TOPIC

    kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test

    4、消费一个TOPIC

    kafka-console-consumer.sh --zookeeper 127.0.0.1:2181 --topic test
  • 相关阅读:
    GetWindowThreadProcessId
    为什么要学制作外挂
    博客系统架构对比分析
    C# 数据库访问通用类 (ADO.NET)
    转:配置 SQL Server 2005 远程调试存储过程
    腾讯QQ空间g_tk算法
    BurstNET的linux vps 安装Kloxo面板后一切正常 今天重启导致错误Could not connect to Mysql server
    service的生命周期回调方法
    服务的生命周期回调方法
    点阵字库在JAVA中的实现
  • 原文地址:https://www.cnblogs.com/vana/p/10201188.html
Copyright © 2020-2023  润新知