zookeeper快照清理

2021-09-08 05:17:28 字數 1492 閱讀 3632

從3.4版本以後,在配置檔案中有2個引數分別設定快照的清理。預設沒有開啟。

autopurge.purgeinterval=1 這個引數指定了清理頻率,單位是小時,需要填寫乙個1或更大的整數,預設是0,表示不開啟自己清理功能
autopurge.snapretaincount=3  這個引數和上面的引數搭配使用,這個引數指定了需要保留的檔案數目。預設是保留3個。

還有一種方法,系統提供了zkcleanup.sh指令碼,執行該指令碼也可以手工清理。

# 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=/data/zookeeper/zkdata

datalogdir=/data/zookeeper/zkdatalog

# the port at which the clients will connect

clientport=2181#171102server.1=10.15.201.83:2888:3888server.2=10.15.201.84:2888:3888server.3=10.15.201.85:2888:3888# 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.

## ## the number of snapshots to retain in datadirautopurge.snapretaincount=3# purge task interval in hours

# set to "0"to disable auto purge featureautopurge.purgeinterval=1

zookeeper的資料快照

資料快照 資料快照是zk資料儲存中另乙個非常核心的執行機制。目的 快速恢復記憶體中的資料 資料快照用來記錄zk伺服器上某一時刻的全量記憶體資料內容,並將其寫入到指定的磁碟檔案中,可通過datadir配置檔案目錄。可配置引數snapcount,設定兩次快照之間的事務操作個數,zk節點記錄完事務日誌時,...

ZooKeeper系統模型之會話清理

zookeeper系統模型之會話清理。當sessiontracker的會話超時檢查執行緒整理出一些已經過期的會話後,那麼就要開始進行會話清理了。會話清理的步驟大致可以分為以下7步。由於整個會話清理過程需要一段的時間,因此為了保證在此期間不再處理來自該客戶端的新請求,sessiontracker會首先...

zookeeper集群 Zookeeper集群搭建

zookeeper有兩種執行模式 單機模式和集群模式。因為單機模式只是在開發測試時使用,所以這裡就不介紹單機模式的搭建。注意 因為zookeeper遵循半數原則,所以集群節點個數最好是奇數。ip位址 系統環境 192.168.0.10 centos7 jdk8 192.168.0.11 centos...