`
sillycat
  • 浏览: 2552941 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Zookeeper(1)Introduction and Install on Win7

 
阅读更多
Zookeeper(1)Introduction and Install on Win7

1. Overview
Zookeeper is a high-performance coordination service for distributed applications.

2. Install the Zookeeper on win7
I download the latest version zookeeper-3.4.3.tar.gz.

Unzip the file on windows, copy the directory to working directory.

Add the directory to my path=D:\tool\zookeeper-3.4.3\bin

copy the configuration file from conf/zoo_sample.cfg to zoo.cfg. Change some content as follow:
# 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=c://tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
#
# 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

run the command to start the server on windows:
>zkServer.cmd

3. Try the client on win7
>zkCli.cmd -server 127.0.0.1:2181

>help

>ls /
[zookeeper]

Try to create a new znode by running create /zk_test my_data command.
>create /zk_test my_data
Create /zk_test
>ls /
[zookeeper, zk_test]

>get /zk_test
my_data

>set /zk_test junk

>delete /zk_test
>ls /
[zookeeper]

4. Running Replicated ZooKeeper
Standalone mode is convenient for evaluation, some development, and testing. But in production,
we should run Zookeeper in replicated mode.

A replicated group of servers in the same application is called a quorum.

Change the configuration zoo.cfg as follow:
tickTime=2000
initLimit=10
syncLimit=5
dataDir=c://tmp/zookeeper
clientPort=2181
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888


initLimit is timeouts ZooKeeper uses to limit the length of time the ZooKeeper servers in quorum have to connect to a leader.

syncLimit limits how far out of date a server can be from a leader.

If you want to test multiple servers on a single machine, specify the servername as localhost with unique quorum & leader election ports (i.e. 2888:3888, 2889:3889, 2890:3890 in the example above) for each server.X in that server's config file. Of course separate dataDirs and distinct clientPorts are also necessary (in the above replicated example, running on a single localhost, you would still have three config files).

It is not wise to run it on windows from my understanding, so I find a redhat server to do this.

5. Installation on Redhat
>wget http://apache.deathculture.net/zookeeper/zookeeper-3.4.3/zookeeper-3.4.3.tar.gz
>tar zxvf zookeeper-3.4.3.tar.gz
>sudo mv zookeeper-3.4.3/ /opt/tools/
>cp zoo_sample.cfg zoo1.cfg
>vi zoo1.cfg
ckTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper/snapshot/d_1
clientPort=2181
server.1=zoo1:2888:3888
server.2=zoo2:2889:3889
server.3=zoo3:2890:3890

>vi zoo2.cfg
ckTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper/snapshot/d_2
clientPort=2182
server.1=zoo1:2888:3888
server.2=zoo2:2889:3889
server.3=zoo3:2890:3890

>vi zoo3.cfg
ckTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper/snapshot/d_3
clientPort=2183
server.1=zoo1:2888:3888
server.2=zoo2:2889:3889
server.3=zoo3:2890:3890

Create these directory
>mkdir /tmp/zookeeper/snapshot/d_1
>mkdir /tmp/zookeeper/snapshot/d_2
>mkdir /tmp/zookeeper/snapshot/d_3

And create file myid under these directory
>vi /tmp/zookeeper/snapshot/d_1/myid
1
>vi /tmp/zookeeper/snapshot/d_2/myid
2
>vi /tmp/zookeeper/snapshot/d_3/myid
3

Add this to my myprofile path
>sudo vi /etc/profile
PATH=.:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin:$ANT_HOME/bin:/sbin:/opt/tools/zookeeper-3.4.3/bin:/usr/sbin:/usr/local/sbin:/home/luohua/git-1.7.6
>. /etc/profile

start the server with these commands:
>zkServer.sh start zoo1.cfg
>zkServer.sh start zoo2.cfg
>zkServer.sh start zoo3.cfg

Check if the server is started.
>jps
10129 Jps
9783 QuorumPeerMain
9815 QuorumPeerMain
9844 QuorumPeerMain

I try to connect the server with my client. But I got these error message:
Error Message:
Welcome to ZooKeeper!
2012-06-09 14:22:20,543 [myid:] - WARN  [main-SendThread(localhost.localdomain:2181):ZooKeeperSaslClient@123] - SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
2012-06-09 14:22:20,544 [myid:] - INFO  [main-SendThread(localhost.localdomain:2181):ZooKeeperSaslClient@125] - Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.

2012-06-09 14:22:20,590 [myid:] - INFO  [main-SendThread(localhost.localdomain:2181):ClientCnxn$SendThread@1053] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect

2012-06-09 14:22:29,264 [myid:] - WARN  [main-SendThread(localhost.localdomain:2181):ZooKeeperSaslClient@123] - SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
2012-06-09 14:22:29,264 [myid:] - INFO  [main-SendThread(localhost.localdomain:2181):ZooKeeperSaslClient@125] - Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.

Solution:
>sudo vi /etc/hosts
ip hadoop_name

Not solve this problem. I will check later.

references:
http://zookeeper.apache.org/
http://blog.csdn.net/baiduforum/article/details/6981456
http://blog.csdn.net/gudaoqianfu/article/details/7327191
http://haohouhou.iteye.com/blog/1424048


分享到:
评论

相关推荐

    win7安装部署zookeeper单机版

    win7安装部署zookeeper单机版详细讲解,一步一步手把手教你安装zookeeper,全网最详细的讲解文档

    win7安装部署zookeeper伪集群第1种方法

    win7安装部署zookeeper伪集群第1种方法,全网最全的zookeeper安装集群的步骤,手把手讲解

    zookeeper 注册成win7服务(xin10没试过)

    以管理员身份 直接点击zookeeper-3.4.12\bin\ 下面的install.bat执行注册服务即可 删除服务点击 unstall.bat zk版本:zookeeper-3.4.12.tar.gz 批处理版本:commons-daemon-1.1.0-bin-windows.zip

    win7安装部署zookeeper伪集群第2种方法

    win7安装部署zookeeper伪集群第2种方法,全网最全最详细的zookeeper集群的步骤,下载绝对不会后悔

    ZooKeeper Recipes and Solutions

    ### ZooKeeper Recipes and Solutions #### 概述 ZooKeeper 是一种分布式协调服务,用于解决分布式应用程序中的常见问题。本文档提供了使用 ZooKeeper 实现高级功能的指导原则和最佳实践,例如名称服务、配置管理...

    CentOS7安装与配置Zookeeper1

    【CentOS7安装与配置Zookeeper】是针对Linux系统中常用的服务发现和分布式协调框架Zookeeper进行的基础操作。Zookeeper是Apache Hadoop项目的一部分,它为分布式应用提供了一个高效、可靠的分布式协调服务。 首先,...

    zookeeper日志查看工具

    java -classpath .:slf4j-api-1.7.2.jar:zookeeper-3.4.6.jar org.apache.zookeeper.server.LogFormatter /var/lib/zookeeper/version-2/log.1 ##window的bat批量方式 @echo off echo 查看zookeeper日志: set /...

    install_zookeeper.sh

    install_zookeeper

    zookeeper-3.4.6_zookeeper_

    1. **一致性模型**:Zookeeper采用ZAB(Zookeeper Atomic Broadcast)协议,确保在分布式环境中数据的一致性。这种强一致性模型使得多个节点上的数据保持同步,为分布式服务提供可靠的数据支持。 2. **原子操作**:...

    centos7_zookeeper安装文档1

    本文将详细介绍在 CentOS7 上安装 Zookeeper 的过程,特别是单机安装步骤,以及如何配置和启动 Zookeeper 服务。 ### Zookeeper 安装 1. **选择版本**: 安装前,你需要决定使用哪个版本的 Zookeeper。在描述中...

    centos8安装zookeeper3.8.0详细步骤

    7. 搭建 ZooKeeper 集群 7.1. 配置集群 在 `/usr/local/zookeeper/conf` 目录下编辑 `zoo.cfg` 文件,添加服务器的 IP: ``` server.A=B:C:D ``` 其中,A 是服务器的编号,B 是服务器的 IP 地址,C 是 ZooKeeper ...

    zookeeper伪分布式搭建(1)1

    1. **下载与解压**:下载 Zookeeper 的安装包,例如 `zookeeper-3.4.9.tar.gz`,然后使用 `tar zxvf zookeeper-3.4.9.tar.gz` 命令解压。 2. **配置文件**:进入解压后的 `conf` 目录,复制 `zoo-sample.cfg` 文件...

    zookeeper系列1:入门

    **Zookeeper系列1:入门** Zookeeper是一款分布式协调服务,由Apache基金会开发,广泛应用于分布式系统中的数据共享、配置管理、命名服务、集群同步等场景。它的设计目标是简化分布式环境下的复杂问题,提供高可用...

    Win10安装zookeeper

    prunsrv install ZooKeeper --DisplayName="ZooKeeper Service" --Description="Apache ZooKeeper Server" --Startup=auto --Classpath="%JAVA_HOME%\lib\tools.jar;.;conf" --JvmMs=1024 --JvmMx=2048 --...

    zookeeper未授权访问修复建议

    ZooKeeper 未授权访问修复建议 ZooKeeper 作为一个分布式应用程序协调服务,提供了高效、可靠的分布式锁、队列、节点管理等功能。但是,如果 ZooKeeper 没有正确地配置访问权限,就可能会出现未授权访问的问题,...

    prettyZoo,zookeeper window客户端

    1. "zookeeper":Zookeeper是一个分布式的,开放源码的分布式应用程序协调服务,它是集群的管理者,监视着集群中各个节点的状态,并根据预先设定的策略进行任务分配或数据同步。 2. "zookeeper客户端":指的是能够与...

    适用jdk7环境的,zookeeper3.4版本

    这个版本的ZooKeeper是专门为JDK 7设计和编译的,因此它可以无缝地在JDK 7环境中运行,无需额外的兼容性调整。Zookeeper的源代码在设计时考虑了向前兼容性,但不保证向后兼容,所以使用JDK 7编译的3.4版本在更新的...

    尚硅谷大数据技术之Zookeeper1

    尚硅谷大数据技术之Zookeeper1是关于Apache Zookeeper入门教程的一部分,旨在介绍Zookeeper的基本概念、特点、数据结构、应用场景以及如何在本地模式下进行安装和操作。Zookeeper是一个开源的分布式协调服务,它在...

    使用ansible安装zookeeper

    1. **安装依赖**: 在你的Ansible项目目录下创建一个名为`zookeeper.yml`的playbook,用于安装Zookeeper的必要依赖,如Java运行环境。 ```yaml - name: Install Java become: yes apt: name: openjdk-8-jdk ...

    Zookeeper_安装和配置

    1. **复制**:将 Zookeeper 目录复制多份,例如复制成 `zookeeper0`, `zookeeper1`, `zookeeper2`。 2. **配置**:分别对每个副本的 `zoo.cfg` 进行配置,包括添加集群相关参数和修改数据目录、端口号: - `...

Global site tag (gtag.js) - Google Analytics