日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > windows >内容正文

windows

hadoop windows

發(fā)布時(shí)間:2023/11/30 windows 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hadoop windows 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

1、安裝JDK1.6或更高版本

  官網(wǎng)下載JDK,安裝時(shí)注意,最好不要安裝到帶有空格的路徑名下,例如:Programe Files,否則在配置Hadoop的配置文件時(shí)會(huì)找不到JDK(按相關(guān)說(shuō)法,配置文件中的路徑加引號(hào)即可解決,但我沒(méi)測(cè)試成功)。

2、安裝Cygwin

  Cygwin是Windows平臺(tái)下模擬Unix環(huán)境的工具,需要在安裝Cygwin的基礎(chǔ)上安裝Hadoop,下載地址:http://www.cygwin.com/

  根據(jù)操作系統(tǒng)的需要下載32位或64的安裝文件。

  1)、雙擊下載好的安裝文件,點(diǎn)擊下一步,選擇install from internet

  
  2)、選擇安裝路徑

  3)、選擇local Package Directory

  4)、選擇您的Internet連接方式

  5)、選擇合適的安裝源,點(diǎn)擊下一步

  

  6)、在Select Packages界面里,Category展開(kāi)net,選擇如下openssh和openssl兩項(xiàng)

  

    如果要在Eclipe上編譯Hadoop,需要安裝Category為Base下的sed

  

    如果想在Cygwin上直接修改hadoop的配置文件,可以安裝Editors下的vim

  

  7)、點(diǎn)擊“下一步”,等待安裝完成。

3、配置環(huán)境變量

  在“我的電腦”上點(diǎn)擊右鍵,選擇菜單中的“屬性",點(diǎn)擊屬性對(duì)話框上的高級(jí)頁(yè)簽,點(diǎn)擊”環(huán)境變量"按鈕,在系統(tǒng)變量列表里雙擊“Path”變量,在變量值后輸入安裝的Cygwin的bin目錄,例如:D:\hadoop\cygwin64\bin

4、安裝sshd服務(wù)

  雙擊桌面上的Cygwin圖標(biāo),啟動(dòng)Cygwin,執(zhí)行ssh-host-config -y命令

  

  執(zhí)行后,會(huì)提示輸入密碼,否則會(huì)退出該配置,此時(shí)輸入密碼和確認(rèn)密碼,回車。最后出現(xiàn)Host configuration finished.Have fun!表示安裝成功。

  輸入net start sshd,啟動(dòng)服務(wù)。或者在系統(tǒng)的服務(wù)里找到并啟動(dòng)Cygwin sshd服務(wù)。

?  ?可能會(huì)遇到無(wú)法安裝和啟動(dòng)sshd服務(wù)的問(wèn)題,可參考此連接http://www.cnblogs.com/kinglau/p/3261886.html。

  另外如果是Win8操作系統(tǒng),啟動(dòng)Cygwin時(shí),需要以管理員身份運(yùn)行(右鍵圖標(biāo),選擇以管理員身份運(yùn)行),否則會(huì)因?yàn)闄?quán)限問(wèn)題,提示“發(fā)生系統(tǒng)錯(cuò)誤5”。

5、配置SSH免密碼登錄

  執(zhí)行ssh-keygen命令生成密鑰文件

  如下圖所示,輸入:ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa,注意-t -P -f參數(shù)區(qū)分大小寫(xiě)。

  ssh-keygen是生成密鑰命令

  -t 表示指定生成的密鑰類型(dsa,rsa)

  -P表示提供的密語(yǔ)

  -f指定生成的密鑰文件。

  注意:~代表當(dāng)前用戶的文件夾,/home/用戶名

  

  執(zhí)行此命令后,在你的Cygwin\home\用戶名 路徑下面會(huì)生成.ssh文件夾,可以通過(guò)命令ls -a /home/用戶名 ?查看,ssh -version命令查看版本。

  執(zhí)行完ssh-keygen命令后,再執(zhí)行下面命令,就可以生成authorized_keys文件了。

  cd ~/.ssh/

  cp id_dsa.pub authorized_keys

  如下圖所示:

  

  然后執(zhí)行exit命令,退出Cygwin窗口

6、再次在桌面上雙擊Cygwin圖標(biāo),打開(kāi)Cygwin窗口,執(zhí)行ssh localhost命令,第一次執(zhí)行該命令會(huì)有提示,輸入yes后,回車即可。如下圖所示

  

7、安裝Hadoop

?  hadoop官網(wǎng)下載http://hadoop.apache.org/releases.html。

  把hadoop壓縮包解壓到/home/用戶名 目錄下,文件夾名稱更改為hadoop,可以不修改,但后邊在執(zhí)行命令時(shí)稍顯麻煩。

  (1)單機(jī)模式配置方式

    單機(jī)模式不需要配置,這種方式下,Hadoop被認(rèn)為是一個(gè)單獨(dú)的Java進(jìn)程,這種方式經(jīng)常用來(lái)調(diào)試。

  (2)偽分布模式

    可以把偽分布模式看作是只有一個(gè)節(jié)點(diǎn)的集群,在這個(gè)集群中,這個(gè)節(jié)點(diǎn)既是Master,也是Slave,既是NameNode,也是DataNode,既是JobTracker,也是TaskTracker。

    這種模式下修改幾個(gè)配置文件即可。

    配置hadoop-env.sh,記事本打開(kāi)改文件,設(shè)置JAVA_HOME的值為你的JDK安裝路徑,例如:

    JAVA_HOME="D:\hadoop\Java\jdk1.7.0_25"    

    配置core-site.xml

按 Ctrl+C 復(fù)制代碼 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration><property><name>fs.default.name</name><value>hdfs://localhost:9000</value></property><property><name>mapred.child.tmp</name><value>/home/u/hadoop/tmp</value></property> </configuration> 按 Ctrl+C 復(fù)制代碼

配置hdfs-site.xml

按 Ctrl+C 復(fù)制代碼 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration><property><name>dfs.replication</name><value>1</value> </property> </configuration> 按 Ctrl+C 復(fù)制代碼

配置mapred-site.xml

按 Ctrl+C 復(fù)制代碼 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --> <configuration><property><name>mapred.job.tracker</name><value>localhost:9001</value></property><property><name>mapred.child.tmp</name><value>/home/u/hadoop/tmp</value></property> </configuration> 按 Ctrl+C 復(fù)制代碼

?

8、啟動(dòng)Hadoop

  打開(kāi)Cgywin窗口,執(zhí)行cd ~/hadoop命令,進(jìn)入hadoop文件夾,如下圖:

  

  啟動(dòng)Hadoop前,需要先格式化Hadoop的文件系統(tǒng)HDFS,執(zhí)行命令:bin/hadoop namenode -format

  注意namenode要小些,否則如果輸入NameNode,會(huì)提示錯(cuò)誤,找不到或無(wú)法加載主類NameNode。執(zhí)行正確命令后如下圖所示:

  

  輸入命令 bin/start-all.sh,啟動(dòng)所有進(jìn)程,如下圖:  

?

接下來(lái),驗(yàn)證是否安裝成功

打開(kāi)瀏覽器,分別輸入下列網(wǎng)址,如果能夠正常瀏覽,說(shuō)明安裝成功。

http://localhost:50030,回車打開(kāi)MapReduce的web頁(yè)面,如下圖(頁(yè)面部分截圖):

?

http://localhost:50070,回車打開(kāi)HDFS的web頁(yè)面,如下圖(頁(yè)面部分截圖):

?

第一次啟動(dòng)后,如果都不能瀏覽,或不能瀏覽某一個(gè),退出Cygwin,重新打開(kāi)Cygwin,執(zhí)行bin/start-all.sh命令。

如果只想啟動(dòng)MapReduce,可執(zhí)行bin/start-mapred.sh命令。

如果只想啟動(dòng)HDFS,可執(zhí)行bin/start-dfs.sh命令。

?

參考文獻(xiàn):

本文參考和引用了《Hadoop實(shí)戰(zhàn)》(作者:陸嘉恒)中的章節(jié)“2.3在Windows上安裝與配置Hadoop”。

特此聲明,如果涉及到版權(quán)問(wèn)題,請(qǐng)告知。

?

?

分類: Hadoop 綠色通道: 好文要頂 關(guān)注我 收藏該文與我聯(lián)系 kinglau
關(guān)注 - 16
粉絲 - 42 +加關(guān)注 5 0 (請(qǐng)您對(duì)文章做出評(píng)價(jià)) ? 上一篇:Windows 平臺(tái)下安裝Cygwin后,sshd服務(wù)無(wú)法啟動(dòng)
? 下一篇:Hadoop的datanode無(wú)法啟動(dòng)
posted @ 2013-08-20 16:15 kinglau 閱讀(34107) 評(píng)論(29) 編輯 收藏 評(píng)論列表 #1樓 2014-03-14 14:52 lovetimi 你好,看過(guò)你的文章后,跟著你做到
8、啟動(dòng)Hadoop
小寫(xiě)namenode還是會(huì)提示錯(cuò)誤,找不到或無(wú)法加載主類NameNode。
不知道是怎么回事。。 支持(0)反對(duì)(0) #2樓 2014-03-24 16:32 清清2013 http://localhost:50079,回車打開(kāi)HDFS的web頁(yè)面,如下圖(頁(yè)面部分截圖)

端口應(yīng)該是http://localhost:50070 支持(0)反對(duì)(0) #3樓 2014-04-02 15:52 jianshuang Administrator@wx ~
$ net start sshd
CYGWIN sshd ???????????? .
CYGWIN sshd ????????????????


Administrator@wx ~


這表示啟動(dòng)服務(wù)成功了吧。 支持(0)反對(duì)(0) #4樓 2014-04-05 17:50 KiwenLau @jianshuang
cygwin中文亂碼問(wèn)題解決可以參見(jiàn)我的博客《Cygwin中文亂碼》http://www.cnblogs.com/kiwenlau/p/3645752.html 支持(0)反對(duì)(0) http://pic.cnblogs.com/face/569245/20150603225120.png #5樓 2014-04-05 17:51 KiwenLau @清清2013
我也發(fā)現(xiàn)這個(gè)問(wèn)題了。還以為自己裝錯(cuò)了,樓主修改一下吧! 支持(0)反對(duì)(0) http://pic.cnblogs.com/face/569245/20150603225120.png #6樓[樓主] 2014-05-23 11:22 kinglau @清清2013
多謝,已修改。 支持(0)反對(duì)(0) #7樓 2014-06-25 20:59 程序猿213 你好,我按照您的步驟做,在執(zhí)行format的時(shí)候./hdfs namenode -format,報(bào)錯(cuò)如下:
錯(cuò)誤: 找不到或無(wú)法加載主類 org.apache.hadoop.hdfs.server.namenode.NameNode

請(qǐng)問(wèn)是什么原因呢 支持(0)反對(duì)(0) #8樓 2014-07-02 11:54 364718323 遇到7樓問(wèn)題 找不到解決方法吖 支持(0)反對(duì)(0) #9樓 2014-08-13 19:36 changanlaosan administrator@2012-20121224CP /cygdrive/d/hadoop-0.20.2
$ bin/hadoop namenode format
14/08/13 19:27:45 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = 2012-20121224CP/192.168.131.182
STARTUP_MSG: args = [format]
STARTUP_MSG: version = 0.20.2
STARTUP_MSG: build = //svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20 -r 911707; compiled by 'chrisdo' on Fri Feb 19 08:07:34 UTC 2010
************************************************************/
Usage: java NameNode [-format] | [-upgrade] | [-rollback] | [-finalize] | [-importCheckpoint]
14/08/13 19:27:45 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at 2012-20121224CP/192.168.131.182
************************************************************/
我崩潰了,到底怎么弄各種錯(cuò)誤,求樓主這個(gè)問(wèn)題怎么辦,我是新手謝謝了怎么弄都不行了 支持(0)反對(duì)(0) #10樓 2014-08-13 19:38 changanlaosan 最后格式化的時(shí)候出現(xiàn)了上邊的原因,樓主求解答、、 支持(0)反對(duì)(0) #11樓 2014-08-17 10:10 懂zj你 @lovetimi
請(qǐng)問(wèn)這個(gè)問(wèn)題你解決了嗎? 支持(0)反對(duì)(0) #12樓 2014-08-17 10:10 懂zj你 @changanlaosan
請(qǐng)問(wèn)這個(gè)問(wèn)題你解決了嗎? 支持(0)反對(duì)(0) #13樓 2014-08-17 10:11 懂zj你 @程序猿213
請(qǐng)問(wèn)這個(gè)問(wèn)題你解決了嗎? 支持(0)反對(duì)(0) #14樓[樓主] 2014-08-18 11:00 kinglau @changanlaosan
$ bin/hadoop namenode -format 支持(0)反對(duì)(0) #15樓 2014-10-31 13:40 孫暢 你好,我遇到問(wèn)題Administrator@ks-zx-pc-100 ~
$ ssh-host-config -y

*** Info: Generating missing SSH host keys
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file

*** Info: StrictModes is set to 'yes' by default.
*** Info: This is the recommended setting, but it requires that the POSIX
*** Info: permissions of the user's home directory, the user's .ssh
*** Info: directory, and the user's ssh key files are tight so that
*** Info: only the user has write permissions.
*** Info: On the other hand, StrictModes don't work well with default
*** Info: Windows permissions of a home directory mounted with the
*** Info: 'noacl' option, and they don't work at all if the home
*** Info: directory is on a FAT or FAT32 partition.
*** Query: Should StrictModes be used? (yes/no) yes

*** Info: Privilege separation is set to 'sandbox' by default since
*** Info: OpenSSH 6.1. This is unsupported by Cygwin and has to be set
*** Info: to 'yes' or 'no'.
*** Info: However, using privilege separation requires a non-privileged account
*** Info: called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Updating /etc/sshd_config file

*** Info: Sshd service is already installed.

*** Info: Host configuration finished. Have fun!

Administrator@ks-zx-pc-100 ~
$
輸入命令之后,并沒(méi)有提示我輸入密碼 支持(0)反對(duì)(0) #16樓 2014-11-03 16:28 孫暢 @changanlaosan
這個(gè)問(wèn)題我也遇到的,現(xiàn)在解決了,之所以出現(xiàn)這樣的問(wèn)題,是因?yàn)榕渲媚侨齻€(gè)文件出錯(cuò)了,你試下這樣的配置方法
修改 core-site.xml 為如下配置

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

修改 hdfs-site.xml 為如下配置

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

修改 mapred-site.xml 為如下配置

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>

總結(jié)

以上是生活随笔為你收集整理的hadoop windows的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。