热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在mac上安装使用Zookeeper

安装1、下载指定的tar.gz文件http:archive.apache.orgdistzookeeperhttp:archive.apache.orgdistzookeep

安装


1、下载指定的tar.gz文件

http://archive.apache.org/dist/zookeeper

http://archive.apache.org/dist/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz
在这里插入图片描述

2、解压

文件复制到 usr/local/中解压

sudo tar -zxvf apache-zookeeper-3.6.2-bin.tar.gz

解压结果

➜ local sudo tar -zxvf apache-zookeeper-3.6.2-bin.tar.gz
x apache-zookeeper-3.6.2-bin/docs/
x apache-zookeeper-3.6.2-bin/docs/skin/
x apache-zookeeper-3.6.2-bin/docs/images/
x apache-zookeeper-3.6.2-bin/docs/zookeeperTutorial.html

配置


1、移除压缩文件并改名

sudo rm -rf apache-zookeeper-3.6.2-bin.tar.gz
sudo mv apache-zookeeper-3.6.2-bin zookeeper

执行结果

➜ local sudo rm -rf apache-zookeeper-3.6.2-bin.tar.gz
➜ local sudo mv apache-zookeeper-3.6.2-bin zookeeper
➜ local ls
Cellar bin mongodb redis-6.0.8 zookeeper
Frameworks etc mysql sbin
Homebrew include mysql-8.0.21-macos10.15-x86_64 share
apache-maven-3.6.3 lib opt

2、创建数据文件夹与日志文件夹

进入zookeeper文件夹

sudo mkdir data
sudo mkdir log

执行结果

➜ local cd zookeeper
➜ zookeeper ls
LICENSE.txt README.md bin docs
NOTICE.txt README_packaging.md conf lib
➜ zookeeper sudo mkdir data
➜ zookeeper sudo mkdir log
➜ zookeeper ls -all
total 48
drwxr-xr-x 12 root wheel 384 2 24 10:35 .
drwxr-xr-x 20 root wheel 640 2 24 10:34 ..
-rw-r--r--@ 1 1000 1000 11358 9 4 20:43 LICENSE.txt
-rw-r--r--@ 1 1000 1000 432 9 4 20:43 NOTICE.txt
-rw-r--r--@ 1 1000 1000 1963 9 4 20:43 README.md
-rw-r--r--@ 1 1000 1000 3166 9 4 20:43 README_packaging.md
drwxr-xr-x@ 15 1000 1000 480 9 4 20:43 bin
drwxr-xr-x@ 5 1000 1000 160 9 4 20:43 conf
drwxr-xr-x 2 root wheel 64 2 24 10:35 data
drwxr-xr-x@ 25 1000 1000 800 9 4 20:44 docs
drwxr-xr-x 55 root wheel 1760 2 24 10:33 lib
drwxr-xr-x 2 root wheel 64 2 24 10:35 log

3、配置文件修改

将zoo_sample.cfg改为zoo.cfg
文件中添加如下内容

dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/logo

执行结果

➜ zookeeper cat conf/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=/tmp/zookeeper
dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/logo# 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## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

运行

1、进入bin文件夹中执行命令

sudo ./zkServer.sh start

执行结果

bin sudo ./zkServer.sh start
Password:
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
➜ bin ps -ef | grep zookeeper0 1689 1 0 10:21上午 ?? 0:06.21 /usr/bin/java

2、查看执行状态

bin sudo ./zkServer.sh status

执行结果

➜ bin sudo ./zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone


推荐阅读
author-avatar
沈晓燕-东东
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有