STORM_0004_windows下zookeeper的伪集群的搭建

-----------------------------------------------------START------------------------------------------------------------

因为是把storm-starter都放到了windows的eclipse下面了,看代码也方便,所以想着在windows下面搭建zookeeper伪集群

-------------------------------------------------------首先是单机模式---------------------------------------------------

安装zookeeper就是在网上下载新版的包,解压后放到合适的路径,然后在path中添加相应的路径进入。

配置conf下面的zoo.cfg为

tickTime=2000
initLimit=10
syncLimit=5
dataDir=C:/zookeeper/data
dataLogDir=C:/zookeeper/log
clientPort=2181

其中

tickTime表示最小的时间单元

initLimit表示leader允许follower在这个时间内完成自己的工作

syncLimit表示要是l在这个时间内没收到f的心跳,认为f已经宕机,不能设置太大

dataDir表示存储快照文件的路径

dataLogDir表示事务日志的输出路径

clientPort表示服务器的对外的服务端口

上面的配置文件对于独立的运行没什么影响了,在相应的目录下运行zkServer.cmd就可以跑起来zookeeper了

一定要在指明这个路径不知道是为什么,还有不能再用zkServer.cmd start了这样启动会失败,关闭 就ctrl+c了

--------------------------------------------------------现在是集群模式--------------------------------------------------

集群模式创建三个zkServer-i.cmd和三个zooi.cfg文件,对应的端口和目录等文件也要创建

首先是复制出来三个zkServer-i.cmd

其次是修改zooi.cfg

然后是创建对应的文件夹和文件尤其是myid文件

然后开出来四个命令行,分别到相应的目录去执行zkServer-i.cmd,这样可以得到下面的

------------------------------------------jps-----------------------------------------------------

这里的jps是java virtual machine process status tool
可以查看显示当前的java进程的一些信息

OPTIONS
       The jps command supports a number of options that modify the output of the command. These options are subject to change or removal in the future.

       -q
              Suppresses the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local JVM identifiers.

       -m
              Displays the arguments passed to the main method. The output may be null for embedded JVMs.

       -l
              Displays the full package name for the application's main class or the full path name to the application's JAR file.

       -v
              Displays the arguments passed to the JVM.

       -V
              Suppresses the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local JVM identifiers.

       -Joption
              Passes option to the JVM, where option is one of the options described on the reference page for the Java application launcher. For example, -J-Xms48m sets the startup

jason@ubuntu:~$ sudo jps
2391 Jps
1968 QuorumPeerMain
2125 nimbus
2228 core
jason@ubuntu:~$ sudo jps -q
2490
1968
2125
2228
jason@ubuntu:~$ sudo jps -m
1968 QuorumPeerMain /home/jason/StormProcessing/zookeeper-3.4.8/bin/../conf/zoo.cfg
2125 nimbus
2500 Jps -m
2228 core
jason@ubuntu:~$ sudo jps -l
2525 sun.tools.jps.Jps
1968 org.apache.zookeeper.server.quorum.QuorumPeerMain
2125 org.apache.storm.daemon.nimbus
2228 org.apache.storm.ui.core
jason@ubuntu:~$ sudo jps -v
2541 Jps -Dapplication.home=/usr/lib/jvm/java-7-openjdk-i386 -Xms8m
1968 QuorumPeerMain -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false
2125 nimbus -Ddaemon.name=nimbus -Dstorm.options= -Dstorm.home=/home/jason/StormProcessing/apache-storm-1.0.1 -Dstorm.log.dir=/home/jason/StormProcessing/apache-storm-1.0.1/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -Xmx1024m -Dlogfile.name=nimbus.log -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j.configurationFile=/home/jason/StormProcessing/apache-storm-1.0.1/log4j2/cluster.xml
2228 core -Ddaemon.name=ui -Dstorm.options= -Dstorm.home=/home/jason/StormProcessing/apache-storm-1.0.1 -Dstorm.log.dir=/home/jason/StormProcessing/apache-storm-1.0.1/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -Xmx768m -Dlogfile.name=ui.log -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j.configurationFile=/home/jason/StormProcessing/apache-storm-1.0.1/log4j2/cluster.xml
jason@ubuntu:~$ sudo jps -V
2557 Jps
1968 QuorumPeerMain
2125 nimbus
2228 core
jason@ubuntu:~$

要是在ubuntu环境下查看的话最好用sudo jps不然看不到,windows下,打开一个cmd执行jps就可以看到了

不知道为什么不能顺序执行三个命令,可能是因为每一个zkServer-i.cmd执行之后都没返回,也可能是需要调用相同的打印吧

cmd中的顺序执行分为三种

&&表示前面的成功才执行后面的

||表示前面的不成功才执行后面的

&表示无论如何两个都执行以下

----------------------------------------------------OVER-------------------------------------------------------------


万事走心 精益求美


原文地址:https://www.cnblogs.com/kongchung/p/5550095.html