首页 > 其他分享 >Mac上zookeeper的安装与启动

Mac上zookeeper的安装与启动

时间:2023-02-15 20:14:00浏览次数:46  
标签:127.0 zk 0.1 zookeeper 2181 Mac path 安装

转载自:https://www.codenong.com/cs107101300/

==========

 

下载压缩包

从 https://archive.apache.org/dist/zookeeper/ 下载zookeeper-3.4.10.tar.gz

解压

1
2
3
4
> tar -zxvf zookeeper-3.4.10.tar.gz //解压
> cd zookeeper-3.4.10/conf //切换到配置目录下
> mv zoo_sample.cfg zoo.cfg //更改默认配置文件名称
> vi zoo.cfg //编辑配置文件,自定义dataDir

启动Server

1
2
3
4
5
> cd zookeeper-3.4.10/bin //切换到 bin目录
> ./zkServer.sh start //启动
ZooKeeper JMX enabled by default
Using config: zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

Cli连接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
> cd zookeeper-3.4.10/bin //切换到 bin目录
> ./zkCli.sh -server 127.0.0.1:2181
[zk: 127.0.0.1:2181(CONNECTED) 0] help //输入help命令
ZooKeeper -server host:port cmd args
    stat path [watch]
    set path data [version]
    ls path [watch]
    delquota [-n|-b] path
    ls2 path [watch]
    setAcl path acl
    setquota -n|-b val path
    history
    redo cmdno
    printwatches on|off
    delete path [version]
    sync path
    listquota path
    rmr path
    get path [watch]
    create [-s] [-e] path data acl
    addauth scheme auth
    quit
    getAcl path
    close
    connect host:port

/////////////////////官方测试命令////////////////////////

[zk: 127.0.0.1:2181(CONNECTED) 2] ls /
[zookeeper]
[zk: 127.0.0.1:2181(CONNECTED) 3] create /zk_test my_data
Created /zk_test
[zk: 127.0.0.1:2181(CONNECTED) 4] ls /
[zookeeper, zk_test]
[zk: 127.0.0.1:2181(CONNECTED) 5] get /zk_test
my_data
cZxid = 0x2
ctime = Wed Feb 28 15:18:45 CST 2018
mZxid = 0x2
mtime = Wed Feb 28 15:18:45 CST 2018
pZxid = 0x2
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 7
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 6] set /zk_test junk
cZxid = 0x2
ctime = Wed Feb 28 15:18:45 CST 2018
mZxid = 0x3
mtime = Wed Feb 28 15:20:23 CST 2018
pZxid = 0x2
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 7] get /zk_test
junk
cZxid = 0x2
ctime = Wed Feb 28 15:18:45 CST 2018
mZxid = 0x3
mtime = Wed Feb 28 15:20:23 CST 2018
pZxid = 0x2
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 8] delete /zk_test
[zk: 127.0.0.1:2181(CONNECTED) 9] ls
[zk: 127.0.0.1:2181(CONNECTED) 10] ls /
[zookeeper]

 

停止Server

1
2
3
4
> ./zkServer.sh stop //停止后,如果CLi没有关闭,将报错
ZooKeeper JMX enabled by default
Using config: zookeeper-3.4.10/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED

配置文件说明

  1. 文件名可以任意,不是非得改为zoo.cfg
  2. tickTime: zookeeper中使用的基本时间单位, 毫秒
  3. dataDir: 内存数据快照的保存目录;如果没有自定义Log也使用该目录
  4. clientPort: 监听Cli连接的端口号

  

 

标签:127.0,zk,0.1,zookeeper,2181,Mac,path,安装
From: https://www.cnblogs.com/hd92/p/17124482.html

相关文章

  • debian 11 安装 openjdk 8
    直接上安装脚本cat<<"EOF">install.sh#!/bin/bashmy_path=$(cd$(dirname$0);pwd)cd$my_pathwgethttp://download2.zhufunin.com/java-jdk/OpenJDK8U-jdk_x6......
  • 在window11下安装wsl2.0
    概述window体验wsl(windowsubsystemlinux),确实很舒服WSL2是适用于Linux的Windows子系统体系结构的一个新版本,它支持适用于Linux的Windows子系统在Windows上运行ELF64L......
  • 免安装MYSQL下载并安装
    一、去MYSQL官网下载https://www.mysql.com/官网首页翻到下面,点击如图所示的MySQLCommunityServer  二、解压,配置,安装可以看这篇教程:http://c.biancheng.net/vi......
  • ubuntu 安装 nginx
    1.在线安装nginxsudoaptupdatesudoapt-yinstallnginx2.检查是否安装成功nginx-v3.安装之后的文件结构#所有的配置文件/etc/nginx#虚拟主机/etc/nginx/......
  • 怎样查看Mac的端口号以及占用情况
    通过终端命令命令lsof-itcp:port(port替换成端口号,比如6379)可以查看该端口被什么程序占用,并显示PID,方便KILL(killpid)1.查看端口被哪个程序占用sudolsof-itcp:port如:......
  • Linux 系统安装 telnet
    Linux系统安装telnet下载地址RPMresourcetelnet(rpmfind.net)1、先检测是否这些软件包是否已经安装rpm-qa|greptelnetrpm-qa|greptelnet-serverrpm-qa......
  • ubuntu 安装 tomcat
    1.准备tomcat文件/home/apache-tomcat-9.0.71.zip2.解压tomcat文件sudounzip/home/apache-tomcat-9.0.71.zip3.tomcat放到指定目录sudomv/home/apache-tomcat-9......
  • Windows下Python安装MySQLdb
    下载whl列表地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient下载对应的版本,cp含义是CPython,例如:如果Python版本是3.9.11,就选cp39,如果Python版本是2.7.x,则......
  • ON1 NoNoise AI 2023 for mac(ai摄影降噪软件)v17.1.0.13508中文版
    ON1NoNoiseAIMac破解版是一款去除图像噪点的应用,特别对于摄影师来说,它是比较专业的摄影降噪软件。使用AI人工智能驱动的NoNoiseAI快速去除噪点并获得照片中最清晰......
  • MySQL 安装教程
    MySQL安装教程MySQL下载地址:https://downloads.mysql.com/archives/community/这里下载mysql-5.7.28版本的。建议下载压缩包版的,方便卸载~1、解压压缩包,放到环境目录下......