环境: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