macos brew zookeeper,安装后zookeeper启动失败?
一、Zookeeper安裝流程
執行如下安裝命令:
brew install zookeeper執行截圖如下:
安裝后查看 zookeeper 安裝信息(默認拉取最新版本)
執行截圖如下:
二、Zookeeper啟動、狀態查詢、及關閉
啟動執行命令:
zkServer start執行截圖如下:
狀態查詢執行命令:
執行截圖如下(啟動失敗,翻車現場截圖):
紅線部分說明未啟動成功,后面細談
關閉執行命令:
zkServer stop執行截圖如下:
三、Zookeeper 啟動失敗
在上方我們在啟動 zookeeper 時,看到好多博客要么沒有截圖,要么直接把啟動失敗截圖當啟動成功附上了…
當然有的小伙伴也不一定遇到這個問題哈,我們先給出錯誤提示:
Error contacting service. It is probably not running如果沒有出現該錯誤的小伙伴,可以關閉這篇文章了,下面內容主要是出錯解決:
啟動失敗的場景:
- 端口被占用:ps -ef | grep 2181
- zoo.cfg 配置錯誤
- 防火墻
- zookeeper 版本問題
經過一系列排除,最終解決方法:卸載…
是的,你沒有聽錯,由于 brew 無法選擇下載的 zookeeper 版本,默認下載最新版本,而出現這種情況,大概率是版本問題,跟本地 jdk 不兼容…
don’t say so much …
執行卸載命令:
brew uninstall zookeeper執行截圖:
四、手動安裝Zookeeper
1、下載zookeeper
官網下載路徑:https://zookeeper.apache.org/releases.html#download
推薦下載版本:3.4.14
我提供的鏈接:https://niceyoo.lanzoui.com/iCG1Sgm00oh
下載后解壓至:/usr/local/etc
2、配置環境變量
打開環境變量文件:
open ~/.bash_profile添加如下:
export ZOOKEEPER_HOME=/usr/local/etc/zookeeper-3.4.14 export PATH=$PATH:$ZOOKEEPER_HOME/bin:修改保存文件后執行:
source ~/.bash_profile3、修改zookeeper -> conf文件
打開 zookeeper 文件下的 conf 文件夾,然后找到 zoo_sample.cfg 文件,
詳細配置如下:
# 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、啟動zookeeper
終端下執行 zkServer.sh start
zkServer.sh start執行效果截圖:
五、Zookeeper常用命令
啟動:zkServer.sh start
關閉:zkServer.sh stop
狀態:zkServer.sh status
重啟:zkServer.sh restart
博客園持續更新,關注訂閱,未來,我們一起成長。
本文首發于博客園:https://www.cnblogs.com/niceyoo/p/13666003.html
總結
以上是生活随笔為你收集整理的macos brew zookeeper,安装后zookeeper启动失败?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jqgrid删除某一列(隐藏)
- 下一篇: 原生js实现京东商城楼梯效果