标签:sqs idle tty pfx hle rtos ipa derby vlm
软件版本号:
Oozie4.2.0。Hadoop2.6.0,Spark1.4.1。Hive0.14。Pig0.15.0。Maven3.2。JDK1.7,zookeeper3.4.6。HBase1.1.2,MySQL5.6
集群部署:
node1~4.centos.com node1~4 192.168.0.31~34 1G*4 内存 1核*4 虚拟机
node1:NameNode 、ResourceManager;
node2:SecondaryNameNode、Master、HMaster、HistoryServer、JobHistoryServer
node3:oozie-server(tomcat)、DataNode、NodeManager、HRegionServer、Worker、QuorumPeerMain
node4:DataNode、NodeManager、HRegionServer、Worker、Pig client、Hive Client、HiveServer2、QuorumPeerMain、mysql
bin/mkdistro.sh -DskipTests -Phadoop-2 -Dhadoop.auth.version=2.6.0 -Ddistcp.version=2.6.0 -Dspark.version=1.4.1 -Dpig.version=0.15.0 -Dtomcat.version=7.0.52假设增加了hbase或者hive。而且指定到较高版本号,则会出错,如:
#bin/mkdistro.sh -DskipTests -Phadoop-2 -Dhadoop.auth.version=2.6.0 -Ddistcp.version=2.6.0 -Dspark.version=1.4.1 -Dpig.version=0.15.0 -Dtomcat.version=7.0.52 #-Dhive.version=0.14.0 -Dhbase.version=1.1.2 ## 指定hive和hbase到较高版本号编译通只是
<property> <name>hadoop.proxyuser.[USER].hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.[USER].groups</name> <value>*</value> </property>当中,[USER]须要改为后面启动oozie tomcat的用户
hdfs dfsadmin -refreshSuperUserGroupsConfiguration yarn rmadmin -refreshSuperUserGroupsConfiguration
<property> <name>oozie.service.JPAService.create.db.schema</name> <value>true</value> </property> <property> <name>oozie.service.JPAService.jdbc.driver</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>oozie.service.JPAService.jdbc.url</name> <value>jdbc:mysql://node4:3306/oozie?createDatabaseIfNotExist=true</value> </property> <property> <name>oozie.service.JPAService.jdbc.username</name> <value>root</value> </property> <property> <name>oozie.service.JPAService.jdbc.password</name> <value>root</value> </property> <property> <name>oozie.service.HadoopAccessorService.hadoop.configurations</name> <value>*=/usr/hadoop/hadoop-2.6.0/etc/hadoop</value> </property>
oozie.wf.application.path=hdfs://node1:8020/user/root/workflow/mr_demo/wf #Hadoop"R jobTracker=node1:8032 #Hadoop"fs.default.name nameNode=hdfs://node1:8020/ #Hadoop"mapred.queue.name queueName=default
<workflow-app xmlns="uri:oozie:workflow:0.2" name="map-reduce-wf"> <start to="mr-node"/> <action name="mr-node"> <map-reduce> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <prepare> <delete path="${nameNode}/user/${wf:user()}/workflow/mr_demo/output"/> </prepare> <configuration> <property> <name>mapred.job.queue.name</name> <value>${queueName}</value> </property> <property> <name>mapreduce.mapper.class</name> <value>org.apache.hadoop.examples.WordCount$TokenizerMapper</value> </property> <property> <name>mapreduce.reducer.class</name> <value>org.apache.hadoop.examples.WordCount$IntSumReducer</value> </property> <property> <name>mapred.map.tasks</name> <value>1</value> </property> <property> <name>mapred.input.dir</name> <value>/user/${wf:user()}/bank.csv</value> </property> <property> <name>mapred.output.dir</name> <value>/user/${wf:user()}/workflow/mr_demo/output</value> </property> </configuration> </map-reduce> <ok to="end"/> <error to="fail"/> </action> <kill name="fail"> <message>Map/Reduce failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message> </kill> <end name="end"/> </workflow-app>
oozie.wf.application.path=hdfs://node1:8020/user/root/workflow/pig_demo/wf oozie.use.system.libpath=true #pig流程必须配置此选项 #Hadoop"ResourceManager resourceManager=node1:8032 #Hadoop"fs.default.name nameNode=hdfs://node1:8020/ #Hadoop"mapred.queue.name queueName=default
<workflow-app xmlns="uri:oozie:workflow:0.2" name="whitehouse-workflow"> <start to="transform_job"/> <action name="transform_job"> <pig> <job-tracker>${resourceManager}</job-tracker> <name-node>${nameNode}</name-node> <prepare> <delete path="/user/root/workflow/pig_demo/output"/> </prepare> <script>transform_job.pig</script> </pig> <ok to="end"/> <error to="fail"/> </action> <kill name="fail"> <message>Job failed, error message[${wf:errorMessage(wf:lastErrorNode())}] </message> </kill> <end name="end"/> </workflow-app>
bank_data= LOAD ‘/user/root/bank.csv‘ USING PigStorage(‘;‘) AS (age:int, job:chararray, marital:chararray,education:chararray, default:chararray,balance:int,housing:chararray,loan:chararray, contact:chararray,day:int,month:chararray,duration:int,campaign:int, pdays:int,previous:int,poutcom:chararray,y:chararray); age_gt_30 = FILTER bank_data BY age >= 30; store age_gt_30 into ‘/user/root/workflow/pig_demo/output‘ using PigStorage(‘,‘);4. 执行
nameNode=hdfs://node1:8020 jobTracker=node1:8032 queueName=default maxAge=30 input=/user/root/bank.csv output=/user/root/workflow/hive_demo/output oozie.use.system.libpath=true oozie.wf.application.path=${nameNode}/user/${user.name}/workflow/hive_demo/wf2. workflow.xml
<workflow-app xmlns="uri:oozie:workflow:0.2" name="hive-wf"> <start to="hive-node"/> <action name="hive-node"> <hive xmlns="uri:oozie:hive-action:0.2"> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <prepare> <delete path="${output}/hive"/> <mkdir path="${output}"/> </prepare> <configuration> <property> <name>mapred.job.queue.name</name> <value>${queueName}</value> </property> </configuration> <script>script.hive</script> <param>INPUT=${input}</param> <param>OUTPUT=${output}/hive</param> <param>maxAge=${maxAge}</param> </hive> <ok to="end"/> <error to="fail"/> </action> <kill name="fail"> <message>Hive failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message> </kill> <end name="end"/> </workflow-app>3. hive任务用到的脚本 script.hive
DROP TABLE IF EXISTS bank; CREATE TABLE bank( age int, job string, marital string,education string, default string,balance int,housing string,loan string, contact string,day int,month string,duration int,campaign int, pdays int,previous int,poutcom string,y string ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\073‘ STORED AS TEXTFILE; LOAD DATA INPATH ‘${INPUT}‘ INTO TABLE bank; INSERT OVERWRITE DIRECTORY ‘${OUTPUT}‘ SELECT * FROM bank where age > ‘${maxAge}‘;注意:‘\073’ 代表分号;
nameNode=hdfs://node1:8020 jobTracker=node1:8032 queueName=default jdbcURL=jdbc:hive2://node4:10000/default # hiveserver2 时,配置此选项 maxAge=30 input=/user/root/bank.csv output=/user/root/workflow/hive2_demo/output oozie.use.system.libpath=true oozie.wf.application.path=${nameNode}/user/${user.name}/workflow/hive2_demo/wf
<workflow-app xmlns="uri:oozie:workflow:0.5" name="hive2-wf"> <start to="hive2-node"/> <action name="hive2-node"> <hive2 xmlns="uri:oozie:hive2-action:0.1"> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <prepare> <delete path="${output}/hive"/> <mkdir path="${output}"/> </prepare> <configuration> <property> <name>mapred.job.queue.name</name> <value>${queueName}</value> </property> </configuration> <jdbc-url>${jdbcURL}</jdbc-url> <script>script2.hive</script> <param>INPUT=${input}</param> <param>OUTPUT=${output}/hive</param> <param>maxAge=${maxAge}</param> </hive2> <ok to="end"/> <error to="fail"/> </action> <kill name="fail"> <message>Hive2 failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message> </kill> <end name="end"/> </workflow-app>3. hive2用到的脚本: script2.hive
DROP TABLE IF EXISTS bank2; CREATE TABLE bank2( age int, job string, marital string,education string, default string,balance int,housing string,loan string, contact string,day int,month string,duration int,campaign int, pdays int,previous int,poutcom string,y string ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\073‘ STORED AS TEXTFILE; LOAD DATA INPATH ‘${INPUT}‘ INTO TABLE bank2; INSERT OVERWRITE DIRECTORY ‘${OUTPUT}‘ SELECT * FROM bank2 where age > ‘${maxAge}‘;
nameNode=hdfs://node1:8020 jobTracker=node1:8032 #master=spark://node2:7077 master=spark://node2:6066 sparkMode=cluster queueName=default oozie.use.system.libpath=true input=/user/root/bank.csv output=/user/root/workflow/spark_demo/output # the jar file must be local jarPath=${nameNode}/user/root/workflow/spark_demo/lib/oozie-examples.jar oozie.wf.application.path=${nameNode}/user/${user.name}/workflow/spark_demo/wf因为sparkMode採用cluster,所以master的链接须要是以下的6066,:
<workflow-app xmlns=‘uri:oozie:workflow:0.5‘ name=‘SparkFileCopy‘> <start to=‘spark-node‘ /> <action name=‘spark-node‘> <spark xmlns="uri:oozie:spark-action:0.1"> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <prepare> <delete path="${output}"/> </prepare> <master>${master}</master> <mode>${sparkMode}</mode> <name>Spark-FileCopy</name> <class>org.apache.oozie.example.SparkFileCopy</class> <jar>${jarPath}</jar> <arg>${input}</arg> <arg>${output}</arg> </spark> <ok to="end" /> <error to="fail" /> </action> <kill name="fail"> <message>Workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}] </message> </kill> <end name=‘end‘ /> </workflow-app>
nameNode=hdfs://node1:8020 jobTracker=node1:8032 #master=spark://node2:7077 #master=spark://node2:6066 master=yarn-cluster #sparkMode=cluster queueName=default oozie.use.system.libpath=true input=/user/root/bank.csv output=/user/root/workflow/sparkonyarn_demo/output jarPath=${nameNode}/user/root/workflow/sparkonyarn_demo/lib/oozie-examples.jar oozie.wf.application.path=${nameNode}/user/${user.name}/workflow/sparkonyarn_demo2. workflow.xml:
<workflow-app xmlns=‘uri:oozie:workflow:0.5‘ name=‘SparkFileCopy_on_yarn‘> <start to=‘spark-node‘ /> <action name=‘spark-node‘> <spark xmlns="uri:oozie:spark-action:0.1"> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <prepare> <delete path="${output}"/> </prepare> <master>${master}</master> <name>Spark-FileCopy-on-yarn</name> <class>org.apache.oozie.example.SparkFileCopy</class> <jar>${jarPath}</jar> <spark-opts>--conf spark.yarn.historyServer.address=http://node2:18080 --conf spark.eventLog.dir=hdfs://node1:8020/spark-log --conf spark.eventLog.enabled=true</spark-opts> <arg>${input}</arg> <arg>${output}</arg> </spark> <ok to="end" /> <error to="fail" /> </action> <kill name="fail"> <message>Workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}] </message> </kill> <end name=‘end‘ /> </workflow-app>
标签:sqs idle tty pfx hle rtos ipa derby vlm
原文地址:http://www.cnblogs.com/claireyuancy/p/7052982.html