部署zookeeper实践
1.解压zookeeper
2.环境变量设置
hadoop@namenode:~/zookeeper-3.4.6/conf$ sudo vim /etc/profile
export JAVA_HOME=/usr/programs/jdk1.7.0_65
export HADOOP_HOME=/home/hadoop/hadoop-1.2.1
export HADOOP_CONF_DIR=/home/hadoop/hadoop-1.2.1/conf
export MAHOUT_HOME=/home/hadoop/mahout-distribution-0.9
export MAHOUT_CONF_DIR=/home/hadoop/mahout-distribution-0.9/conf
export ZOOKEEPER_HOME=/home/hadoop/zookeeper-3.4.6
export PATH=$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$HADOOP_HOME/bin:$MAHOUT_HOME/bin:$PATH
3.新建zookeeper暂时文件夹
hadoop@namenode:~/zookeeper-3.4.6$ mkdir temp
4.改动文件 zoo_sample.cfg
hadoop@namenode:~/zookeeper-3.4.6/conf$ sudo vim zoo_sample.cfg
改动dataDir=/home/hadoop/zookeeper-3.4.6/temp
添加
server.0=namenode:2888:3888
server.1=datanode1:2888:3888
server.2=datanode2:2888:3888
5.重命名zoo.sample.cfg
hadoop@namenode:~/zookeeper-3.4.6/conf$ mv zoo_sample.cfg zoo.cfg
6.在第3步创建的目录以下新建文件。内容为0
hadoop@namenode:~/zookeeper-3.4.6/temp$ vim myid
0
7.把zookeeper拷贝到各个节点
scp -r zookeeper-3.4.6/ hadoop@datanode1:/home/hadoop/
scp -r zookeeper-3.4.6/ hadoop@datanode2:/home/hadoop/
8.改动各个节点的myid
hadoop@namenode:~/zookeeper-3.4.6$ ssh datanode1
hadoop@datanode1:~$ cd zookeeper-3.4.6/temp/
hadoop@datanode1:~/zookeeper-3.4.6/temp$ vim myid
1
hadoop@namenode:~/zookeeper-3.4.6$ ssh datanode2
hadoop@datanode1:~$ cd zookeeper-3.4.6/temp/
hadoop@datanode1:~/zookeeper-3.4.6/temp$ vim myid
2
9.开启zookeeper
hadoop@namenode:~/zookeeper-3.4.6/bin$ zkServer.sh start
JMX enabled by default
Using config: /home/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
你会发现多了一个zookeeper.out的文件,而且里面是报错的,报错的原因是其它节点没有开zookeeper,你得依照上面的方式在每一个节点开启zookeeper
hadoop@namenode:~/zookeeper-3.4.6/bin$ ls
README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer.sh zookeeper.out
10.一个错误
假设你zookeeper的环境变量没有配,会出现这种情况
JMX enabled by default
zkServer.sh: 81: /home/hadoop/zookeeper-3.4.6/bin/zkEnv.sh: Syntax error: "(" unexpected (expecting "fi")
2014-11-16 01:18:30,600 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2014-11-16 01:18:30,604 [myid:] - INFO [main:Environment@100] - Client environment:host.name=namenode
2014-11-16 01:18:30,605 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.7.0_65
2014-11-16 01:18:30,608 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2014-11-16 01:18:30,608 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/programs/jdk1.7.0_65/jre
2014-11-16 01:18:30,609 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/home/hadoop/zookeeper-3.4.6/bin/../build/classes:/home/hadoop/zookeeper-3.4.6/bin/../build/lib/*.jar:/home/hadoop/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/hadoop/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/home/hadoop/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/home/hadoop/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/home/hadoop/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/home/hadoop/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/home/hadoop/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/home/hadoop/zookeeper-3.4.6/bin/../conf:
2014-11-16 01:18:30,610 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/i386:/lib:/usr/lib
2014-11-16 01:18:30,610 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2014-11-16 01:18:30,611 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2014-11-16 01:18:30,614 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2014-11-16 01:18:30,614 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=i386
2014-11-16 01:18:30,615 [myid:] - INFO [main:Environment@100] - Client environment:os.version=3.5.0-23-generic
2014-11-16 01:18:30,615 [myid:] - INFO [main:Environment@100] - Client environment:user.name=hadoop
2014-11-16 01:18:30,615 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/home/hadoop
2014-11-16 01:18:30,616 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/home/hadoop/zookeeper-3.4.6/bin
2014-11-16 01:18:30,618 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@e13c84
Welcome to ZooKeeper!
2014-11-16 01:18:30,653 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2014-11-16 01:18:30,665 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
JLine support is enabled
2014-11-16 01:18:30,679 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x49b7dc68450002, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 1] ls /zookeeper
[quota]
[zk: localhost:2181(CONNECTED) 2] ls /zookeeper/quota
[]
[zk: localhost:2181(CONNECTED) 3] create /key value
Created /key
[key, zookeeper]
value
cZxid = 0x100000006
ctime = Sun Nov 16 01:20:15 PST 2014
mZxid = 0x100000006
mtime = Sun Nov 16 01:20:15 PST 2014
pZxid = 0x100000006
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 0
value
cZxid = 0x100000006
ctime = Sun Nov 16 01:20:15 PST 2014
mZxid = 0x100000006
mtime = Sun Nov 16 01:20:15 PST 2014
pZxid = 0x100000006
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 0
JMX enabled by default
Using config: /home/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader
部署zookeeper实践的更多相关文章
- Elasticstack 5.1.2 集群日志系统部署及实践
Elasticstack 5.1.2 集群日志系统部署及实践 一.ELK Stack简介 ELK Stack 是Elasticsearch.Logstash.Kibana三个开源软件的组合,在实时数据 ...
- 在 CentOS7 上部署 zookeeper 服务
在 CentOS7 上部署 zookeeper 服务 1 用 SecureCRT 或 XShell 等 Linux 客户端工具连接至 CentOS7 服务器: 2 进入到 /usr/local/too ...
- Linux环境快速部署Zookeeper集群
一.部署前准备: 1.下载ZooKeeper的安装包: http://zookeeper.apache.org/releases.html 我下载的版本是zookeeper-3.4.9. 2.将下载的 ...
- 在CentOS7部署zookeeper集群以及简单API使用
一.部署zookeeper集群 zookeeper是一个针对大型分布式系统的协调系统,提供的功能有统一名称服务.分布式同步等. 1.上传zk安装包 2.解压 tar -xzvf zookeep ...
- Cobbler自动化部署最佳实践
第1章 Cobbler自动化部署最佳实践 运维自动化在生产环境中占据着举足轻重的地位,尤其是面对几百台,几千台甚至几万台的服务器时,仅仅是安装操作系统,如果不通过自动化来完成,根本是不可想象的. 面对 ...
- tomcat部署最佳实践(一)
Tomcat部署最佳实践 标签: linux 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 tomcat是玩web软件必会技能之一,今天我给大家介绍一下tomc ...
- AWS EC2 CentOS release 6.5 部署zookeeper、kafka、dubbo
AWS EC2 CentOS release 6.5 部署zookeeper.kafka.dubbo参考:http://blog.csdn.net/yizezhong/article/details/ ...
- 【公开课】【阿里在线技术峰会】魏鹏:基于Java容器的多应用部署技术实践
对于公开课,可能目前用不上这些,但是往往能在以后想解决方案的时候帮助到我.以下是阿里对公开课的整理 摘要: 在首届阿里巴巴在线峰会上,阿里巴巴中间件技术部专家魏鹏为大家带来了题为<基于Java容 ...
- ZooKeeper 01 - 什么是ZooKeeper + 部署ZooKeeper集群
目录 1 什么是ZooKeeper 2 ZooKeeper的功能 2.1 配置管理 2.2 命名服务 2.3 分布式锁 2.4 集群管理 3 部署ZooKeeper集群 3.1 下载并解压安装包 3. ...
随机推荐
- ASP.NET-技巧01
==符号的写法 ViewBag.StatusMessage = message == ManageMessageId.ChangePasswordSuccess ? "你的密码已更改.&qu ...
- jquery-jquery异步提交表单插件
使用jquery.form可以异步提交文件或者表单,下面的代码演示了如何提交文件 http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js <s ...
- Android Touch事件传递机制全面解析(从WMS到View树)
转眼间近一年没更新博客了,工作一忙起来.非常难有时间来写博客了,因为如今也在从事Android开发相关的工作,因此以后的博文也会很多其它地专注于这一块. 这篇文章准备从源代码层面为大家带来Touch事 ...
- Linux以下的两种文件锁
文件锁是一种文件读写机制.在不论什么特定的时间仅仅同意一个进程訪问一个文件. 利用这样的机制可以使读写单个文件的过程变得更安全. 在这篇文章中.我们将探讨Linux中不同类型的文件锁,并通过演示样例程 ...
- HDU 5358 First One(枚举)
First One Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Tota ...
- threejs 入门教程1
最近在看threejs开发指南,总结一下制作最基础的3d场景的8步: 1. 设置场景大小 2. 创建WebGl渲染器 3. 指定根节点元素 4. 初始化场景 5. 添加相机到场景 6. 创建物体到场景 ...
- hihoCoder 1403 后缀数组 重复旋律
思路: 后缀数组 第一次写 留个模板吧 先求出后缀数组,问题转换为询问height数组中连续k-1个数的最小值的最大值,单调队列扫描一遍即可.-yousiki 手懒用得STL //By SiriusR ...
- 爬虫框架webmagic与spring boot的结合使用--转
原文地址:http://www.jianshu.com/p/c3fc3129407d 1. 爬虫框架webmagic WebMagic是一个简单灵活的爬虫框架.基于WebMagic,你可以快速开发出一 ...
- Hbase项目(完整版)
涉及概念梳理:命名空间 4.1.1.命名空间的结构 1) Table:表,所有的表都是命名空间的成员,即表必属于某个命名空间,如果没有指定,则在default默认的命名空间中. 2) RegionSe ...
- 洛谷P2770 航空路线问题 最小费用流
Code: #include<cstdio> #include<iostream> #include<algorithm> #include<vector&g ...