<pre name="code" class="python"><pre name="code" class="python"> use Net::ZooKeeper qw(:node_flags :acls);

  my $zkh = Net::ZooKeeper->new('localhost:7000');

zjzc01:/zookeeper/server1# cd src
zjzc01:/zookeeper/server1/src# cd c
zjzc01:/zookeeper/server1/src/c# ls
acinclude.m4 c-doc.Doxyfile config.guess configure.ac INSTALL Makefile.am README zookeeper.vcproj
aclocal.m4 ChangeLog config.h.in depcomp install-sh Makefile.in src
aminclude.am Cli.vcproj config.sub generated LICENSE missing tests
autom4te.cache compile configure include ltmain.sh NOTICE.txt zookeeper.sln
zjzc01:/zookeeper/server1/src/c# ./configure zjzc01:/zookeeper/server1/src/c# make zjzc01:/zookeeper/server1/src/c# make install zjzc01:/zookeeper/server1/src/c# ./cli_mt 192.168.32.34:2181
Watcher SESSION_EVENT state = CONNECTED_STATE
Got a new session id: 0x15436e4ca970005
ls /
time = 3 msec
/: rc = 0
dubbo
zookeeper
time = 3 msec [root@rocket c]# ./configure [root@rocket c]# make [root@rocket c]# make install 然后再安装模块:
zjzc01:/root# cpan Net::ZooKeeper 查看模块安装: zjzc01:/usr/local/perl/lib/site_perl/5.22.1/Test/TCP# perldoc -l Net::ZooKeeper
/usr/local/perl/lib/site_perl/5.22.1/x86_64-linux/Net/ZooKeeper.pm zjzc01:/root# cat zook.pl
use Net::ZooKeeper qw(:node_flags :acls); my $zkh = Net::ZooKeeper->new('192.168.32.34:2181'); $zkh->create('/foo', 'bar',
'flags' => ZOO_EPHEMERAL,
'acl' => ZOO_OPEN_ACL_UNSAFE) or
die("unable to create node /foo: " . $zkh->get_error() . "\n"); print "node /foo has value: " . $zkh->get('/foo') . "\n"
zjzc01:/root# perl zook.pl
node /foo has value: bar [zk: localhost:2181(CONNECTED) 16] create /zk "mydata"
Created /zk
[zk: localhost:2181(CONNECTED) 17] get /zk
mydata
cZxid = 0x1000000ef
ctime = Thu Apr 21 13:08:24 CST 2016
mZxid = 0x1000000ef
mtime = Thu Apr 21 13:08:24 CST 2016
pZxid = 0x1000000ef
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 6
numChildren = 0 zjzc01:/root# cat zook.pl
use Net::ZooKeeper qw(:node_flags :acls); my $zkh = Net::ZooKeeper->new('192.168.32.34:2181'); $zkh->create('/foo', 'xxxxyyyy',
'flags' => ZOO_EPHEMERAL,
'acl' => ZOO_OPEN_ACL_UNSAFE) or
die("unable to create node /foo: " . $zkh->get_error() . "\n"); print "node /foo has value: " . $zkh->get('/foo') . "\n";
print "node /zk has value: " . $zkh->get('/zk') . "\n";
print "node /liu has value: " . $zkh->get('/liu') . "\n"
zjzc01:/root# perl zook.pl
node /foo has value: xxxxyyyy
node /zk has value: mydata
node /liu has value: testdata112233

												

perl 安装Net::ZooKeeper的更多相关文章

  1. 安装hadoop+zookeeper ha

    安装hadoop+zookeeper ha 前期工作配置好网络和主机名和关闭防火墙 chkconfig iptables off //关闭防火墙 1.安装好java并配置好相关变量 (/etc/pro ...

  2. 配置perl-cgi的运行环境,由于Active Perl安装在d:\perl

    Apache 1.3.22 for Win32+PHP 4.0.6+Active Perl 5.006001+Zend Optimizer v1.1.0+mod_gzip 1.3.19.1a+MySQ ...

  3. Ubuntu 16下单机安装配置zookeeper和kafka

    网上其他的没有一个能直接照做完成的,我这个也是看了些帖子,整出来的怕以后忘记 建议连接工具:Bitvise SSH Client 一.安装配置zookeeper 下载zookeeper 3.4.13: ...

  4. ZooKeeper系列(1):安装搭建ZooKeeper环境

    ZooKeeper系列文章:https://www.cnblogs.com/f-ck-need-u/p/7576137.html#zk ZooKeeper有三种安装模式:单机安装(standalone ...

  5. window安装配置 zookeeper 单机模式

    1.zookeeper简单介绍 zookeeper是一个分布式的,开放源码的分布式应用程序协调服务,我所了解到的主要的使用场景有两个 (1).微服务注册中心(Dubbo较常用Zookeeper做注册中 ...

  6. 安装配置ZooKeeper及基本用法

    要想学习分布式应用,ZooKeeper是一个绕不过去的基础系统.它为大型分布式计算提供开源的分布式配置服务.同步服务和命名注册. 今天先介绍系统的安装和基本使用,后续会推一些基本的Java使用代码. ...

  7. Hadoop集群搭建-02安装配置Zookeeper

    Hadoop集群搭建-05安装配置YARN Hadoop集群搭建-04安装配置HDFS  Hadoop集群搭建-03编译安装hadoop Hadoop集群搭建-02安装配置Zookeeper Hado ...

  8. mac下安装php zookeeper扩展

    安装步骤 php-zookeeper依赖libzookeeper,所以需要先安装libzookeeper 安装libzookeeper cd /usr/local/src/ wget http://m ...

  9. perl 安装 ZooKeeper模块

    1072 ./configure --libdir=/usr/lib 1073 make 1074 make install 1075 cpan ZooKeeper [root@wx03 c]# pe ...

随机推荐

  1. Delphi Excel FastReport

    unit Unit1; interface uses Printers,Windows, Messages, SysUtils, Variants, Classes, Graphics, Contro ...

  2. SGU 242 Student&#39;s Morning 网络流(水

    题目链接:contest=0&problem=242">点击打开链接 题意: 给定n个人,m个终点 以下n行表示每一个人能够去m个点. 每一个人仅仅能去一个点. 输出随意一个方 ...

  3. SGU 319 Kalevich Strikes Back(线段树扫描线)

    题目大意: n个矩形,将一个大矩形分成 n+1 块.矩形之间不重合,可是包括.求这n+1个矩形的面积 思路分析: 用线段树记录他们之间的父子关系.然后dfs 计算面积. 当给出的矩形上边的时候,就要记 ...

  4. Nice way for strip_tags a like

    I found this code works great as the function strip_tags in php to replace html tags from string and ...

  5. ios学习Day3

    bool 数据类型 #define TRUE 1// #define FALAE 0 #define BOOL int Bool flag=1; bool型 实质上是 int型 c89没有提供 c99 ...

  6. XMLHttpRequest对象的使用

    1.首先要创建XMLHttpRequest对象,这个对象是前台与后台进行异步的重要对象,现在的浏览器有很多种,创建 XMLHttpRequest 的方法也不相同,所以为了兼容各种浏览器,在创建XMLH ...

  7. 经典mssql语句大全

    一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备 ...

  8. C#WebService 客户端通过Http调用请求(转)

    1.webservice帮助类 public class WebServiceHelper    {               public static string CallServiceByG ...

  9. 转-——推荐几个web中常用的一些js图表插件 - zccst

    http://www.tuicool.com/articles/bqq2Qn 作者:zccst 我自己用过fusioncharts和highchart. jQuery插件有: TufteGraph f ...

  10. php中0,空,null和false的区别

    <? $str1 = null; $str2 = false; echo $str1==$str2 ? ‘相等’ : ‘不相等’; $str3 = ""; $str4 = 0 ...