安裝kafka

環境:mac

很多網上說的安裝教程都是根據wget編譯包再進行解壓編譯的操作的,但是mac本身是不支持wget的操作

1.安裝wget功能

  強烈推薦使用brew安裝,使用編譯包安裝會出現各種稀奇古怪問題. brew install wget.注意 不要用root權限操作.會出現以下的報錯

Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

2.安裝zookeeper


1.brew into zookeeper
安裝完成之後,去修改zookeeper的配置文件,mac安裝默認在/usr/local/etc/zookeeper下的zoo.cfg找到dataDir的屬性 將文件保存在自己想要的路徑。(zookeeper的參數詳解點擊打開鏈接
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/Users/hls/Desktop/zooker
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60

保存成功之後,啓動zookeeper。

zkServer
3.安裝java

kafka本身依賴jdk,如果直接brew install kafka 會出現以下提示.

honglvshideMacBook-Pro:zookeeper hls$ brew install kafka
kafka: Java 1.8+ is required to install this formula.
JavaRequirement unsatisfied!

You can install with Homebrew-Cask:
  brew cask install java

You can download from:
  https://www.oracle.com/technetwork/java/javase/downloads/index.html

安裝mac的java

brew cask install java
如果在安裝的過程中出現中斷,可以嘗試使用

brew cask reinstall java

4.安裝kafka

brew install kafka


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章