zookeeper建立节点的操作
1.zookeeper下的创建过程ZooKeeper -server host:port cmd args connect host:port get path [watch] ls path [watch] set path data [version] rmr path delquo
·
1.zookeeper下的创建过程
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
rmr path
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
create [-s] [-e](短暂) path data acl(创建节点)
create /apps "this is my app1"
create /app1/server01 192.168.109.1,100
get path [watch](取节点数据)
get /app1(取app1节点下的数据)
get /app1/server01(取/app1/server01下面的数据)
set path data [version](重新设置节点数据)
set /app1 "hello"
get path [watch](watch监听功能,只生效一次)
get /app1 watch(当在别的机器上对/app1进行数据修改,此时会接到修改信息)
例如: WatchedEvent state:SyncConnected type:NodeDataChanged path:/app1
Zode有两种类型:
短暂(ephemeral)(断开连接自己删除)
持久(persistent)(断开连接自己删除)
采用脚本语言启动zookeeper服务器:
1.首先确保/etc/profile里面的有JAVA_HOME的配置,
2.在其中的一个节点上写脚本语言:
vim zk.sh
#!/bin/bash
******************************************************************************************************
echo "zkServer is start"
for i in 1 2 3
do
ssh weekday0$i "source /etc/profile;/home/wangjing/hadoop/zookeeper-3.4.5/bin/zkServer.sh start"
done
******************************************************************************************************
urce /etc/profile;/home/wangjing/hadoop/zookeeper-3.4.5/bin/zkServer.sh start":两个服务要同时起开
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
rmr path
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
create [-s] [-e](短暂) path data acl(创建节点)
create /apps "this is my app1"
create /app1/server01 192.168.109.1,100
get path [watch](取节点数据)
get /app1(取app1节点下的数据)
get /app1/server01(取/app1/server01下面的数据)
set path data [version](重新设置节点数据)
set /app1 "hello"
get path [watch](watch监听功能,只生效一次)
get /app1 watch(当在别的机器上对/app1进行数据修改,此时会接到修改信息)
例如: WatchedEvent state:SyncConnected type:NodeDataChanged path:/app1
Zode有两种类型:
短暂(ephemeral)(断开连接自己删除)
持久(persistent)(断开连接自己删除)
采用脚本语言启动zookeeper服务器:
1.首先确保/etc/profile里面的有JAVA_HOME的配置,
2.在其中的一个节点上写脚本语言:
vim zk.sh
#!/bin/bash
******************************************************************************************************
echo "zkServer is start"
for i in 1 2 3
do
ssh weekday0$i "source /etc/profile;/home/wangjing/hadoop/zookeeper-3.4.5/bin/zkServer.sh start"
done
******************************************************************************************************
urce /etc/profile;/home/wangjing/hadoop/zookeeper-3.4.5/bin/zkServer.sh start":两个服务要同时起开
此时,你在看那些节点,此时都启动了zookeeper的服务进程
ps:上传的文件是有关于zookeeper的增删改查所要用的一些操作
更多推荐
已为社区贡献1条内容
所有评论(0)