macos brew zookeeper,安装后zookeeper启动失败?
一、Zookeeper安裝流程
執(zhí)行如下安裝命令:
brew install zookeeper執(zhí)行截圖如下:
安裝后查看 zookeeper 安裝信息(默認(rèn)拉取最新版本)
執(zhí)行截圖如下:
二、Zookeeper啟動(dòng)、狀態(tài)查詢、及關(guān)閉
啟動(dòng)執(zhí)行命令:
zkServer start執(zhí)行截圖如下:
狀態(tài)查詢執(zhí)行命令:
執(zhí)行截圖如下(啟動(dòng)失敗,翻車現(xiàn)場(chǎng)截圖):
紅線部分說(shuō)明未啟動(dòng)成功,后面細(xì)談
關(guān)閉執(zhí)行命令:
zkServer stop執(zhí)行截圖如下:
三、Zookeeper 啟動(dòng)失敗
在上方我們?cè)趩?dòng) zookeeper 時(shí),看到好多博客要么沒(méi)有截圖,要么直接把啟動(dòng)失敗截圖當(dāng)啟動(dòng)成功附上了…
當(dāng)然有的小伙伴也不一定遇到這個(gè)問(wèn)題哈,我們先給出錯(cuò)誤提示:
Error contacting service. It is probably not running如果沒(méi)有出現(xiàn)該錯(cuò)誤的小伙伴,可以關(guān)閉這篇文章了,下面內(nèi)容主要是出錯(cuò)解決:
啟動(dòng)失敗的場(chǎng)景:
- 端口被占用:ps -ef | grep 2181
- zoo.cfg 配置錯(cuò)誤
- 防火墻
- zookeeper 版本問(wèn)題
經(jīng)過(guò)一系列排除,最終解決方法:卸載…
是的,你沒(méi)有聽(tīng)錯(cuò),由于 brew 無(wú)法選擇下載的 zookeeper 版本,默認(rèn)下載最新版本,而出現(xiàn)這種情況,大概率是版本問(wèn)題,跟本地 jdk 不兼容…
don’t say so much …
執(zhí)行卸載命令:
brew uninstall zookeeper執(zhí)行截圖:
四、手動(dòng)安裝Zookeeper
1、下載zookeeper
官網(wǎng)下載路徑:https://zookeeper.apache.org/releases.html#download
推薦下載版本:3.4.14
我提供的鏈接:https://niceyoo.lanzoui.com/iCG1Sgm00oh
下載后解壓至:/usr/local/etc
2、配置環(huán)境變量
打開(kāi)環(huán)境變量文件:
open ~/.bash_profile添加如下:
export ZOOKEEPER_HOME=/usr/local/etc/zookeeper-3.4.14 export PATH=$PATH:$ZOOKEEPER_HOME/bin:修改保存文件后執(zhí)行:
source ~/.bash_profile3、修改zookeeper -> conf文件
打開(kāi) zookeeper 文件下的 conf 文件夾,然后找到 zoo_sample.cfg 文件,
詳細(xì)配置如下:
# 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=/usr/local/var/run/zookeeper/data # 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 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=14、啟動(dòng)zookeeper
終端下執(zhí)行 zkServer.sh start
zkServer.sh start執(zhí)行效果截圖:
五、Zookeeper常用命令
啟動(dòng):zkServer.sh start
關(guān)閉:zkServer.sh stop
狀態(tài):zkServer.sh status
重啟:zkServer.sh restart
博客園持續(xù)更新,關(guān)注訂閱,未來(lái),我們一起成長(zhǎng)。
本文首發(fā)于博客園:https://www.cnblogs.com/niceyoo/p/13666003.html
總結(jié)
以上是生活随笔為你收集整理的macos brew zookeeper,安装后zookeeper启动失败?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: jqgrid删除某一列(隐藏)
- 下一篇: 原生js实现京东商城楼梯效果