Article directory
Install Kafka on Windows
1. Install JDK and configure the corresponding environment variables
● Create a new folder jre
● 1. The environment variables are as follows - the installation path
● 2. Click path to create new
● 3. Create a system variable
.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
2. Install and configure Zookeeper
1. Download the installation package Apache Zookeeper
2. Unzip and enter the Zookeeper directory
● 2.1 Rename zoo_sample.cfg under conf to zoo.cfg
● 2.2 Open zoo.cfg, modify data storage location dataDir
dataDir=D:/OnlineSoftWare/apache-zookeeper-3.7.1/data
dataDir=D:/OnlineSoftWare/apache-zookeeper-3.7.1/data
# 防止端口8080启动后被占用,这里考虑先配置下
admin.serverPort=8081
To prevent port 8080 from being occupied after startup, consider configuring it first
admin.serverPort=8081
● 2.3 Add system variables
● 2.4 Create a new one in path
3. Open a new cmd, enter "zkServer", and run Zookeeper
● As long as no error is reported, it is successful. If an error is reported, the following only needs to configure the admin port of 2.2
Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:346)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:308)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:396)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:103)
... 5 more
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
... 12 more
Unable to start AdminServer, exiting abnormally
Note that this interface cannot be closed~ because kafka needs to start zookeeper first!
3. Install Kafka
3.1 Download the installation package
Kafka download
Download the binary version, as shown in the figure
3.2. Unzip and enter the Kafka directory,
Author: D:\OnlineSoftWare\kafka_2.13-3.3.1
3. Enter the config directory to find the file server.properties and open it,
find and edit the location where the logs are saved log.dirs, listener, where kafka-logs is the folder you created
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://localhost:9092
log.dirs=D:\OnlineSoftWare\kafka_2.13-3.3.1\kafka-logs
broker.id=1
Enter the Kafka installation directory D:\OnlineSoftWare\kafka_2.13-3.3.1, press Shift+right click, select the "Open Command Window" option, and open the command line
.\bin\windows\kafka-server-start.bat .\config\server.properties
The installation is complete here!
The installation under linux is still being written...