最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

hadoop運(yùn)行java程序(jar包)并運(yùn)行時(shí)動(dòng)態(tài)指定參數(shù)

 更新時(shí)間:2021年06月23日 15:35:07   作者:AKA石頭  
這篇文章主要介紹了hadoop如何運(yùn)行java程序(jar包)并運(yùn)行時(shí)動(dòng)態(tài)指定參數(shù),使用hadoop 運(yùn)行 java jar包,Main函數(shù)一定要加上全限定類名,需要的朋友可以參考下

1)首先啟動(dòng)hadoop2個(gè)進(jìn)程,進(jìn)入hadoop/sbin目錄下,依次啟動(dòng)如下命令

[root@node02 sbin]# pwd
/usr/server/hadoop/hadoop-2.7.0/sbin
sh start-dfs.sh
sh start-yarn.sh
jps

2)通過(guò)jps查看是否正確啟動(dòng),確保啟動(dòng)如下6個(gè)程序

[root@node02 sbin]# jps
10096 DataNode
6952 NodeManager
9962 NameNode
10269 SecondaryNameNode
12526 Jps
6670 ResourceManager

3)如果啟動(dòng)帶有文件的話,將文件加入到hdfs 的 /input下,如果出現(xiàn)如下錯(cuò)誤的話,

[root@node02 hadoop-2.7.0]# hadoop fs -put sample.txt /input
21/01/02 01:13:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for atform... using builtin-java classes where applicable

在環(huán)境變量中添加如下字段

[root@node02 ~]# vim /etc/profile
export HADOOP_COMMON_LIB_NATIVE_DIR=${HADOOP_PREFIX}/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_PREFIX/lib"

4)進(jìn)入到hadoop根目錄,根據(jù)存放位置決定

[root@node02 hadoop-2.7.0]# pwd
/usr/server/hadoop/hadoop-2.7.0

5)新建hadoop hdfs 文件系統(tǒng)上的 /input 文件夾(用于存放輸入文件)

hadoop fs -mkdir /input

6)傳入測(cè)試文件,測(cè)試文件需要自己上傳到根目錄下(僅供測(cè)試,生產(chǎn)環(huán)境下存放到指定目錄)

[root@node02 hadoop-2.7.0]# hadoop fs -put sample.txt /input

7)查看傳入文件是否存在

[root@node02 hadoop-2.7.0]# hadoop fs -ls /input
-rw-r--r--   1 root supergroup        529 2021-01-02 01:13 /input/sample.txt

8)上傳jar包到根目錄下(生產(chǎn)環(huán)境下,放入指定目錄下),測(cè)試jar包為study_demo.jar

[root@node02 hadoop-2.7.0]# ll
總用量 1968
drwxr-xr-x. 2 10021 10021    4096 4月  11 2015 bin
drwxr-xr-x. 3 10021 10021    4096 4月  11 2015 etc
drwxr-xr-x. 2 10021 10021    4096 4月  11 2015 include
drwxr-xr-x. 3 10021 10021    4096 4月  11 2015 lib
drwxr-xr-x. 2 10021 10021    4096 4月  11 2015 libexec
-rw-r--r--. 1 10021 10021   15429 4月  11 2015 LICENSE.txt
drwxr-xr-x. 3 root  root     4096 1月   2 01:36 logs
-rw-r--r--. 1 10021 10021     101 4月  11 2015 NOTICE.txt
-rw-r--r--. 1 10021 10021    1366 4月  11 2015 README.txt
drwxr-xr-x. 2 10021 10021    4096 4月  11 2015 sbin
drwxr-xr-x. 4 10021 10021    4096 4月  11 2015 share
-rw-r--r--. 1 root  root  1956989 6月  14 2021 study_demo.jar

9)使用hadoop 運(yùn)行 java jar包,Main函數(shù)一定要加上全限定類名

hadoop jar study_demo.jar com.ncst.hadoop.MaxTemperature /input/sample.txt /output

10)運(yùn)行結(jié)果縮略圖

21/01/02 01:37:54 INFO mapreduce.Job: Counters: 49
	File System Counters
		FILE: Number of bytes read=61
		FILE: Number of bytes written=342877
		FILE: Number of read operations=0
		FILE: Number of large read operations=0
		FILE: Number of write operations=0
		HDFS: Number of bytes read=974
		HDFS: Number of bytes written=17
		HDFS: Number of read operations=9
		HDFS: Number of large read operations=0
		HDFS: Number of write operations=2
	Job Counters 
		Launched map tasks=2
		Launched reduce tasks=1
		Data-local map tasks=2
		Total time spent by all maps in occupied slots (ms)=14668
		Total time spent by all reduces in occupied slots (ms)=4352
		Total time spent by all map tasks (ms)=14668
		Total time spent by all reduce tasks (ms)=4352
		Total vcore-seconds taken by all map tasks=14668
		Total vcore-seconds taken by all reduce tasks=4352
		Total megabyte-seconds taken by all map tasks=15020032
		Total megabyte-seconds taken by all reduce tasks=4456448
	Map-Reduce Framework
		Map input records=5
		Map output records=5
		Map output bytes=45
		Map output materialized bytes=67
		Input split bytes=180
		Combine input records=0
		Combine output records=0
		Reduce input groups=2
		Reduce shuffle bytes=67
		Reduce input records=5
		Reduce output records=2
		Spilled Records=10
		Shuffled Maps =2
		Failed Shuffles=0
		Merged Map outputs=2
		GC time elapsed (ms)=525
		CPU time spent (ms)=2510
		Physical memory (bytes) snapshot=641490944
		Virtual memory (bytes) snapshot=6241415168
		Total committed heap usage (bytes)=476053504
	Shuffle Errors
		BAD_ID=0
		CONNECTION=0
		IO_ERROR=0
		WRONG_LENGTH=0
		WRONG_MAP=0
		WRONG_REDUCE=0
	File Input Format Counters 
		Bytes Read=794
	File Output Format Counters 
		Bytes Written=17

10)運(yùn)行成功后執(zhí)行命令查看,此時(shí)多出一個(gè) /output 文件夾

[root@node02 hadoop-2.7.0]# hadoop fs -ls /
drwxr-xr-x   - root supergroup          0 2021-01-02 01:13 /input
drwxr-xr-x   - root supergroup          0 2021-01-02 01:37 /output
drwx------   - root supergroup          0 2021-01-02 01:37 /tmp

11)查看 /output文件夾的文件

[root@node02 hadoop-2.7.0]# hadoop fs -ls /output
-rw-r--r--   1 root supergroup          0 2021-01-02 01:37 /output/_SUCCESS
-rw-r--r--   1 root supergroup         17 2021-01-02 01:37 /output/part-00000

12)查看part-r-00000 文件夾中的內(nèi)容,我這個(gè)測(cè)試用例用來(lái)獲取1949年和1950年的最高氣溫(華氏度)

[root@node02 hadoop-2.7.0]# hadoop fs -cat /output/part-00000
1949	111
1950	22

13)在瀏覽器端訪問(wèn)端口可以觀看可視化界面,對(duì)應(yīng)的是hadoop服務(wù)器地址和自己設(shè)置的端口,通過(guò)可視化界面查看input文件夾面剛剛上傳的sample.txt文件
http://192.168.194.XXX:50070/

在這里插入圖片描述

14)測(cè)試程序jar包和測(cè)試文件已上傳到github上面,此目錄有面經(jīng)和我自己總結(jié)的面試題

GitHub
如有興趣的同學(xué)也可以查閱我的秒殺系統(tǒng)
秒殺系統(tǒng)

以上就是hadoop如何運(yùn)行java程序(jar包)運(yùn)行時(shí)動(dòng)態(tài)指定參數(shù)的詳細(xì)內(nèi)容,更多關(guān)于hadoop運(yùn)行java程序的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • 詳解如何在Java中實(shí)現(xiàn)堆排序算法

    詳解如何在Java中實(shí)現(xiàn)堆排序算法

    這篇文章主要為大家詳細(xì)介紹了如何利用Java實(shí)現(xiàn)堆排序算法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • spring Boot與Mybatis整合優(yōu)化詳解

    spring Boot與Mybatis整合優(yōu)化詳解

    關(guān)于spring-boot與mybatis整合優(yōu)化方面的介紹,就是Mybatis-Spring-boot-starter的介紹,具體內(nèi)容詳情大家參考下本文
    2017-07-07
  • Jmeter跨線程組共享cookie過(guò)程圖解

    Jmeter跨線程組共享cookie過(guò)程圖解

    這篇文章主要介紹了Jmeter跨線程組共享cookie過(guò)程圖解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-07-07
  • Spring成員對(duì)象注入的三種方式詳解

    Spring成員對(duì)象注入的三種方式詳解

    這篇文章主要為大家詳細(xì)介紹了Spring成員對(duì)象注入的三種方式,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來(lái)幫助
    2022-02-02
  • idea中報(bào)錯(cuò)不支持發(fā)行版本問(wèn)題及解決

    idea中報(bào)錯(cuò)不支持發(fā)行版本問(wèn)題及解決

    在使用Spring框架進(jìn)行項(xiàng)目開發(fā)時(shí),有時(shí)會(huì)遇到因JDK版本不一致導(dǎo)致的項(xiàng)目運(yùn)行錯(cuò)誤,解決此問(wèn)題的方法主要有兩步:首先,確保項(xiàng)目的Project和Modules設(shè)置中的JDK版本一致;其次,在IDE的Settings中找到Java?Compiler
    2024-11-11
  • IDEA之IDEA連接gitlab協(xié)同開發(fā)方式

    IDEA之IDEA連接gitlab協(xié)同開發(fā)方式

    通過(guò)IDEA克隆GitLab項(xiàng)目實(shí)現(xiàn)代碼協(xié)同開發(fā)相較于使用SourceTree,?通過(guò)IDEA連接GitLab進(jìn)行代碼協(xié)同開發(fā)更顯便捷,方法包括通過(guò)VersionControl創(chuàng)建新項(xiàng)目,輸入項(xiàng)目的git?HTTP地址和本地路徑,測(cè)試連接成功后克隆項(xiàng)目,修改代碼后
    2024-11-11
  • 解決springboot 啟動(dòng)找不到主類的問(wèn)題

    解決springboot 啟動(dòng)找不到主類的問(wèn)題

    這篇文章主要介紹了解決springboot 啟動(dòng)找不到主類的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-08-08
  • 簡(jiǎn)單了解Java關(guān)鍵字throw和throws的區(qū)別

    簡(jiǎn)單了解Java關(guān)鍵字throw和throws的區(qū)別

    這篇文章主要介紹了簡(jiǎn)單了解Java關(guān)鍵字throw和throws的區(qū)別,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-11-11
  • java8 利用reduce實(shí)現(xiàn)將列表中的多個(gè)元素的屬性求和并返回操作

    java8 利用reduce實(shí)現(xiàn)將列表中的多個(gè)元素的屬性求和并返回操作

    這篇文章主要介紹了java8 利用reduce實(shí)現(xiàn)將列表中的多個(gè)元素的屬性求和并返回操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-08-08
  • 劍指Offer之Java算法習(xí)題精講二叉樹與N叉樹

    劍指Offer之Java算法習(xí)題精講二叉樹與N叉樹

    跟著思路走,之后從簡(jiǎn)單題入手,反復(fù)去看,做過(guò)之后可能會(huì)忘記,之后再做一次,記不住就反復(fù)做,反復(fù)尋求思路和規(guī)律,慢慢積累就會(huì)發(fā)現(xiàn)質(zhì)的變化
    2022-03-03

最新評(píng)論

石河子市| 南漳县| 隆德县| 洞口县| 马尔康县| 金川县| 澳门| 大埔区| 报价| 仁怀市| 晋宁县| 巫山县| 习水县| 旌德县| 闽清县| 华池县| 日照市| 黑水县| 遂昌县| 甘德县| 三穗县| 宁晋县| 象州县| 独山县| 正蓝旗| 新化县| 钦州市| 加查县| 车险| 乐都县| 墨江| 高碑店市| 邛崃市| 抚宁县| 基隆市| 惠水县| 吉水县| 平远县| 梁山县| 江山市| 深州市|