STORM_0001_用vmware拷贝出三个相同的ubuntu搭建小的zookeeper集群
第一次配置zookeeper的集群
因为想运行storm必须搭建集群
在自己的电脑上拷贝了自己的ubuntu虚拟机
采用的是vmware给虚拟机分配的地址
三个机器的配置基本上一样除了myid这个文件
看了这么久的一致,选举什么的也想试试这个过程的感觉
首先下载安装一个ubuntu
安装配置好jdk
下载zookeeper然后添加到~/.bashrc里面
source ~/.bashrc
使得文件配置生效
echo $PATH
查看路径中有没有java和zookeeper需要的可执行文件的路径
修改zookeeper的配置文件
jason@ubuntu:~/StormProcessing/zookeeper-3.4./conf$ ls
configuration.xsl log4j.properties zoo.cfg zoo.cfg~
jason@ubuntu:~/StormProcessing/zookeeper-3.4./conf$ cat zoo.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/jason/StormProcessing/data
dataLogDir=/home/jason/StormProcessing/log
# the port at which the clients will connect
clientPort=
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= #其中2888表示这个服务器和集群中的leader交换信息的端口
#3888表示万一集群中的leader挂了,找到一个新的leader使用的通信端口
#在真正的集群中,几个服务器使用的端口是一样的,但是在伪集群方式中端口不能一样
server.=192.168.60.129::
server.=192.168.60.132::
server.=192.168.60.133::
#server.=127.0.0.1::
新建一下
dataDir=/home/jason/StormProcessing/data
dataLogDir=/home/jason/StormProcessing/log
这两个文件夹
在data文件夹下面新建一个文本文件myid里面就写一个1
拷贝磁盘,做成单个虚拟机,分别改其中的myid为2,3,注意ip之间的对应
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/jason/StormProcessing/zookeeper-3.4./bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
分别启动三个虚拟机
然后随便查看一个得到下面的结果:
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/jason/StormProcessing/zookeeper-3.4./bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
运行这个
netstat -an |grep
得到空
查google有很多可能
第一是没新建data或者log文件夹,我没这问题
第二是配置文件错误,我也没问题
第三是启动脚本zkServer.sh中重复定义端口号,我也没问题(没动这个文件)
查看自己的下面这个文件
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ cat zookeeper.out
nohup: 无法运行命令"/home/jason/StormProcessing/jdk1.8/bin/java": 权限不够
找到原因了
chmod 755 java
也不行
受到参考文献2的启发用下面的后两个代替前两个就出现了正常的结果
./zkServer.sh start
./zkServer.sh status
sudo ./zkServer.sh start
sudo ./zkServer.sh status
下面是server.
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ sudo ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/jason/StormProcessing/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: follower
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ netstat -an |grep
tcp6 ::: :::* LISTEN
server.
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ sudo ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/jason/StormProcessing/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: follower
server.
jason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ sudo ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/jason/StormProcessing/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: leader
下面是新的成功的 zookeeper.out
ason@ubuntu:~/StormProcessing/zookeeper-3.4./bin$ sudo cat zookeeper.out
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - Reading configuration from: /home/jason/StormProcessing/zookeeper-3.4./bin/../conf/zoo.cfg
-- ::, [myid:] - INFO [main:QuorumPeer$QuorumServer@] - Resolved hostname: 192.168.60.133 to address: /192.168.60.133
-- ::, [myid:] - INFO [main:QuorumPeer$QuorumServer@] - Resolved hostname: 192.168.60.132 to address: /192.168.60.132
-- ::, [myid:] - INFO [main:QuorumPeer$QuorumServer@] - Resolved hostname: 192.168.60.129 to address: /192.168.60.129
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - Defaulting to majority quorums
-- ::, [myid:] - INFO [main:DatadirCleanupManager@] - autopurge.snapRetainCount set to
-- ::, [myid:] - INFO [main:DatadirCleanupManager@] - autopurge.purgeInterval set to
-- ::, [myid:] - INFO [main:DatadirCleanupManager@] - Purge task is not scheduled.
-- ::, [myid:] - INFO [main:QuorumPeerMain@] - Starting quorum peer
-- ::, [myid:] - INFO [main:NIOServerCnxnFactory@] - binding to port 0.0.0.0/0.0.0.0:
-- ::, [myid:] - INFO [main:QuorumPeer@] - tickTime set to
-- ::, [myid:] - INFO [main:QuorumPeer@] - minSessionTimeout set to -
-- ::, [myid:] - INFO [main:QuorumPeer@] - maxSessionTimeout set to -
-- ::, [myid:] - INFO [main:QuorumPeer@] - initLimit set to
-- ::, [myid:] - INFO [main:QuorumPeer@] - currentEpoch not found! Creating with a reasonable default of . This should only happen when you are upgrading your installation
-- ::, [myid:] - INFO [main:QuorumPeer@] - acceptedEpoch not found! Creating with a reasonable default of . This should only happen when you are upgrading your installation
-- ::, [myid:] - INFO [ListenerThread:QuorumCnxManager$Listener@] - My election bind port: /192.168.60.129:
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::QuorumPeer@] - LOOKING
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::FastLeaderElection@] - New election. My id = , proposed zxid=0x0
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [WorkerSender[myid=]:QuorumCnxManager@] - Have smaller server identifier, so dropping the connection: (, )
-- ::, [myid:] - INFO [WorkerSender[myid=]:QuorumCnxManager@] - Have smaller server identifier, so dropping the connection: (, )
-- ::, [myid:] - INFO [/192.168.60.129::QuorumCnxManager$Listener@] - Received connection request /192.168.60.132:
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [WorkerSender[myid=]:QuorumCnxManager@] - Have smaller server identifier, so dropping the connection: (, )
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), FOLLOWING (n.state), (n.sid), 0x1 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), FOLLOWING (n.state), (n.sid), 0x1 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [/192.168.60.129::QuorumCnxManager$Listener@] - Received connection request /192.168.60.133:
-- ::, [myid:] - INFO [/192.168.60.129::QuorumCnxManager$Listener@] - Received connection request /192.168.60.133:
-- ::, [myid:] - WARN [RecvWorker::QuorumCnxManager$RecvWorker@] - Connection broken for id , my id = , error =
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$RecvWorker.run(QuorumCnxManager.java:)
-- ::, [myid:] - WARN [RecvWorker::QuorumCnxManager$RecvWorker@] - Interrupting SendWorker
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [WorkerReceiver[myid=]:FastLeaderElection@] - Notification: (message format version), (n.leader), 0x0 (n.zxid), 0x1 (n.round), LEADING (n.state), (n.sid), 0x1 (n.peerEpoch) LOOKING (my state)
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::QuorumPeer@] - FOLLOWING
-- ::, [myid:] - WARN [SendWorker::QuorumCnxManager$SendWorker@] - Interrupted while waiting for message on queue
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:)
at java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.pollSendQueue(QuorumCnxManager.java:)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.access$(QuorumCnxManager.java:)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$SendWorker.run(QuorumCnxManager.java:)
-- ::, [myid:] - WARN [SendWorker::QuorumCnxManager$SendWorker@] - Send worker leaving thread
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Learner@] - TCP NoDelay set to: true
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Environment@] - Server environment:zookeeper.version=3.4.--, built on // : GMT
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Environment@] - Server environment:host.name=ubuntu
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Environment@] - Server environment:java.version=1.7.0_95
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Environment@] - Server environment:java.vendor=Oracle Corporation
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Environment@] - Server environment:java.home=/usr/lib/jvm/java--openjdk-i386/jre
-- ::, [myid:] - INFO [QuorumPeer[myid=]/:::::::::Environment@] - Server environment:java.class.path=/home/jason/StormProcessing/zookeeper-3.4./bin/../build/classes:/home/jason/StormProcessing/zookeeper-3.4./bin/../build/lib/*.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../lib/slf4j-api-1.6.1.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../lib/netty-3.7.0.Final.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../lib/log4j-1.2.16.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../lib/jline-0.9.94.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../zookeeper-3.4.8.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../src/java/lib/*.jar:/home/jason/StormProcessing/zookeeper-3.4.8/bin/../conf:
2016-05-25 13:21:30,166 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:java.library.path=/usr/java/packages/lib/i386:/usr/lib/i386-linux-gnu/jni:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/jni:/lib:/usr/lib
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:java.io.tmpdir=/tmp
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:java.compiler=<NA>
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:os.name=Linux
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:os.arch=i386
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:os.version=3.16.0-67-generic
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:user.name=root
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:user.home=/root
2016-05-25 13:21:30,167 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100] - Server environment:user.dir=/home/jason/StormProcessing/zookeeper-3.4.8/bin
2016-05-25 13:21:30,169 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:ZooKeeperServer@170] - Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir /home/jason/StormProcessing/log/version-2 snapdir /home/jason/StormProcessing/data/version-2
2016-05-25 13:21:30,169 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Follower@63] - FOLLOWING - LEADER ELECTION TOOK - 112
2016-05-25 13:21:30,171 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@149] - Resolved hostname: 192.168.60.133 to address: /192.168.60.133
2016-05-25 13:21:30,178 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Learner@329] - Getting a snapshot from leader
2016-05-25 13:21:30,183 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FileTxnSnapLog@240] - Snapshotting: 0x100000000 to /home/jason/StormProcessing/data/version-2/snapshot.100000000
2016-05-25 13:22:13,622 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /127.0.0.1:43640
2016-05-25 13:22:13,628 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@827] - Processing srvr command from /127.0.0.1:43640
2016-05-25 13:22:13,653 [myid:1] - INFO [Thread-1:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:43640 (no session established for client)
jason@ubuntu:~/StormProcessing/zookeeper-3.4.8/bin$
参考文献:
http://blog.csdn.net/crazycoder2010/article/details/8607310
http://rayfuxk.iteye.com/blog/2279596
STORM_0001_用vmware拷贝出三个相同的ubuntu搭建小的zookeeper集群的更多相关文章
- Hadoop(三)手把手教你搭建Hadoop全分布式集群
前言 上一篇介绍了伪分布式集群的搭建,其实在我们的生产环境中我们肯定不是使用只有一台服务器的伪分布式集群当中的.接下来我将给大家分享一下全分布式集群的搭建! 其实搭建最基本的全分布式集群和伪分布式集群 ...
- 搭建高可用mongodb集群(三)—— 深入副本集内部机制
在上一篇文章<搭建高可用mongodb集群(二)—— 副本集> 介绍了副本集的配置,这篇文章深入研究一下副本集的内部机制.还是带着副本集的问题来看吧! 副本集故障转移,主节点是如何选举的? ...
- 搭建高可用mongodb集群(三)—— 深入副本集内部机制
在上一篇文章<搭建高可用mongodb集群(二)-- 副本集> 介绍了副本集的配置,这篇文章深入研究一下副本集的内部机制.还是带着副本集的问题来看吧! 副本集故障转移,主节点是如何选举的? ...
- Hadoop(三)搭建Hadoop全分布式集群
原文地址:http://www.cnblogs.com/zhangyinhua/p/7652686.html 阅读目录(Content) 一.搭建Hadoop全分布式集群前提 1.1.网络 1.2.安 ...
- 二进制搭建kubernetes多master集群【三、配置k8s master及高可用】
前面两篇文章已经配置好了etcd和flannel的网络,现在开始配置k8s master集群. etcd集群配置参考:二进制搭建kubernetes多master集群[一.使用TLS证书搭建etcd集 ...
- java 学习笔记(三)ZooKeeper集群搭建实例,以及集成dubbo时的配置 (转)
ZooKeeper集群搭建实例,以及集成dubbo时的配置 zookeeper是什么: Zookeeper,一种分布式应用的协作服务,是Google的Chubby一个开源的实现,是Hadoop的分布式 ...
- 利用VMware在虚拟机上安装Zookeeper集群
http://blog.csdn.net/u010246789/article/details/52101026 利用VMware在虚拟机上安装Zookeeper集群 pasting
- Hadoop4 利用VMware搭建自己的hadoop集群
前言: 前段时间自己学习如何部署伪分布式模式的hadoop环境,之前由于工作比较忙,学习的进度停滞了一段时间,所以今天抽出时间把最近学习的成果和大家分享一下. 本文要介绍的是如 ...
- Hadoop系列之(三):使用Cloudera部署,管理Hadoop集群
1. Cloudera介绍 Hadoop是一个开源项目,Cloudera对Hadoop进行了商业化,简化了安装过程,并对hadoop做了一些封装. 根据使用的需要,Hadoop集群要安装很多的组件,一 ...
随机推荐
- django migrate10060 Duplicate column name错误
这个错误意思是有重复的列名,其实大部分原因是因为某些列被执行了多次,可以打开migration里面的django生成的文件去排查错误,然后自己手动修改数据库还原,实在不行可以把除了0001和init文 ...
- 【python cookbook】【字符串与文本】3.利用shell通配符做字符串匹配
问题:当工作在Linux shell下时,使用常见的通配符模式(即,*.py.Dat[0-9]*.csv等)来对文本做匹配 解决方案:fnmatch模块提供的两个函数fnmatch().fnmatch ...
- 【python cookbook】【数据结构与算法】6.在字典中将键映射到多个值上
问题:一个能将键(key)映射到多个值的字典(即所谓的一键多值字典[multidict]) 解决方案:如果想让键映射到多值,需要将这多个值保持到另一个容器如列表或集合中: >>> d ...
- 如何自动生成Facade 的EJB
1.jbuilder中连接数据库,注意:java:/DataSource 2.选择数据表,右健选择"create cmp 2.x..." 3.添加"findAll&quo ...
- 连接ssh反应很慢,卡,延迟
1.关闭DNS反向解析在linux中,默认就是开启了SSH的反向DNS解析,这个会消耗大量时间,因此需要关闭.# vi /etc/ssh/sshd_configUseDNS=no 在配置文件中,虽然U ...
- XCode属性面板使用说明
Xcode 中Interface Builder 工具 是一个功能强大的“所见即所得”开发工具.本文主要介绍属性面板 和 对象库面板 对象库面板: 提供了所有Cocoa Touch 库给我们定义好的 ...
- 关于ADO.NET@SQL Server&SqlDataReader
先说基础的,说基础的明白了再深的也是一样的.SQL是关系型数据库,所以就决定了对其操作的时候ADO的一些类要相互联系,Connection 类Command对象(ExecuteReader()方法.E ...
- 减少GC开销的措施
程序的运行会直接影响系统环境的变化,从而影响GC的触发.若不针对GC的特点进行设计和编码,就会出现内存驻留等一系列负面影响.为了避免这些影响,基本的原则就是尽可能地减少垃圾和减少GC过程中的开销.具体 ...
- [团队项目]sprint3 & 团队贡献分。
希望各组认真准备,拿出最好的阵容最好的状态,展示一学期的学习与工作成果. 各组注意完成sprint3的博客,写上团队贡献分. 将演示PPT(如果有)和代码上传到github. 截止日期:2016.6. ...
- 2015-11-04 报表(c#部分)(Datatable 查询,弹出日期控件,输入是否整数)
using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq ...