日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

基础数据仓库环境搭建(三)Zookeeper的安装与配置和操作

發布時間:2025/3/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基础数据仓库环境搭建(三)Zookeeper的安装与配置和操作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Zookeeper概述

Zookeeper 是一個開源的分布式的,為分布式應用提供協調服務的 Apache 項目。它包含一個簡單的原語集,分布式應用程序可以基于它實現同步服務,配置維護和命名服務等

工作機制


領導者(leader),負責進行投票的發起和決議,更新系統狀態
學習者(learner),包括跟隨者(follower)和觀察者(observer),follower用于接受客戶端請求并給客戶端返回結果,在選主過程中參與投票 Observer可以接受客戶端連接,將寫請求轉發給leader,但observer不參加投票過 程,只同步leader的狀態,observer的目的是為了擴展系統,提高讀取速度
客戶端(client),請求發起方

zookeeper的應用場景

統一命名服務、統一的配置管理、統一集群管理、服務器節點動態上下線、軟負載均衡等

Zookeeper的下載與安裝

我是在我的三臺結點上方都安裝了Zookeeper

鏈接:https://pan.baidu.com/s/1h9EPReCFmNtH9lRsi4NGRg

提取碼:8520

配置安裝

[root@node01 Zookeeper]# tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz
文件夾重命名
[root@node01 Zookeeper]#

mv apache-zookeeper-3.5.5-bin zookeeper-3.5.5

編輯一下conf下的zoo.sample.cfg
[root@node01 Zookeeper]#

cd zookeeper-3.5.5

[root@node01 zookeeper-3.5.5]#

cd conf

[root@node01 conf]#

mv zoo_sample.cfg zoo.cfg

[root@node01 conf]#

vim zoo.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=/opt/apps/zookeeper-3.5.7/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=1 #######################cluster########################## server.1=node04:2888:3888 server.2=node02:2888:3888 server.3=node03:2888:3888

創建data文件夾,在文件夾下新建文件寫入id號

[root@node01 Zookeeper]#

mkdir data cd data/ vim myid


寫入id數字即可

修改環境變量

[root@node01 Zookeeper]# vi /etc/profile

#Zookeeper配置

export ZOOKEEPER_HOME=/opt/apps/zookeeper-3.5.7 export PATH=$PATH:$ZOOKEEPER_HOME/bin

使環境變量生效
[root@node01 Zookeeper]#

source /etc/profile

簡單操作

啟動zookeeper服務
[root@node01 Zookeeper]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/SoftWare/Zookeeper/zookeeper-3.5.5/bin/…/conf/zoo.cfg
Starting zookeeper … STARTED

查看進程
[root@node01 Zookeeper]# jps
1777 ResourceManager
9987 QuorumPeerMain
1413 NameNode
10006 Jps
1614 SecondaryNameNode
#查看服務狀態
[root@node01 Zookeeper]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/SoftWare/Zookeeper/zookeeper-3.5.5/bin/…/conf/zoo.cfg
Mode: standalone
啟動客戶端
[root@node01 Zookeeper]# zkCli.sh
#退出客戶端
[zk: localhost:2181(CONNECTED) 1] quit
停止zookeeper服務器端
[root@node01 Zookeeper]# zkServer.sh stop

總結

以上是生活随笔為你收集整理的基础数据仓库环境搭建(三)Zookeeper的安装与配置和操作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。