标签:
下载地址:http://apache.dataguru.cn/zookeeper/zookeeper-3.4.3/zookeeper-3.4.3.tar.gz
我这里下载的是:zookeeper-3.4.5.tar.gz
wu_being@JStorm-VirtualBox:~$ sudo tar -zxvf zookeeper-3.4.5.tar.gz
wu_being@JStorm-VirtualBox:~$ sudo chown -R wu_being:wu_being zookeeper-3.4.5
在/etc/profile和/home/wu_being/.bashrc文件后添加如下信息1:
JAVA_HOME=/home/wu_being/jdk1.7.0
ZOOKEEPER_HOME=/home/wu_being/zookeeper-3.4.5
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$ZOOKEEPER_HOME/lib
PATH=$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$PATH
export ZOOKEEPER_HOME
export JAVA_HOME
export CLASSPATH
export PATH
设置环境变量/home/wu_being/.bashrc文件后,要source 更新一下:
wu_being@JStorm-VirtualBox:~$source /home/wu_being/.bashrc
wu_being@JStorm-VirtualBox:~$source /etc/profile
配置文件存放在$ZOOKEEPER_HOME/conf/目录下,将zoo_sample.cfd文件名称改为zoo.cfg(cp zoo_sample.cfg zoo.cfg
), 缺省的配置内容如下:
# 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=/home/wu_being/zookeeper-3.4.5/data
# 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
配置说明:
tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
dataDir:顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。
当这些配置项配置好后,你现在就可以启动zookeeper了:
wu_being@JStorm-VirtualBox:~/ netstat -at|grep 2181 #查看zookeeper端口
wu_being@JStorm-VirtualBox:~/ netstat -nat #查看端口信息
wu_being@JStorm-VirtualBox:~/zookeeper-3.4.5/bin$ ./zkServer.sh start #启动
wu_being@JStorm-VirtualBox:~/zookeeper-3.4.5/bin$ jps #查看启动的服务名称
wu_being@JStorm-VirtualBox:~/zookeeper-3.4.5/bin$ ./zkServer.sh stop #关闭
注:jps命令是java jdk中的,启动zkServer也是要先配制好java jdk,不然启动成功也是假现象的!!!
启动后要检查 Zookeeper 是否已经在服务,可以通过 netstat -at|grep 2181
命令查看是否有 clientPort 端口号在监听服务。并在zookeeper-3.4.5生成data文件夹,data文件夹version-2文件夹和zookeeper_server.pid文件。
-s $HOME/.pythonbrew/etc/bashrc && source $HOME/.pythonbrew/etc/bashrc
pythonbrew install 2.6.7
pythonbrew switch 2.6.7
注意,如果当前系统是64位系统,则需要下载64位JDK,如果是32为系统,则下载32位JDK
假设以jstorm-0.9.6.3.zip为例
unzip jstorm-2.1.1.zip
vi ~/.bashrc
export JSTORM_HOME=/home/wu_being/jstorm-2.1.1
export PATH=$PATH:$JSTORM_HOME/bin
注意:要wu_being@JStorm-VirtualBox:~$ source .bashrc
配置项:
1. storm.zookeeper.servers: 表示zookeeper 的地址,
2. nimbus.host: 表示nimbus的地址
3. storm.zookeeper.root: 表示JStorm在zookeeper中的根目录,当多个JStorm共享一个zookeeper时,需要设置该选项,默认即为“/jstorm”
4. storm.local.dir: 表示JStorm临时数据存放目录,需要保证JStorm程序对该目录有写权限
5. java.library.path: Zeromq 和java zeromq library的安装目录,默认"/usr/local/lib:/opt/local/lib:/usr/lib"
6. supervisor.slots.ports: 表示Supervisor 提供的端口Slot列表,注意不要和其他端口发生冲突,默认是68xx,而Storm的是67xx
7. topology.enable.classloader: false, 默认关闭classloader,如果应用的jar与JStorm的依赖的jar发生冲突,比如应用使用thrift9,但jstorm使用thrift7时,就需要打开classloader。建议在集群级别上默认关闭,在具体需要隔离的topology上打开这个选项。
########### These MUST be filled in for a storm configuration
storm.zookeeper.servers:
- "172.17.21.33"
storm.zookeeper.root: "/jstorm"
nimbus.host: "172.17.21.33"
nimbus.host.start.supervisor: false
nimbus.childopts: "-Xmx256m"
supervisor.childopts: "-Xmx256m"
worker.childopts: "-Xmx128m"
storm.local.dir: "%JSTORM_HOME%/data"
supervisor.slots.ports:
- 6800
- 6801
- 6802
- 6803
#mkdir ~/.jstorm
#cp -f $JSTORM_HOME/conf/storm.yaml ~/.jstorm
必须使用tomcat 7.0 或以上版本, 注意不要忘记拷贝 ~/.jstorm/storm.yaml
Web UI 可以和Nimbus不在同一个节点
mkdir ~/.jstorm
cp -f $JSTORM_HOME/conf/storm.yaml ~/.jstorm
tar -xzf apache-tomcat-7.0.70.tar.gz ###
cd apache-tomcat-7.0.70
cd webapps
cp $JSTORM_HOME/jstorm-ui-2.1.1.war ./
mv ROOT ROOT.old ###
ln -s jstorm-ui-2.1.1 ROOT ###
cd ../bin
./startup.sh #####
注意:
.jstorm/storm.yaml
文件,并启动zookeeper,最好先启动nimbus和supervisor服务器。
nohup jstorm nimbus &
, 查看$JSTORM_HOME/logs/nimbus.log检查有无错误nohup jstorm supervisor &
, 查看$JSTORM_HOME/logs/supervisor.log检查有无错误标签:
原文地址:http://blog.csdn.net/u014134180/article/details/51810311