SlideShare una empresa de Scribd logo
1 de 42
Apache Kafka
Creating Single Node Kafka Cluster on Linux
Environment
Installation & Setup
Basics of Kafka &
Zookeeper
This slide covers the Kafka setup on a
VM running on Windows.
Apart from Kafka, we will install various other
software such as JDK, Zookeeper, VM etc.. That we
need to run Kafka.
We expect you have basic understanding of JDK,
and understand what is kafka and what is zookeepr
and their usage.
As, this slide does not cover the basics of these,
and we will straight forward discuss about setting
them up, we recommend you go through our other
slides to have some basic knowledge of them.
Download The
Required Software
What do we need to download?
[As on 30-Sep-2022]
1. Latest version of Apache Kafka
https://dlcdn.apache.org/kafka/3.2.3/kafka_2.12-3.2.3.tgz
2. Latest version of Apache Zookeeper
https://dlcdn.apache.org/zookeeper/zookeeper-
3.8.0/apache-zookeeper-3.8.0-bin.tar.gz
3. jdk-11.0.16.1_linux-x64_bin.tar.gz
https://www.oracle.com/java/technologies/downloads/
Additionally, If your machine is running on Windows Operating
System, download the following also:
1. VMware Workstation player 16 from
https://www.vmware.com/go/getplayer-win
2. Ubuntu 14.04.2 LTS from http://old-
releases.ubuntu.com/releases/14.04.2/ubuntu-14.04.5-
desktop-i386.iso
(Not mandatory to use Ubuntu-14.02 LTS, if your system is
having high configuration (RAM > 8 GB and Disk >1 TB),
you can go for latest version of Ubuntu)
Install the Software
on Windows
Systems
In order to persist the entire Kafka cluster environment on a
separate external Hard Disk, lets install the software in the
following order:
1. Install the VM Workstation
2. On top of it, install Linux OS, which is Ubuntu
Windows 10 will be the host OS and Ubuntu the guest OS where
single CPU of the system will be shared according to configured
value in VM Workstation
1. Install JDK
2. Install Kafka
3. Install Zookeeper
We will discuss the installation process of each of these
software one by one, in the coming slides
Installing VM
Workstation on
Windows Systems
Lets start with Installing the VM Workstation:
● Right click VMware-player-full-16.2.4-20089737.exe and select
Run as Administrator and follow the installation instruction.
● Installation Dialog Box will open.. Accept the End-user Licence
Agreement and click Next
Installing
VM Workstation
on Windows
● Keep clicking Next and finally click on Install, this will
start the installation process of Vmware Player. It may
take some time.
● Click on finish to complete the setup. Once installtion
is completed, VM player will start and you can see VM
Player Window with various options.
Installing Ubuntu
on Windows
Once VM Workstation is installed, we can setup Ubuntu on it.
● Click Create New Virtual Machine
● Locate the Ubantu iso file when asked
Installing
Ubuntu
on Windows
● Enter the Linux name of your choice, Username in
small letters and passwords and clcik next
● Enter Kafka Cluster name (without space), select the
location and click next.
Installing
Ubuntu
on Windows
● Increase the Disk Capacity to 50 GB and click Next
● On the next screen click on Customize Hardware and select 4
gb as minimum memory.
Installing
Ubuntu
on Windows
● After selecting 4 gb memory click on Close
● Now click on Finish to start the setup
Installing
Ubuntu
on Windows
● This will take 10-15 minutes to complete the setup
● Once setup is completed, you will be able to see the below screen
● Enter the password, in this case : demo, and click on arrow.
Installing
Ubuntu
on Windows
● Once logged in, you can see below screen.
Install JDK
Starting Ubuntu
Now since we have already VM Ware player and Ubuntu
installed, let start with installing JDK.
● Start VM Ware Player
● Start Ubuntu, it will ask for password, enter the password
(in this case “demo”)
● Double click on folder icon from left menu, once you are
inside Ubuntu, It will open the directory structure.
Install JDK
Extract JDK
● Create a folder (in this case Kafka-Softwares), where
we can keep installable files which we need to install
throughout this exercise.
● Now copy the installable from windows and paste it
inside Ubuntu under the newly created folder.
Install JDK
Extract JDK
● Once all the installable are copied under new folder, we will
first extract the JDK.
● Open a command terminal by typing CTRL+ALT+T
Install JDK
Extract JDK
Go to the directory location of JDK by using following
commands
● pwd (to check the current directory location)
● ls (to list the files and folders under current directory)
● cd Kafka-Softwares (use your folder name)
Install JDK
Extract JDK
● Once you reach the directory location of JDK, type
sudo tar -xvf JDK filename and then press enter
● This will extract the JDK tar ball
● Double click on the jdk folder and ensure java, javac
and javaws are there under bin folder
Install JDK
Setup Java Home
● Open the terminal by CNTRL+ALT+T
● Type command sudo vi /etc/profile
● Enter the password for root user, if asked
● Press enter to continue
● Bring the cursor to the bottom end of the file on last character
● Type I two times and press enter
● Now profile file will open in editor mode
● Add comments #Setting up Java Home Environment Variable
● Insert the following in the end
JAVA_HOME=/home/demo/Kafka-Softwares/jdk-11.0.16.1
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
● Type :wq and press enter to save the eateries.
● Type vi /etc/profile - To verify the changes made
● Type :q! - if you want to come out of vi editor
Install JDK
Install Java
Type the following commands to install Java:
● sudo update-alternatives --install ”/usr/bin/java” “java”
“/home/demo/Kafka-Softwares/jdk1.8.0_101/bin/java” 1
● sudo update-alternatives --install ”/usr/bin/javac” “javac”
“/home/demo/Kafka-Softwares/jdk1.8.0_101/bin/javac” 1
● sudo update-alternatives --install ”/usr/bin/javaws” “javaws”
“//home/demo/Kafka-Softwares/jdk1.8.0_101/bin/javaws” 1
Install JDK
Set Java Variable
Type the following commands to set the Java variables
● sudo update-alternatives –-set java /home/demo/Kafka-
Softwares/jdk1.8.0_101/bin/java
● sudo update-alternatives –-set javac /home/demo/Kafka-
Softwares/jdk1.8.0_101/bin/javac
● sudo update-alternatives –-set javaws /home/demo/Kafka-
Softwares/jdk1.8.0_101/bin/javaws
This completes the java installation
Install JDK
Verify
As we installed java, lets verify the same by using below
commands once by one.
● Type java -version to check if java installed properly and its
version
● type java
● type javac
If there is no error, you
have installed and setup
java successfully ☺
Install Zookeeper
Extract Zookeeper
Go to the location of Zookeeper and extract the tar ball
● Open the terminal by CNTRL+ALT+T
● Go to the folder where zookeeper tar ball is copied by using
the following commands:
● pwd (to check the current directory location)
● ls (to list the files and folders under current directory)
● cd Kafka-Softwares (use your folder name)
● Once you reach the directory location of Zookeeper, type
sudo tar -xvzf Zookeeper Filename and then press enter
● This will extract the Zookeeper tar ball and create a new
folder with the same name.
● Double click on the newly created zookeeper folder and
verify that it is extracted properly
Install Zookeeper
Move zookeeper folder
Move zookeeper folder to /usr/local/zookeeper folder
● Type command sudo mv apache-zookeeper-3.8.0-bin
/usr/local/zookeeper and press enter
● This will create a zookeeper folder under /usr/local/, you
may verify this by clicking on Computer under Devices
from left side menu and then visiting the location
usr>local
Install Zookeeper
Creating data directory and
logs directory
● Create data directory by using command mkdir
/usr/local/zookeeper/data
● Create logs directory by using command mkdir
/usr/local/zookeeper/logs
Install Zookeeper
Creating myid file under data
directory
● Type cd /usr/local/zookeeper/data to go to
/usr/local/zookeeper/data directory
● Now type echo “1” > /usr/local/zookeeper/data/myid
● This will create myid file under
/usr/local/zookeeper/data
● Verify the creation of myid file by going to data folder by
using command cd /usr/local/zookeeper/data/myid and
then use ls , this will display myid file
Install Zookeeper
Rename zoo_sample.cnf
● Type cd /usr/local/zookeeper/conf to go to conf folder
● Type mv zoo_sample.cnf zoo.cnf to change the name of
zoo_sample.cnf to zoo.cnf
Install Zookeeper
Modify zoo.cnf
● Type vi zoo.config , it will open the zoo.config file in vi
editor mode.
● Now scroll down using arrow keys to dataDir= and change
its value to /usr/local/zookeeper/data
● Make a new entry in the next line
dataLogDir=/usr/local/zookeeper/logs
● Go to the line where clientPort=2181 is mentioned and
change it to clientPort=5181
● Now, go to end of the file and add
server.1=localhost:2888:3888
● Type :wq and press enter to save the changes
● Type vi zoo.config to verify the changes
Install Zookeeper
Starting the Zookeeper
● Type cd /usr/local/zookeeper/bin
● Type ls to see the list of files under bin directory
● Type -/zkServer.sh start to start the zookeeper, and you should see STARTED
message upon successful start of zookeeper
This completes Zookeeper
setup
Install Kafka
Extract Kafka
Go to the location of Kafka and extract the tar ball
● Open the terminal by CNTRL+ALT+T
● Go to the folder where kafka tar ball is copied by using
the following commands:
● pwd (to check the current directory location)
● ls (to list the files and folders under current directory)
● cd Kafka-Softwares (use your folder name)
● Once you reach the directory location of Kafka, type
sudo tar -xvzf Kafka Filename and then press enter
● This will extract the Kafka tar ball and create a new
folder with the same name.
● Double click on the newly created kafka folder and verify
that it is extracted properly
Install Kafka
Move kafka folder
Move kafka folder to /usr/local/kafka folder
● Type command sudo mv kafka_2.12-3.2.3
/usr/local/kafka and press enter
● This will create a kafka folder under /usr/local/, you may
verify this by clicking on Computer under Devices from
left side menu and then visiting the location usr>local
Install Kafka
Modify server.properties
● Type vi /usr/local/kafka/config/server.properties to open the
server.properties file in vi editor
● Now scroll down using arrow keys to broker_id=0 and change it to
broker_id=1
● Scroll down further to see log.dirs.=/tmp/kafka-log
● Scroll down further to change num.partitions=1 to num.partitions=5
● Scroll down further to change zookeeper.connect=localhost:2181
to zookeeper.connect=localhost:5181
● Scroll down further to end of the file and add
delete.topic.enable=true
● Type :wq and press enter to save the changes
● Type Type vi /usr/local/kafka/config/server.properties to verify the
changes made
● Type :q! to come out of vi editor
Install Kafka
Start zookeeper and kafka
● Now type cd /user/local/zookeeper/bin
● Type ./zkServer.sh start to start zookeeper
● Now type cd /user/local/kafka/bin
● Type ./kafka-server-start.sh ../config/server.properties to
start kafka server using server.properties file.
Install Kafka
Creating Kafka Topic
● Now type cd /user/local/kafka/bin
● Type ./kafka-server-start.sh ./kafka-topics.sh –bootstrap-
server localhost:9002 –create –replication-factor 1 –
partitions 2 –topic firstTopic
● This will create a Topic named firstTopic
● Verify this by typing Type ./kafka-server-start.sh ./kafka-
topics.sh –bootstrap-server localhost:9002 –list
Install Kafka
Looking into details of Kafka
Topic
● Type ./kafka-server-start.sh ./kafka-topics.sh –bootstrap-
server localhost:9002 –topic firstTopic –describe to see the
details of the topic firstTopic
Install Kafka
Kafka Producer & Consumer
● We can see two files Kafka-console-producer.sh and kafka-
console-consumer.sh under /usr/local/kafka/bin
Install Kafka
Publishing Messages on Kafka
Topic
● Go to /usr/local/kafka/bin and type ./kafka-console-
producer.sh --bootstrap-server localhost:9092 --topic
firstTopic and press enter
● Type any random message (e.g. Hi) and press enter
● This will publish the message on the topic firstTopic.
Install Kafka
Consuming message from
Kafka Topic
● Now open another terminal by typing CLTR+ALT+T
● Type /usr/local/kafka/bin and press enter
● Type ./kafka-console-consumer.sh –bootstrap-server
localhost:9092 --topic firstTopic --from beginning and press
enter
● You can see messages sent by publisher are getting consumed
and published here.
● Keep publishing new messages on publisher and same will be
consumed by consumer at run time.
Install Kafka
Stopping the publisher and
consumer scripts
● Type CLTR+C one by one in each terminal of publisher and
consumer.
● This will stop the publisher and consumer scripts
● Type exit to close the terminals
Install Kafka
Stopping zookeeper & kafka
servers
● Go to /usr/local/zookeeper/bin and press enter
● Type ./zkServer.sh stop
● This will stop zookeeper server
● Go to /usr/local/kafka/bin and press enter
● Type ./kafka-server-stop.sh stop
● This will stop kafka server
Install Kafka
Looking into Kafka Logs
● Open a new terminal by typing CTRL+ALT+T and type sudo
mkdir /usr/local/kafka-logs and press enter
● Enter the password (in this case “demo”) if asked
● Now go to the kafka bin directory by typing /usr/local/kafka/bin
● Open server.properties file in vi editor in another terminal by
typing vi /usr/local/kafka/config/server.properties
● Scroll down to logs.dirs. And change its value to
/home/demo/kafka.logs
● Type :wq to save
● Go to cd /usr/local/zookeeper/bin
● Type ./zkServer.sh start
● Now type cd /user/local/kafka/bin
● Type ./kafka-server-start.sh ../config/server.properties to start
kafka server
Install Kafka
Looking into Kafka Logs
● Now switch to the terminal of /kafka-logs
● Now browse through the directory by clicking on home/kafka-
logs
● Check for meta.properties file
Install Kafka
Looking into Kafka Logs
● Right click on meta.properties file and open it in office
application to view its content
● You can brose through different logs same way.
This Complete Kafka
setup

Más contenido relacionado

Similar a Apache Kafka Setup with Zookeeper - SkillAnything.pdf

Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxkarlhennesey
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxmoirarandell
 
Fedora Atomic Workshop handout for Fudcon Pune 2015
Fedora Atomic Workshop handout for Fudcon Pune  2015Fedora Atomic Workshop handout for Fudcon Pune  2015
Fedora Atomic Workshop handout for Fudcon Pune 2015rranjithrajaram
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guidevjvarenya
 
Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04Rajendra Singh
 
FOSS_GNU/Linux
FOSS_GNU/LinuxFOSS_GNU/Linux
FOSS_GNU/LinuxYogesh Ks
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with dockerJohan Janssen
 
Oracle forms and reports 11g installation on linux
Oracle forms and reports 11g installation on linuxOracle forms and reports 11g installation on linux
Oracle forms and reports 11g installation on linuxVenu Palakolanu
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...NLJUG
 
Webapp using docker container
Webapp using docker containerWebapp using docker container
Webapp using docker containerSebyAmin
 
Installing Lamp Stack on Ubuntu Instance
Installing Lamp Stack on Ubuntu InstanceInstalling Lamp Stack on Ubuntu Instance
Installing Lamp Stack on Ubuntu Instancekamarul kawnayeen
 
Jfrog artifactory as private docker registry
Jfrog artifactory as private docker registryJfrog artifactory as private docker registry
Jfrog artifactory as private docker registryVipin Mandale
 
Manual 70-410 _Yves
Manual 70-410 _YvesManual 70-410 _Yves
Manual 70-410 _YvesYves Mukusa
 

Similar a Apache Kafka Setup with Zookeeper - SkillAnything.pdf (20)

Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Ns-2.35 Installation
Ns-2.35 InstallationNs-2.35 Installation
Ns-2.35 Installation
 
Fedora Atomic Workshop handout for Fudcon Pune 2015
Fedora Atomic Workshop handout for Fudcon Pune  2015Fedora Atomic Workshop handout for Fudcon Pune  2015
Fedora Atomic Workshop handout for Fudcon Pune 2015
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guide
 
Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04
 
Play Framework in EC2
Play Framework in EC2Play Framework in EC2
Play Framework in EC2
 
FOSS_GNU/Linux
FOSS_GNU/LinuxFOSS_GNU/Linux
FOSS_GNU/Linux
 
Weblogic12 c installation guide
Weblogic12 c installation guideWeblogic12 c installation guide
Weblogic12 c installation guide
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with docker
 
Oracle forms and reports 11g installation on linux
Oracle forms and reports 11g installation on linuxOracle forms and reports 11g installation on linux
Oracle forms and reports 11g installation on linux
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
 
linux
linuxlinux
linux
 
Webapp using docker container
Webapp using docker containerWebapp using docker container
Webapp using docker container
 
Installing Lamp Stack on Ubuntu Instance
Installing Lamp Stack on Ubuntu InstanceInstalling Lamp Stack on Ubuntu Instance
Installing Lamp Stack on Ubuntu Instance
 
Jfrog artifactory as private docker registry
Jfrog artifactory as private docker registryJfrog artifactory as private docker registry
Jfrog artifactory as private docker registry
 
Sun raysetup
Sun raysetupSun raysetup
Sun raysetup
 
Manual 70-410 _Yves
Manual 70-410 _YvesManual 70-410 _Yves
Manual 70-410 _Yves
 

Último

Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowgargpaaro
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...gajnagarg
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...gajnagarg
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...Health
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNKTimothy Spann
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制vexqp
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格q6pzkpark
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样wsppdmt
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjurptikerjasaptiker
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangeThinkInnovation
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...Bertram Ludäscher
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样wsppdmt
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1ranjankumarbehera14
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...nirzagarg
 

Último (20)

Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 

Apache Kafka Setup with Zookeeper - SkillAnything.pdf

  • 1. Apache Kafka Creating Single Node Kafka Cluster on Linux Environment Installation & Setup
  • 2. Basics of Kafka & Zookeeper This slide covers the Kafka setup on a VM running on Windows. Apart from Kafka, we will install various other software such as JDK, Zookeeper, VM etc.. That we need to run Kafka. We expect you have basic understanding of JDK, and understand what is kafka and what is zookeepr and their usage. As, this slide does not cover the basics of these, and we will straight forward discuss about setting them up, we recommend you go through our other slides to have some basic knowledge of them.
  • 3. Download The Required Software What do we need to download? [As on 30-Sep-2022] 1. Latest version of Apache Kafka https://dlcdn.apache.org/kafka/3.2.3/kafka_2.12-3.2.3.tgz 2. Latest version of Apache Zookeeper https://dlcdn.apache.org/zookeeper/zookeeper- 3.8.0/apache-zookeeper-3.8.0-bin.tar.gz 3. jdk-11.0.16.1_linux-x64_bin.tar.gz https://www.oracle.com/java/technologies/downloads/ Additionally, If your machine is running on Windows Operating System, download the following also: 1. VMware Workstation player 16 from https://www.vmware.com/go/getplayer-win 2. Ubuntu 14.04.2 LTS from http://old- releases.ubuntu.com/releases/14.04.2/ubuntu-14.04.5- desktop-i386.iso (Not mandatory to use Ubuntu-14.02 LTS, if your system is having high configuration (RAM > 8 GB and Disk >1 TB), you can go for latest version of Ubuntu)
  • 4. Install the Software on Windows Systems In order to persist the entire Kafka cluster environment on a separate external Hard Disk, lets install the software in the following order: 1. Install the VM Workstation 2. On top of it, install Linux OS, which is Ubuntu Windows 10 will be the host OS and Ubuntu the guest OS where single CPU of the system will be shared according to configured value in VM Workstation 1. Install JDK 2. Install Kafka 3. Install Zookeeper We will discuss the installation process of each of these software one by one, in the coming slides
  • 5. Installing VM Workstation on Windows Systems Lets start with Installing the VM Workstation: ● Right click VMware-player-full-16.2.4-20089737.exe and select Run as Administrator and follow the installation instruction. ● Installation Dialog Box will open.. Accept the End-user Licence Agreement and click Next
  • 6. Installing VM Workstation on Windows ● Keep clicking Next and finally click on Install, this will start the installation process of Vmware Player. It may take some time. ● Click on finish to complete the setup. Once installtion is completed, VM player will start and you can see VM Player Window with various options.
  • 7. Installing Ubuntu on Windows Once VM Workstation is installed, we can setup Ubuntu on it. ● Click Create New Virtual Machine ● Locate the Ubantu iso file when asked
  • 8. Installing Ubuntu on Windows ● Enter the Linux name of your choice, Username in small letters and passwords and clcik next ● Enter Kafka Cluster name (without space), select the location and click next.
  • 9. Installing Ubuntu on Windows ● Increase the Disk Capacity to 50 GB and click Next ● On the next screen click on Customize Hardware and select 4 gb as minimum memory.
  • 10. Installing Ubuntu on Windows ● After selecting 4 gb memory click on Close ● Now click on Finish to start the setup
  • 11. Installing Ubuntu on Windows ● This will take 10-15 minutes to complete the setup ● Once setup is completed, you will be able to see the below screen ● Enter the password, in this case : demo, and click on arrow.
  • 12. Installing Ubuntu on Windows ● Once logged in, you can see below screen.
  • 13. Install JDK Starting Ubuntu Now since we have already VM Ware player and Ubuntu installed, let start with installing JDK. ● Start VM Ware Player ● Start Ubuntu, it will ask for password, enter the password (in this case “demo”) ● Double click on folder icon from left menu, once you are inside Ubuntu, It will open the directory structure.
  • 14. Install JDK Extract JDK ● Create a folder (in this case Kafka-Softwares), where we can keep installable files which we need to install throughout this exercise. ● Now copy the installable from windows and paste it inside Ubuntu under the newly created folder.
  • 15. Install JDK Extract JDK ● Once all the installable are copied under new folder, we will first extract the JDK. ● Open a command terminal by typing CTRL+ALT+T
  • 16. Install JDK Extract JDK Go to the directory location of JDK by using following commands ● pwd (to check the current directory location) ● ls (to list the files and folders under current directory) ● cd Kafka-Softwares (use your folder name)
  • 17. Install JDK Extract JDK ● Once you reach the directory location of JDK, type sudo tar -xvf JDK filename and then press enter ● This will extract the JDK tar ball ● Double click on the jdk folder and ensure java, javac and javaws are there under bin folder
  • 18. Install JDK Setup Java Home ● Open the terminal by CNTRL+ALT+T ● Type command sudo vi /etc/profile ● Enter the password for root user, if asked ● Press enter to continue ● Bring the cursor to the bottom end of the file on last character ● Type I two times and press enter ● Now profile file will open in editor mode ● Add comments #Setting up Java Home Environment Variable ● Insert the following in the end JAVA_HOME=/home/demo/Kafka-Softwares/jdk-11.0.16.1 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH ● Type :wq and press enter to save the eateries. ● Type vi /etc/profile - To verify the changes made ● Type :q! - if you want to come out of vi editor
  • 19. Install JDK Install Java Type the following commands to install Java: ● sudo update-alternatives --install ”/usr/bin/java” “java” “/home/demo/Kafka-Softwares/jdk1.8.0_101/bin/java” 1 ● sudo update-alternatives --install ”/usr/bin/javac” “javac” “/home/demo/Kafka-Softwares/jdk1.8.0_101/bin/javac” 1 ● sudo update-alternatives --install ”/usr/bin/javaws” “javaws” “//home/demo/Kafka-Softwares/jdk1.8.0_101/bin/javaws” 1
  • 20. Install JDK Set Java Variable Type the following commands to set the Java variables ● sudo update-alternatives –-set java /home/demo/Kafka- Softwares/jdk1.8.0_101/bin/java ● sudo update-alternatives –-set javac /home/demo/Kafka- Softwares/jdk1.8.0_101/bin/javac ● sudo update-alternatives –-set javaws /home/demo/Kafka- Softwares/jdk1.8.0_101/bin/javaws This completes the java installation
  • 21. Install JDK Verify As we installed java, lets verify the same by using below commands once by one. ● Type java -version to check if java installed properly and its version ● type java ● type javac If there is no error, you have installed and setup java successfully ☺
  • 22. Install Zookeeper Extract Zookeeper Go to the location of Zookeeper and extract the tar ball ● Open the terminal by CNTRL+ALT+T ● Go to the folder where zookeeper tar ball is copied by using the following commands: ● pwd (to check the current directory location) ● ls (to list the files and folders under current directory) ● cd Kafka-Softwares (use your folder name) ● Once you reach the directory location of Zookeeper, type sudo tar -xvzf Zookeeper Filename and then press enter ● This will extract the Zookeeper tar ball and create a new folder with the same name. ● Double click on the newly created zookeeper folder and verify that it is extracted properly
  • 23. Install Zookeeper Move zookeeper folder Move zookeeper folder to /usr/local/zookeeper folder ● Type command sudo mv apache-zookeeper-3.8.0-bin /usr/local/zookeeper and press enter ● This will create a zookeeper folder under /usr/local/, you may verify this by clicking on Computer under Devices from left side menu and then visiting the location usr>local
  • 24. Install Zookeeper Creating data directory and logs directory ● Create data directory by using command mkdir /usr/local/zookeeper/data ● Create logs directory by using command mkdir /usr/local/zookeeper/logs
  • 25. Install Zookeeper Creating myid file under data directory ● Type cd /usr/local/zookeeper/data to go to /usr/local/zookeeper/data directory ● Now type echo “1” > /usr/local/zookeeper/data/myid ● This will create myid file under /usr/local/zookeeper/data ● Verify the creation of myid file by going to data folder by using command cd /usr/local/zookeeper/data/myid and then use ls , this will display myid file
  • 26. Install Zookeeper Rename zoo_sample.cnf ● Type cd /usr/local/zookeeper/conf to go to conf folder ● Type mv zoo_sample.cnf zoo.cnf to change the name of zoo_sample.cnf to zoo.cnf
  • 27. Install Zookeeper Modify zoo.cnf ● Type vi zoo.config , it will open the zoo.config file in vi editor mode. ● Now scroll down using arrow keys to dataDir= and change its value to /usr/local/zookeeper/data ● Make a new entry in the next line dataLogDir=/usr/local/zookeeper/logs ● Go to the line where clientPort=2181 is mentioned and change it to clientPort=5181 ● Now, go to end of the file and add server.1=localhost:2888:3888 ● Type :wq and press enter to save the changes ● Type vi zoo.config to verify the changes
  • 28. Install Zookeeper Starting the Zookeeper ● Type cd /usr/local/zookeeper/bin ● Type ls to see the list of files under bin directory ● Type -/zkServer.sh start to start the zookeeper, and you should see STARTED message upon successful start of zookeeper This completes Zookeeper setup
  • 29. Install Kafka Extract Kafka Go to the location of Kafka and extract the tar ball ● Open the terminal by CNTRL+ALT+T ● Go to the folder where kafka tar ball is copied by using the following commands: ● pwd (to check the current directory location) ● ls (to list the files and folders under current directory) ● cd Kafka-Softwares (use your folder name) ● Once you reach the directory location of Kafka, type sudo tar -xvzf Kafka Filename and then press enter ● This will extract the Kafka tar ball and create a new folder with the same name. ● Double click on the newly created kafka folder and verify that it is extracted properly
  • 30. Install Kafka Move kafka folder Move kafka folder to /usr/local/kafka folder ● Type command sudo mv kafka_2.12-3.2.3 /usr/local/kafka and press enter ● This will create a kafka folder under /usr/local/, you may verify this by clicking on Computer under Devices from left side menu and then visiting the location usr>local
  • 31. Install Kafka Modify server.properties ● Type vi /usr/local/kafka/config/server.properties to open the server.properties file in vi editor ● Now scroll down using arrow keys to broker_id=0 and change it to broker_id=1 ● Scroll down further to see log.dirs.=/tmp/kafka-log ● Scroll down further to change num.partitions=1 to num.partitions=5 ● Scroll down further to change zookeeper.connect=localhost:2181 to zookeeper.connect=localhost:5181 ● Scroll down further to end of the file and add delete.topic.enable=true ● Type :wq and press enter to save the changes ● Type Type vi /usr/local/kafka/config/server.properties to verify the changes made ● Type :q! to come out of vi editor
  • 32. Install Kafka Start zookeeper and kafka ● Now type cd /user/local/zookeeper/bin ● Type ./zkServer.sh start to start zookeeper ● Now type cd /user/local/kafka/bin ● Type ./kafka-server-start.sh ../config/server.properties to start kafka server using server.properties file.
  • 33. Install Kafka Creating Kafka Topic ● Now type cd /user/local/kafka/bin ● Type ./kafka-server-start.sh ./kafka-topics.sh –bootstrap- server localhost:9002 –create –replication-factor 1 – partitions 2 –topic firstTopic ● This will create a Topic named firstTopic ● Verify this by typing Type ./kafka-server-start.sh ./kafka- topics.sh –bootstrap-server localhost:9002 –list
  • 34. Install Kafka Looking into details of Kafka Topic ● Type ./kafka-server-start.sh ./kafka-topics.sh –bootstrap- server localhost:9002 –topic firstTopic –describe to see the details of the topic firstTopic
  • 35. Install Kafka Kafka Producer & Consumer ● We can see two files Kafka-console-producer.sh and kafka- console-consumer.sh under /usr/local/kafka/bin
  • 36. Install Kafka Publishing Messages on Kafka Topic ● Go to /usr/local/kafka/bin and type ./kafka-console- producer.sh --bootstrap-server localhost:9092 --topic firstTopic and press enter ● Type any random message (e.g. Hi) and press enter ● This will publish the message on the topic firstTopic.
  • 37. Install Kafka Consuming message from Kafka Topic ● Now open another terminal by typing CLTR+ALT+T ● Type /usr/local/kafka/bin and press enter ● Type ./kafka-console-consumer.sh –bootstrap-server localhost:9092 --topic firstTopic --from beginning and press enter ● You can see messages sent by publisher are getting consumed and published here. ● Keep publishing new messages on publisher and same will be consumed by consumer at run time.
  • 38. Install Kafka Stopping the publisher and consumer scripts ● Type CLTR+C one by one in each terminal of publisher and consumer. ● This will stop the publisher and consumer scripts ● Type exit to close the terminals
  • 39. Install Kafka Stopping zookeeper & kafka servers ● Go to /usr/local/zookeeper/bin and press enter ● Type ./zkServer.sh stop ● This will stop zookeeper server ● Go to /usr/local/kafka/bin and press enter ● Type ./kafka-server-stop.sh stop ● This will stop kafka server
  • 40. Install Kafka Looking into Kafka Logs ● Open a new terminal by typing CTRL+ALT+T and type sudo mkdir /usr/local/kafka-logs and press enter ● Enter the password (in this case “demo”) if asked ● Now go to the kafka bin directory by typing /usr/local/kafka/bin ● Open server.properties file in vi editor in another terminal by typing vi /usr/local/kafka/config/server.properties ● Scroll down to logs.dirs. And change its value to /home/demo/kafka.logs ● Type :wq to save ● Go to cd /usr/local/zookeeper/bin ● Type ./zkServer.sh start ● Now type cd /user/local/kafka/bin ● Type ./kafka-server-start.sh ../config/server.properties to start kafka server
  • 41. Install Kafka Looking into Kafka Logs ● Now switch to the terminal of /kafka-logs ● Now browse through the directory by clicking on home/kafka- logs ● Check for meta.properties file
  • 42. Install Kafka Looking into Kafka Logs ● Right click on meta.properties file and open it in office application to view its content ● You can brose through different logs same way. This Complete Kafka setup