转载请注明出处:http://blog.csdn.net/l1028386804/article/details/79172573
ip | host | 服务 |
---|---|---|
192.168.209.121 | master | Namenode、NodeManager、DataNode、zookeeper |
192.168.209.122 | slave1 | ResurceManager、NodeManager、DataNode、zookeeper |
192.168.209.123 | slave2 | NodeManager、DataNode、zookeeper |
参考博文《Hadoop之——Hadoop2.5.2 HA高可靠性集群搭建(Hadoop+Zookeeper)》或 《Storm之——搭建Storm集群》
请参考博文:《Hadoop之——Hadoop2.4.1伪分布搭建》
请参考博文《Hadoop之——CentOS + hadoop2.5.2分布式环境配置》
请参考博文《Hadoop之——Hadoop2.5.2 HA高可靠性集群搭建(Hadoop+Zookeeper)前期准备》和《Hadoop之——Hadoop2.5.2 HA高可靠性集群搭建(Hadoop+Zookeeper)》
这篇博文中,我也是在单节点上安装的Hadoop,将HBase和Hadoop安装在了同一台服务器上。由于HBase的运行依赖于Zookeeper,所以,在同一台服务器上,又安装了单节点的Zookeeper。参考博文《Storm之——搭建Storm集群》
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar -xzvf apache-maven-3.3.9-bin.tar.gz
ln -s apache-maven-3.3.9/ maven
export MAVEN_HOME=/application/maven
export PATH=.:$MAVEN_HOME/bin:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
source /etc/profile
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /application/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /application/jdk1.7.0_79/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-504.el6.x86_64", arch: "amd64", family: "unix"
wget https://github.com/yahoo/storm-yarn/archive/master.zip
重命名下载的压缩包为storm-yarn.zip
mv master.zip storm-yarn.zip
解压
unzip storm-yarn.zip
根据hadoop的版本号修改storm-yarn-master/pom.xml
<properties>
<storm.version>0.9.6</storm.version>
<hadoop.version>2.6.0</hadoop.version>
</properties>
因为我的环境中hadoop的版本是2.6.0,没有安装storm(也不用安装),所以pom.xml没有修改。
mvn package -DskipTests
打包成功
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ storm-yarn ---
[INFO] ----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ----------------------------------------------------------------------
[INFO] Total time: 08:41 min
[INFO] Finished at: 2018-01-26T10:16:27+08:00
[INFO] Final Memory: 14M/34M
[INFO] ----------------------------------------------------------------------
解压storm-yarn-master/lib/storm.zip
unzip storm-yarn-master/lib/storm.zip
[root@master lib]# ls
storm-0.9.0-wip21 storm-0.9.0-wip21.zip storm-starter-0.0.1-SNAPSHOT.jar storm.zip
将解压后生成的storm-0.9.0-wip21移到和storm-yarn-master同级的目录
[root@master lib]mv storm-0.9.0-wip21 ../..
[root@master lib]# cd ../..
[root@master application]# ls
maven storm-yarn.zip apache-maven-3.3.9 tools hadoop zookeeper hadoop-2.6.0 java storm-0.9.0-wip21 zookeeper-3.3.6 jdk1.7.0_79 storm-yarn-master
export PATH=.:/application/storm-0.9.0-wip21/bin:/application/storm-yarn-master/bin:$MAVEN_HOME/bin::$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
使用source /etc/profile使之生效
修改zookeeper地址
storm.zookeeper.servers:
- "master"
- "slave1"
- "slave2"
压缩storm-0.9.0-wip21
zip -r storm.zip storm-0.9.0-wip21
将压缩后的文件storm.zip上传到hdfs上的目录/lib/storm/0.9.0-wip21/
hadoop fs -mkdir -p /lib/storm/0.9.0-wip21
hdfs dfs -put storm.zip /lib/storm/0.9.0-wip21/
hdfs dfs -ls /lib/storm/0.9.0-wip21/
Found 1 items
-rw-r--r-- 3 root supergroup 17141097 2016-08-26 10:27 /lib/storm/0.9.0-wip21/storm.zip
[root@master application]# storm-yarn launch storm-0.9.0-wip21/conf/storm.yaml
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/application/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/application/storm-0.9.0-wip21/lib/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
18/01/26 10:28:28 INFO client.RMProxy: Connecting to ResourceManager at slave1/192.168.40.133:8032
18/01/26 10:28:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
18/01/26 10:28:30 INFO yarn.StormOnYarn: Copy App Master jar from local filesystem and add to local environment
18/01/26 10:28:32 INFO yarn.StormOnYarn: Set the environment for the application master
18/01/26 10:28:32 INFO yarn.StormOnYarn: YARN CLASSPATH COMMAND = [[yarn, classpath]]
18/01/26 10:28:32 INFO yarn.StormOnYarn: Using JAVA_HOME = [/application/java]
18/01/26 10:28:32 INFO yarn.StormOnYarn: Setting up app master command:[/application/java/bin/java, -Dstorm.home=./storm/storm-0.9.0-wip21/, -Dlogfile.name=<LOG_DIR>/master.log, com.yahoo.storm.yarn.MasterServer, 1><LOG_DIR>/stdout, 2><LOG_DIR>/stderr]
18/01/26 10:28:32 INFO impl.YarnClientImpl: Submitted application application_1516932395528_0002
application_1516932395528_0002
通过http://192.168.209.121:8088查看yarn的appplication运行情况
得到storm的属性信息,并保存到/root/.storm/storm.yaml中
[root@master application]# mkdir -p /root/.storm/
[root@master application]# storm-yarn getStormConfig -appId application_1516932395528_0002 -output ~/.storm/storm.yaml
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/application/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/application/storm-0.9.0-wip21/lib/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
18/01/26 10:30:13 INFO client.RMProxy: Connecting to ResourceManager at slave1/192.168.209.122:8032
18/01/26 10:30:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
18/01/26 10:30:14 INFO yarn.StormOnYarn: application report for application_1516932395528_0002 :slave2:9000
18/01/26 10:30:14 INFO yarn.StormOnYarn: Attaching to slave2:9000 to talk to app master application_1516932395528_0002
{10:35:18}18/01/26 10:30:14 INFO yarn.StormMasterCommand: storm.yaml downloaded into /root/.storm/storm.yaml
根据/root/.storm/storm.yaml获取nimbus地址
[root@master .storm]# cat ~/.storm/storm.yaml | grep nimbus.host
nimbus.host: 192.168.209.123
通过访问http://192.168.209.123:7070访问storm UI
[root@master storm-yarn-master]# storm jar lib/storm-starter-0.0.1-SNAPSHOT.jar storm.starter.WordCountTopology WordCountTopology -c nimbus.host=192.168.40.134
561 [main] INFO backtype.storm.StormSubmitter - Jar not uploaded to master yet. Submitting jar...
573 [main] INFO backtype.storm.StormSubmitter - Uploading topology jar lib/storm-starter-0.0.1-SNAPSHOT.jar to assigned location: storm-local/nimbus/inbox/stormjar-12a737f5-82e9-43a6-b422-c1740cc36635.jar
596 [main] INFO backtype.storm.StormSubmitter - Successfully uploaded topology jar to assigned location: storm-local/nimbus/inbox/stormjar-12a737f5-82e9-43a6-b422-c1740cc36635.jar
596 [main] INFO backtype.storm.StormSubmitter - Submitting topology WordCountTopology in distributed mode with conf {"nimbus.host":"192.168.40.134","topology.workers":3,"topology.debug":true}
948 [main] INFO backtype.storm.StormSubmitter - Finished submitting topology: WordCountTopology
查看Storm UI
[root@master ~]# storm kill WordCountTopology
2277 [main] INFO backtype.storm.thrift - Connecting to Nimbus at 192.168.209.123:6627
2387 [main] INFO backtype.storm.command.kill-topology - Killed topology: WordCountTopology
[root@master ~]# yarn application -kill application_1516932395528_0002
Killing application application_1516932395528_0002