`
sillycat
  • 浏览: 2542450 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Kafka Cluster 2019(6) 3 Nodes Cluster on CentOS7

 
阅读更多
Kafka Cluster 2019(6) 3 Nodes Cluster on CentOS7

Here is my machines:
192.168.56.110    rancher-home
192.168.56.111    rancher-worker1
192.168.56.112    rancher-worker2

Need JAVA ENV JDK8, 11, 12
> sudo yum install git
> git clone https://github.com/gcuisinier/jenv.git ~/.jenv
> echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
> echo 'eval "$(jenv init -)"' >> ~/.bash_profile
> . ~/.bash_profile

Check version
> jenv --version
jenv 0.5.2-12-gdcbfd48

Download JDK 8, 11, 12 from Official website
https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
jdk-11.0.4_linux-x64_bin.tar.gz
jdk-12.0.2_linux-x64_bin.tar.gz
jdk-8u221-linux-x64.tar.gz

Unzip all of these files and place in working directory, link to /opt directory
> tar zxvf jdk-11.0.4_linux-x64_bin.tar.gz
> tar zxvf jdk-12.0.2_linux-x64_bin.tar.gz
> tar zxvf jdk-8u221-linux-x64.tar.gz

> mv jdk-11.0.4 ~/tool/
> mv jdk-12.0.2 ~/tool/
> mv jdk1.8.0_221 ~/tool/

> sudo ln -s /home/carl/tool/jdk1.8.0_221 /opt/jdk-1.8.0
> sudo ln -s /home/carl/tool/jdk-11.0.4 /opt/jdk-11.0.4
> sudo ln -s /home/carl/tool/jdk-12.0.2 /opt/jdk-12.0.2

Add to JENV
> jenv add /opt/jdk-1.8.0
> jenv add /opt/jdk-11.0.4
> jenv add /opt/jdk-12.0.2

Check the installed versions
> jenv versions
  11.0
  11.0.4
  12.0
  12.0.2
  1.8
  1.8.0.221
  oracle64-11.0.4
  oracle64-12.0.2
  oracle64-1.8.0.221

Try to set global to 11
> jenv global 11.0

Check the java version
> java -version
java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)

Install Latest Zookeeper
Find the latest version from here
https://www.apache.org/dyn/closer.cgi/zookeeper/

I download the latest version
> wget http://mirrors.ocf.berkeley.edu/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz

Unzip and place in the working directory
> tar zxvf apache-zookeeper-3.5.5-bin.tar.gz
> mv apache-zookeeper-3.5.5-bin ~/tool/zookeeper-3.5.5
> sudo ln -s /home/carl/tool/zookeeper-3.5.5 /opt/zookeeper-3.5.5
> sudo ln -s /opt/zookeeper-3.5.5 /opt/zookeeper

Add this to the path
> vi ~/.bash_profile
PATH=$PATH:/opt/zookeeper/bin
ZOO_MY_ID=1
export ZOO_MY_ID
> . ~/.bash_profile

Prepare the configuration for the Zookeeper Cluster

> cd /opt/zookeeper
> mkdir data
> cp conf/zoo_sample.cfg conf/zoo.cfg
> vi conf/zoo.cfg
server.1=rancher-home:2888:3888
server.2=rancher-worker1:2888:3888
server.3=rancher-worker2:2888:3888
dataDir=/opt/zookeeper/data


> vi /opt/zookeeper/data/myid
1

Do the similar to other 2 machines, just change the myid from 1 to 2 or 3.
Start the service on 3 machines
> /opt/zookeeper/bin/zkServer.sh start /opt/zookeeper/conf/zoo.cfg

Check the status on all the nodes
> zkServer.sh status conf/zoo.cfg
/home/carl/.jenv/shims/java
ZooKeeper JMX enabled by default
Using config: conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower

> zkServer.sh status conf/zoo.cfg
/home/carl/.jenv/shims/java
ZooKeeper JMX enabled by default
Using config: conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader

One Server will be the leader, other 2 servers will be the followers.

Find the latest Kafka
https://kafka.apache.org/downloads

My current latest version is 2.12-2.3.0
> wget https://www-us.apache.org/dist/kafka/2.3.0/kafka_2.12-2.3.0.tgz
Unzip and place it in the right directories
> tar zxvf kafka_2.12-2.3.0.tgz
> mv kafka_2.12-2.3.0 ~/tool/
> sudo ln -s /home/carl/tool/kafka_2.12-2.3.0 /opt/kafka-2.3.0
> sudo ln -s /opt/kafka-2.3.0 /opt/kafka

Configure on 3 machines
> cd /opt/kafka
> vi config/server.properties

On the first Node
broker.id=1
zookeeper.connect=rancher-home:2181,rancher-worker1:2181,rancher-worker2:2181

On the second Node
broker.id=2
zookeeper.connect=rancher-home:2181,rancher-worker1:2181,rancher-worker2:2181

On the Third Node
broker.id=3
zookeeper.connect=rancher-home:2181,rancher-worker1:2181,rancher-worker2:2181

Start the Kafka Service on 3 Nodes
> nohup /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties &

3 Servers are started successfully.

Verify from Clients
Create One Topic
> bin/kafka-topics.sh --create --zookeeper rancher-home:2181,rancher-worker1:2181,rancher-worker2:2181 --replication-factor 2 --partitions 2 --topic cluster1
Created topic cluster1.

Producer
> bin/kafka-console-producer.sh --broker-list rancher-home:9092,rancher-worker1:9092,rancher-worker2:9092 --topic cluster1
>hello
>sillycat
>yiyikang
>where is the pokemon game?

Consumer
> bin/kafka-console-consumer.sh --bootstrap-server rancher-home:9092,rancher-worker1:9092,rancher-worker2:9092 --topic cluster1 --from-beginning
sillycat
hello
yiyikang
where is the pokemon game?




分享到:
评论

相关推荐

    CentOS7安装Kafka

    CentOS7网络配置,安装JDK,安装Kafka,订阅发布以及测试

    kafka rpm 离线 安装 centos7

    centos 离线服务器安装kafka

    尚硅谷大数据技术之Kafka(2019新版)源码笔记

    尚硅谷大数据技术之Kafka(2019新版)源码笔记,视频bilibili上有

    KafkaManager编译后的版本,CentOS7下编译

    在这个场景中,我们讨论的是Kafka Manager的1.3.3.17版本,它已经在CentOS7操作系统上完成了编译,可供直接下载使用,避免了用户自行编译的复杂过程和时间消耗。 首先,让我们深入了解一下Apache Kafka。Kafka是一...

    kafka在centos7上搭建及springboot集成kafka的小demo用例

    在本文中,我们将深入探讨如何在CentOS 7系统上搭建Apache Kafka,并通过Spring Boot进行集成,以便在分布式环境中实现消息传递。首先,我们需要确保具备一个支持Java的环境,因此开始时我们会设置JDK。 1. **JDK...

    CENTOS+KAFKA+GOLANG

    ### CENTOS+KAFKA+GOLANG 配置详解 #### 一、CENTOS 安装与配置 ##### 1.1 虚拟机安装 Centos - **推荐版本**:CentOS 7.x - **下载地址**: - [CentOS-7-x86_64-DVD-1511.iso]...

    docker-kafka-cluster集群安装

    【标题】:Docker-Kafka-Cluster集群安装 在现代分布式系统中,Apache Kafka作为一个高效、可扩展的消息中间件,广泛应用于数据流处理和实时数据分析。为了方便在各种环境中快速部署Kafka,我们可以利用Docker容器...

    kafka-2.3.0-3.x86_64.rpm for centos7

    kafka-2.3.0-3.x86_64.rpm for centos7 Default locations binaries: /opt/kafka data: /var/lib/kafka logs: /var/log/kafka configs: /etc/kafka, /etc/sysconfig/kafka

    Centos7下安装Kafka3 .pdf

    kafka Centos7下安装Kafka3 .pdf

    Centos7kafka2.3.03.zip

    【标题】"Centos7kafka2.3.03.zip" 涉及到的知识点主要集中在Apache Kafka在CentOS 7操作系统上的安装和配置,以及使用RPM包进行软件管理。 Apache Kafka是一个分布式流处理平台,由LinkedIn开发并贡献给了Apache...

    Packt.Learning.Apache.Kafka.2nd.Edition

    how to integrate Kafka with Camus, Apache Camel, Amazon Cloud, and so on.Chapter 6, Kafka Integrations, provides a short introduction to both Storm and Hadoop and discusses how Kafka integration works...

    kafkaCluster

    卡夫卡集群要部署此kafka系统,您需要一个docker swarm集群,在集群的管理器节点上运行以下命令: sudo docker stack deploy --compose-file=docker-compose.yml microservice就是这样!您已经部署了一个kafka集群!

    centos8安装kafka_2.11-2.4.1.docx

    ### CentOS 8 安装 Kafka 2.11-2.4.1 详细步骤与注意事项 #### 一、安装前的基础环境准备 在正式安装 Kafka 之前,确保已准备好以下基础环境: 1. **系统版本确认**:确认当前使用的操作系统为 CentOS 8。 2. **...

    CentOS7 - hyperledger fabric1.1 - 2+6多机部署(kafka共识)配置文件

    CentOS7 - hyperledger fabric1.1 - 2+6多机部署(kafka共识)配置文件

    centos7下kafka和zookeeper和Redis集群搭建.zip

    本教程将详述如何在CentOS7操作系统中搭建Kafka、Zookeeper和Redis的集群环境,以实现高效、稳定的分布式数据处理和存储。 **Zookeeper简介** Apache ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,...

    CentOS7安装kafka-manager.docx

    【标题】:CentOS7上安装与配置Kafka-Manager详解 【描述】:Kafka-Manager是一款基于Web界面的工具,专为管理和监控Apache Kafka集群而设计。它提供了直观的用户界面,使得在CentOS7系统上管理Kafka集群变得简单易...

    CentOS7下安装Kafka1

    【标题】:“CentOS7下安装Kafka1” 【描述】:这个教程主要讲述了如何在CentOS 7操作系统上安装Apache Kafka的单机版本。Kafka是一个分布式流处理平台,常用于构建实时数据管道和流应用程序。在这个场景中,我们...

    kafkatool 连接kafka工具

    **Kafka Tool 连接 Kafka 工具详解** 在大数据处理和实时流处理领域,Apache Kafka 是一个不可或缺的组件,它作为一个分布式的消息中间件,提供高效、可扩展且可靠的发布订阅服务。为了方便管理和操作 Kafka 集群,...

Global site tag (gtag.js) - Google Analytics