注冊碼/key :1F04Z-6D111-7Z029-AV0Q4-3AEH8
l 開發中可使用桌面版VMware Workstation 11,便於向vShpere管理的ESXi Server服務器“上載”PC機中配置好虛擬機,便於把調試好的開發環境遷移到生產環境的服務器上。
OS:ubuntu-14.04.2-desktop-amd64.iso
***在Ubuntu中安裝VMwareTools以便於在宿主機和虛擬機之間共享內存,可以互相拷貝文本和文件,這個功能很方便,具體參見附錄1:《Linux虛擬機中手動安裝或升級VMware Tools》。
l 自定義用戶lolo及密碼ljl,這個安裝時候設置,該用戶在後面的FTP和SSH服務中用到該用戶。
詳見附錄一。
詳見附錄二
l 以下用vim和gedit修改相應腳本文件均可,如果是命令行就用vim,如果是圖形界面就用gedit。
n 進入root用戶權限
lolo@lolo-virtual-machine:~$ sudo -s
n 安裝vim編輯
注意:關於校園網linux無法上網的問題,如果你用的是WIFI上網,建議接入360wifi的訪問點中。
虛擬機使用
root@lolo-virtual-machine:~# apt-get install vim
n 修改lightdm.conf環境變量
root@lolo-virtual-machine:~# vim /etc/lightdm/lightdm.conf
#允許用戶登陸並關閉guest用戶
[SeatDefaults]
user-session=ubuntu
greeter-session=unity-greeter
greeter-show-manual-login=true
allow-guest=false
n 設置root用戶密碼
root@lolo-virtual-machine:~# sudo passwd root
設置密碼:ljl
n 修改/root/.profile:
備注:為避免root登錄開機出現以下提示:
Error found when loading /root/.profile
stdin:is not a tty
…………
root@lolo-virtual-machine:~# gedit /root/.profile
打開文件後找到“mesg n”,
將其更改為“tty -s && mesg n”
n 重啟
root@lolo-virtual-machine:~#reboot –h now
n 注意:目前JDK1.7是hadoop2.6.0和Spark1.3.1能夠穩定運行的最新版本,目前測試jdk-7u79-linux-x64.tar.gz可穩定運行,推薦。jdk-7u80-linux-x64.tar.gz和JDK1.8有些不穩定,不推薦使用。
下載鏈接http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
JDK會被下載到當前用戶的Downloads目錄下。
n 創建java安裝目錄
root@lolo-virtual-machine:~# mkdir /usr/lib/java
n 將壓縮包copy到安裝目錄
root@lolo-virtual-machine:~# mv /root/Downloads/jdk-7u79-linux-x64.tar.gz /usr/lib/java
n 進入安裝目錄
root@lolo-virtual-machine:~# cd /usr/lib/java
n 解壓縮JDK壓縮包
root@lolo-virtual-machine:/usr/lib/java# tar -xvf jdk-7u79-linux-x64.tar.gz
(也可以用圖形化界面來解壓縮)
n 編輯配置文件,添加環境變量。
root@lolo-virtual-machine:~# vim ~/.bashrc
“i”
加入:
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
export JRE_HOME=${JAVA_HOME}/jre
export CLASS_PATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
敲“esc” 鍵 輸入“:wq”保存退出。
n 使腳本配置生效
root@lolo-virtual-machine:~# source ~/.bashrc
下載鏈接: http://mirrors.cnnic.cn/apache/hadoop/common/hadoop-2.6.0/
此處下載的hadoop2.6.0已經是64位編譯的,可以在64位linux系統下使用。
root@lolo-virtual-machine:~# apt-get install ssh
或者:sudo apt-get install ssh openssh-server
(必要時reboot一下,校園網有時更新源有問題)
n 啟動服務
root@lolo-virtual-machine:~# /etc/init.d/ssh start
n 測試服務
root@lolo-virtual-machine:~# ps -e |grep ssh
n 設置免密碼登陸
root@lolo-virtual-machine:~# ssh-keygen -t rsa -P ""
root@lolo-virtual-machine:~# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
n 測試本地ssh服務:
root@lolo-virtual-machine:~# ssh localhost
root@lolo-virtual-machine:~#exit
n 安裝rsync
root@lolo-virtual-machine:~# apt-get install rsync
注意:目前最新版本為2.7.0,屬於測試版本,不穩定,建議使用2.6.0.
root@lolo-virtual-machine:~# mkdir /usr/local/hadoop
root@lolo-virtual-machine:~# cd /root/Downloads/
root@lolo-virtual-machine:~# mv /root/Downloads/ hadoop-2.6.0.tar.gz /usr/local/hadoop/
root@lolo-virtual-machine:~/Downloads# cd /usr/local/hadoop/
root@lolo-virtual-machine: /usr/local/hadoop # tar -xzvf hadoop-2.6.0.tar.gz
root@lolo-virtual-machine: /usr/local/hadoop # cd /usr/local/hadoop/hadoop-2.6.0/etc/Hadoop
查JDK路徑
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#${JAVA_HOME}
bash: /usr/lib/java/jdk1.7.0_79: Is a directory
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#vim hadoop-env.sh
備注:此處用gedit命令替代vim也可,看習慣。
鍵入“i”
將export JAVA_HOME=${JAVA_HOME}
改為export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
(其他兩個文件加入本句代碼):
敲“esc”鍵,輸入“:wq”保存退出。
應用該配置:
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#source hadoop-env.sh
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit yarn-env.sh
在# export JAVA_HOME=/home/y/libexec/jdk1.6.0/下面加入:
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#sourceyarn-env.sh
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit mapred-env.sh
在# export JAVA_HOME=/home/y/libexec/jdk1.6.0/下面加入:
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#source mapred-env.sh
root@lolo-virtual-machine:/# vim ~/.bashrc
n 插入
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
export JRE_HOME=${JAVA_HOME}/jre
export CLASS_PATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#HADOOP VARIABLES START
export HADOOP_INSTALL=/usr/local/hadoop/hadoop-2.6.0
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export PATH=$PATH:$HADOOP_INSTALL/etc/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
#HADOOP VARIABLES END
n 應用配置
root@lolo-virtual-machine:~# source ~/.bashrc
n 查看Hadoop版本
root@lolo-virtual-machine:~# hadoop version
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#mkdir input
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#cp README.txt input
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0# bin/hadoop jar share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.6.0-sources.jar org.apache.hadoop.examples.WordCount input output
n 查看結果
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0# cat output/*
*************至此Hadoop單機模式配置成功*********************
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#mkdir tmp
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#mkdir dfs
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#mkdir dfs/data
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#mkdir dfs/name
或
cd /usr/local/hadoop/hadoop-2.6.0
mkdir tmp dfs dfs/name dfs/data
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit core-site.xml
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit hdfs-site.xml
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit mapred-site.xml
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit yarn-site.xml
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0# cd /etc/hadoop
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit core-site.xml
n 偽分布式(Pseudo-Distributed Operation)
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# vim hdfs-site.xml
n 偽分布式(Pseudo-Distributed Operation)
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# vim mapred-site.xml
n 偽分布式(Pseudo-Distributed Operation)
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit yarn-site.xml
n 偽分布式(Pseudo-Distributed Operation)
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit masters
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit slaves
或:
sudo gedit /usr/local/hadoop/etc/hadoop/masters 添加:localhost
sudo gedit /usr/local/hadoop/etc/hadoop/slaves 添加:localhost
root@lolo-virtual-machine:~# hdfs namenode -format
2015-02-11 14:47:20,657 INFO [main] namenode.NameNode (StringUtils.java:startupShutdownMessage(633)) - STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = lolo-virtual-machine/127.0.1.1
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 2.6.0
root@lolo-virtual-machine:/# start-dfs.sh
root@lolo-virtual-machine:/# start-yarn.sh
root@lolo-virtual-machine:/# jps
幾個hadoop集群運行狀態監控Web頁面:
http://localhost:50030/jobtracker.jsp
http://localhost:50060/tasktracker.jsp
http://localhost:50070/dfshealth.jsp
root@lolo-virtual-machine:/# stop-dfs.sh
root@lolo-virtual-machine:/# stop-yarn.sh
查看網卡IP配置命令
root@lolo-virtual-machine:/# ifconfig
eth0Link encap:Ethernet HWaddr 00:0c:29:02:4f:ac
inet addr:192.168.207.136 Bcast:192.168.207.255 Mask:255.255.255.0
? 第一種方法:使用管理面板設置IP
? 打開控制面板,點擊“Network”
? 點擊Option,添加IP、網關和DNS
? 第二種方法:手動設置靜態IP()
1) 找到配置文件並作如下修改:
root@SparkMaster:/etc/NetworkManager/system-connections# vim Wired\ connection\ 1
修改如下部分:
[802-3-ethernet]
duplex=full
mac-address=00:0C:29:22:2D:C8
[connection]
id=Wired connection 1
uuid=de16d53e-bb1a-47c1-a2e8-70b9107b20ec
type=802-3-ethernet
timestamp=1430738836
[ipv6]
method=auto
[ipv4]
method=manual
dns=202.98.5.68;
dns-search=202.98.0.68;
address1=192.168.136.100/24,192.168.136.2
本例中使用圖形界面修改的,地址配置信息被保在了: /etc/NetworkManager/system-connections/目錄下的Wired connection 1文件中。
2)重啟網卡:
sudo /etc/init.d/networking restart
root@lolo-virtual-machine:/# vim /etc/hostname
lolo-virtual-machine改為:SparkMaster
重啟後測試:
root@lolo-virtual-machine:/#sudo reboot –h now
root@SparkMaster:/# hostname
SparkMaster
SparkWorker1,SparkWorker2同上
SparkWorker1的IP規劃為192.168.136.101
SparkWorker2的IP規劃為192.168.136.102
root@SparkMaster:/# vim /etc/hosts
將:
127.0.0.1 localhost
127.0.1.1 lolo-virtual-machine
改為:
127.0.0.1localhost
192.168.136.100 SparkMaster
192.168.136.101 SparkWorker1
192.168.136.102 SparkWorker2
注意:目前最新版本為2.7.0,屬於測試版本,不穩定,建議使用2.6.0.
root@SparkMaster:~# mkdir /usr/local/hadoop
root@SparkMaster:~# cd /root/Downloads/
root@SparkMaster:~# mv /root/Downloads/ hadoop-2.6.0.tar.gz /usr/local/hadoop/
root@SparkMaster:~ # cd /usr/local/hadoop/
root@SparkMaster:/usr/local/hadoop # tar -xzvf hadoop-2.6.0.tar.gz
root@SparkMaster:/usr/local/hadoop # cd /usr/local/hadoop/hadoop-2.6.0/etc/Hadoop
查JDK路徑
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#${JAVA_HOME}
bash: /usr/lib/java/jdk1.7.0_79: Is a directory
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#vim hadoop-env.sh
備注:此處用gedit命令替代vim也可,看習慣。
鍵入“i”
將export JAVA_HOME=${JAVA_HOME}
改為export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
(其他兩個文件加入本句代碼):
敲“esc”鍵,輸入“:wq”保存退出。
應用該配置:
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#source hadoop-env.sh
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit yarn-env.sh
在# export JAVA_HOME=/home/y/libexec/jdk1.6.0/下面加入:
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#sourceyarn-env.sh
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit mapred-env.sh
在# export JAVA_HOME=/home/y/libexec/jdk1.6.0/下面加入:
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#source mapred-env.sh
root@SparkMaster:/# vim ~/.bashrc
n 插入
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
export JRE_HOME=${JAVA_HOME}/jre
export CLASS_PATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#HADOOP VARIABLES START
export HADOOP_INSTALL=/usr/local/hadoop/hadoop-2.6.0
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export PATH=$PATH:$HADOOP_INSTALL/etc/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
export JAVA_LIBRARY_PATH=$HADOOP_INSTALL/lib/native
#HADOOP VARIABLES END
n 應用配置
root@SparkMaster:~# source ~/.bashrc
n 查看Hadoop版本
root@SparkMaster:~# hadoop version
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#mkdir tmp
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#mkdir dfs
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#mkdir dfs/data
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#mkdir dfs/name
或
cd /usr/local/hadoop/hadoop-2.6.0
mkdir tmp dfs dfs/name dfs/data
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit core-site.xml
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit hdfs-site.xml
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit mapred-site.xml
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit yarn-site.xml
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0# cd /etc/hadoop
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# gedit core-site.xml
n 分布式
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# vim hdfs-site.xml
n 分布式
注意:
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop# vim mapred-site.xml
n 分布式
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/etc/hadoop#gedit yarn-site.xml
n 分布式
sudo gedit /usr/local/hadoop/etc/hadoop/masters
分布式:
SparkMaster
sudo gedit /usr/local/hadoop/etc/hadoop/slaves
分布式:
SparkMaster
SparkWorker1
SparkWorker2
備注:本例把master也當作slave來用,所以把SparkMaster也加到了slaves文件裡了。
注意:如果想用Scala-2.11.6,需要下載spark-1.3.1源碼進行重新編譯。
解壓scala-2.10.5到
usr/lib/scala/
生成
usr/lib/scala/scala-2.10.5/
解壓spark-1.3.1-bin-hadoop2.6到
/usr/local/spark/
生成
/usr/local/spark/spark-1.3.1-bin-hadoop2.6/
root@SparkMaster:~# gedit ~/.bashrc
# for examples
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
export JRE_HOME=${JAVA_HOME}/jre
export SCALA_HOME=/usr/lib/scala/scala-2.10.5
export SPARK_HOME=/usr/lib/spark/spark-1.3.1-bin-hadoop2.6
export CLASS_PATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${SPARK_HOME}/bin:${SCALA_HOME}/bin:${JAVA_HOME}/bin:$PATH
#HADOOP VARIABLES START
export HADOOP_INSTALL=/usr/local/hadoop/hadoop-2.6.0
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export PATH=$PATH:$HADOOP_INSTALL/etc/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
#HADOOP VARIABLES END
使環境變量生效
root@SparkMaster:~# source ~/.bashrc
root@SparkMaster:~# gedit /usr/local/spark/spark-1.3.1-bin-hadoop2.6/conf/spark-env.sh
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
export SCALA_HOME=/usr/lib/scala/scala-2.10.5
export HADOOP_HOME=/usr/local/hadoop/hadoop-2.6.0
export HADOOP_CONF_DIR=/usr/local/hadoop/hadoop-2.6.0/etc/hadoop
export SPARK_MASTER_IP=SparkMaster
export SPARK_MEMORY=2g
“export SPARK_MEMORY=2g”可與虛擬機內存大小一致
gedit /usr/local/spark/spark-1.3.1-bin-hadoop2.6/conf/slaves
SparkMaster
SparkWorker1
SparkWorker2
----------–----SparkMaster作為兩種角色--------------
scp /usr/local/spark/spark-1.3.1-bin-hadoop2.6/conf/slaves root@SparkWorker1:/usr/local/spark/spark-1.3.1-bin-hadoop2.6/conf/
scp /usr/local/spark/spark-1.3.1-bin-hadoop2.6/conf/slaves root@SparkWorker2:/usr/local/spark/spark-1.3.1-bin-hadoop2.6/conf/
下載路徑:http://www.jetbrains.com/idea/download/
安裝路徑:/usr/local/idea/idea-IC-141.731.2/
scala插件下載路徑:http://plugins.jetbrains.com/files/1347/19130/scala-intellij-bin-1.4.15.zip
環境變量配置:
gedit ~/.bashrc
# for examples
export JAVA_HOME=/usr/lib/java/jdk1.7.0_79
export JRE_HOME=${JAVA_HOME}/jre
export SCALA_HOME=/usr/lib/scala/scala-2.10.5
export SPARK_HOME=/usr/lib/spark/spark-1.3.1-bin-hadoop2.6
export CLASS_PATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=/usr/local/idea/idea-IC-141.731.2/bin:${SPARK_HOME}/bin:${SCALA_HOME}/bin:${JAVA_HOME}/bin:$PATH
#HADOOP VARIABLES START
export HADOOP_INSTALL=/usr/local/hadoop/hadoop-2.6.0
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export PATH=$PATH:$HADOOP_INSTALL/etc/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
#HADOOP VARIABLES END
備注:這個版本的 .bashrc文件是最完整的!
如果你使用的VMware虛擬機,可以使用clone的功能,克隆SparkWorker1、SparkWorker2,建議完全克隆,不是用鏈接模式,避免依賴。
克隆完修改IP和主機名。
用Ping命令測試
root@SparkMaster:/#ping SparkWorker1
ping 主機名Master、SparkWorker1、SparkWorker2
ctl+c結束
1)驗證
備注:參考單機版SSH的配置
root@SparkMaster:~# ssh SparkWorker1
root@SparkWorker1:~# exit
root@SparkMaster:~# cd /root/.ssh
root@SparkMaster:~/.ssh# ls
authorized authorized_keys id_rsa id_rsa.pub known_hosts
2)從slave向Master上傳公鑰文件id_rsa.pub
SparkWorker1上傳公鑰給SparkMaster:
root@SparkWorker1: ~#cd /root/.ssh
root@SparkWorker1:~/.ssh#ls
authorized authorized_keys id_rsa id_rsa.pub known_hosts
root@SparkWorker1:~/.ssh#scp id_rsa.pub root@SparkMaster:/root/.ssh/id_rsa.pub.SparkWorker1
id_rsa.pub 100% 407 0.4KB/s 00:00
SparkWorker2上傳公鑰給Master:
root@SparkWorker2:~/.ssh# scpid_rsa.pub root@SparkMaster:/root/.ssh/id_rsa.pub.SparkWorker2
id_rsa.pub 100% 407 0.4KB/s 00:00
3)Master組合公鑰並分發
Master上看到公鑰已經傳過來:
root@SparkMaster:~/.ssh# ls
authorized id_rsa id_rsa.pub.SparkWorker1 known_hosts
authorized_keys id_rsa.pub id_rsa.pub.SparkWorker2
在Master上綜合所有公鑰:
root@SparkMaster:~/.ssh# cat id_rsa.pub>>authorized_keys
root@SparkMaster:~/.ssh# cat id_rsa.pub.SparkWorker1>>authorized_keys
root@SparkMaster:~/.ssh# cat id_rsa.pub.SparkWorker2>>authorized_keys
Master分發公鑰給SparkWorker1和SparkWorker2
root@SparkMaster:~/.ssh# scp authorized_keys root@SparkWorker1:/root/.ssh/authorized_keys
root@SparkMaster:~/.ssh# scp authorized_keys root@SparkWorker2:/root/.ssh/authorized_keys
如果調試過程中修改了配置文件,需要進行主從同步,需要同步的文件包括:
l Hadoop需要的:
~/.bashrc、hadoop-env.sh、yarn-env.sh、mapred-env.sh、core-site.xml、hdfs-site.xml、mapred-site.xml、yarn-site.xml、masters、slaves、hosts。
l Spark需要的:
~/.bashrc、spark-env.sh,spark目錄下的slaves。
更簡便的方法是使用root用戶拷貝:java、hadoop(scala、spark、idea順便帶上,後面具體介紹)目錄到另兩台機器上。
root@SparkMaster:~# scp ~/.bashrc root@sparkworker1:/root/.bashrc
root@SparkMaster:~# scp -r /usr/lib/java root@sparkworker1:/usr/lib/
root@SparkMaster:~# scp -r /usr/local/hadoop root@sparkworker1:/usr/local/
root@SparkMaster:~# scp -r /usr/lib/scala root@sparkworker1:/usr/lib/
root@SparkMaster:~# scp -r /usr/local/spark root@sparkworker1:/usr/local/
root@SparkMaster:~# scp -r /usr/local/idea root@sparkworker1:/usr/local/
sparkworker2同上
注意:spark1.3.1(spark-1.3.1-bin-hadoop2.6)需要使用scala2.10.x版本。
如果想使用最新的scala2.11.6需要下載spark-1.3.1.tgz,並重新編譯,再使用。
n 格式化集群文件系統
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin#./hdfs namenode -format
或root@SparkMaster:/# hdfs namenode -format
15/05/01 18:37:29 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = SparkMaster/192.168.136.100
STARTUP_MSG: args = [-format]
。。。。。。
STARTUP_MSG: version = 2.6.0Re-format filesystem in Storage Directory /usr/local/hadoop/hadoop-2.6.0/dfs/name ? (Y or N) Y
15/05/01 18:37:33 INFO namenode.FSImage: Allocated new BlockPoolId: BP-77366057-192.168.136.100-1430476653791
15/05/01 18:37:33 INFO common.Storage: Storage directory /usr/local/hadoop/hadoop-2.6.0/dfs/name has been successfully formatted.
15/05/01 18:37:33 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
15/05/01 18:37:33 INFO util.ExitUtil: Exiting with status 0
15/05/01 18:37:33 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at SparkMaster/192.168.136.100
************************************************************/
n 啟動hadoop服務
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin# ./start-dfs.sh
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin# jps
3218 DataNode
4758 Jps
3512 SecondaryNameNode
4265 NodeManager
3102 NameNode
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin# ./start-yarn.sh
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin# jps
3218 DataNode
4758 Jps
3512 SecondaryNameNode
4265 NodeManager
3102 NameNode
4143 ResourceManager
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin# ./mr-jobhistory-daemon.sh start historyserver
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin# jps
4658 JobHistoryServer
3218 DataNode
4758 Jps
3512 SecondaryNameNode
4265 NodeManager
3102 NameNode
4143 ResourceManager
n 典型故障排除
root@SparkMaster:~# stop-all.sh
報錯:
SparkMaster: stopping tasktracker
SparkWorker2: stopping tasktracker
SparkWorker1: stopping tasktracker
stopping namenode
Master: stopping datanode
SparkWorker2: no datanode tostop
SparkWorker1: no datanode tostop
Master: stopping secondarynamenode
解決:
n 清空以下目錄中的所有內容
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#rm -rf tmp/*
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#rm -rf dfs/data/*
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0#rm -rf dfs/name/*
n 格式化和啟動集群
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop namenode –format
…………
Re-format filesystem in /usr/local/hadoop/hadoop-2.6.0/hdfs/name? (Y or N) Y(***此處一定要用大寫的Y,否則無法格式化)
************************************************************/
n 重新啟動hadoop服務
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin#./start-dfs.sh
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin#./start-yarn.sh
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/sbin#./mr-jobhistory-daemon.sh start historyserver
(停止historyserver:sudo mr-jobhistory-daemon.shstop historyserver)
root@SparkMaster:~#start-all.sh(可不用啟動)
n 看一下各節點的運行狀況:
root@SparkMaster:~# hdfs dfsadmin -report
Configured Capacity: 53495648256 (49.82 GB)
Present Capacity: 29142274048 (27.14 GB)
DFS Remaining: 29141831680 (27.14 GB)
DFS Used: 442368 (432 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
-------------------------------------------------
Live datanodes (3):
Name: 192.168.136.102:50010 (SparkWorker2)
Hostname: SparkWorker2
Decommission Status : Normal
Configured Capacity: 17831882752 (16.61 GB)
DFS Used: 147456 (144 KB)
Non DFS Used: 8084967424 (7.53 GB)
DFS Remaining: 9746767872 (9.08 GB)
DFS Used%: 0.00%
DFS Remaining%: 54.66%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri May 01 22:13:37 CST 2015
Name: 192.168.136.101:50010 (SparkWorker1)
Hostname: SparkWorker1
Decommission Status : Normal
Configured Capacity: 17831882752 (16.61 GB)
DFS Used: 147456 (144 KB)
Non DFS Used: 7672729600 (7.15 GB)
DFS Remaining: 10159005696 (9.46 GB)
DFS Used%: 0.00%
DFS Remaining%: 56.97%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri May 01 22:13:37 CST 2015
Name: 192.168.136.100:50010 (SparkMaster)
Hostname: SparkMaster
Decommission Status : Normal
Configured Capacity: 17831882752 (16.61 GB)
DFS Used: 147456 (144 KB)
Non DFS Used: 8595677184 (8.01 GB)
DFS Remaining: 9236058112 (8.60 GB)
DFS Used%: 0.00%
DFS Remaining%: 51.80%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri May 01 22:13:37 CST 2015
****************至此,分布式Hadoop集群構建完畢*************************
root@SparkMaster:/usr/local/spark/spark-1.3.1-bin-hadoop2.6/sbin# ./start-all.sh
starting org.apache.spark.deploy.master.Master, logging to /usr/local/spark/spark-1.3.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.master.Master-1-SparkMaster.out
SparkMaster: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.3.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-SparkMaster.out
SparkWorker1: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.3.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-SparkWorker1.out
SparkWorker2: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.3.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-SparkWorker2.out
root@SparkMaster:/usr/local/spark/spark-1.3.1-bin-hadoop2.6/sbin# jps
13018 Master
11938 NameNode
12464 ResourceManager
13238 Worker
13362 Jps
12601 NodeManager
12296 SecondaryNameNode
12101 DataNode
10423 JobHistoryServer
root@SparkWorker1:~# jps
5344 NodeManager
5535 Worker
5634 Jps
5216 DataNode
root@SparkWorker2:~# jps
4946 NodeManager
5246 Jps
5137 Worker
4818 DataNode
root@SparkMaster:/usr/local/spark/spark-1.3.1-bin-hadoop2.6/bin# ./spark-shell
15/05/01 19:12:24 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/05/01 19:12:24 INFO spark.SecurityManager: Changing view acls to: root
15/05/01 19:12:24 INFO spark.SecurityManager: Changing modify acls to: root
15/05/01 19:12:24 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
15/05/01 19:12:24 INFO spark.HttpServer: Starting HTTP Server
15/05/01 19:12:24 INFO server.Server: jetty-8.y.z-SNAPSHOT
15/05/01 19:12:24 INFO server.AbstractConnector: Started [email protected]:42761
15/05/01 19:12:24 INFO util.Utils: Successfully started service 'HTTP class server' on port 42761.
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 1.3.1 /_/
Using Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79)
Type in expressions to have them evaluated.
。。。。。。。。。。。。。。。。
scala>
root@SparkMaster:~# jps
13391 SparkSubmit
13018 Master
11938 NameNode
12464 ResourceManager
13238 Worker
13570 Jps
12601 NodeManager
12296 SecondaryNameNode
12101 DataNode
10423 JobHistoryServer
root@SparkMaster:~#
http://sparkmaster:50070
http://sparkmaster:8088
http://sparkmaster:8042
http://sparkmaster:19888/
http://sparkmaster:8080/
http://sparkmaster:4040
n 准備Hadoop分布式文件目錄
首先在hdfs文件系統上創建兩個目錄,wordcount用於存放准備單詞級數的文件,output用於存放結果。
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop fs-mkdir -p /data/wordcount
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop fs -mkdir -p /output/
備注:新版本建議用hdfs dfs替代hadoop fs
n 向分布式文件目錄中拷貝文件
把hadoop的etc/hadoop目錄下的所有xml文件放到wordcount中。
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop fs-put ../etc/hadoop/*.xml /data/wordcount/
n 執行wordcount算例
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop jar ../share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar wordcount /data/wordcount /output/wordcount
n 輸出結果
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop fs -cat /output/wordcount/*
n 重新執行算例
馬上重新運行該示例會報錯,刪掉output下的wordcount目錄即可,具體如下:
n 查看hdfs根目錄:
注:新版Hadoop建議用hdfs dfs ……代替hadoop fs ……
由於配置的路徑環境變量,以下命令可以在任何路徑下直接使用。
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin#./hdfs dfs -ls /
或
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin#./hadoop fs -ls /
Found 3 items
drwxr-xr-x - root supergroup 0 2015-05-01 19:45 /data
drwxr-xr-x - root supergroup 0 2015-05-01 20:24 /output
drwxrwx--- - root supergroup 0 2015-05-01 18:51 /tmp
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hdfs fs -ls /output
Found 1 items
drwxr-xr-x - root supergroup 0 2015-05-01 20:47 /output/wordcount
n 先刪掉/output/wordcount目錄
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hdfs fs -rm -r /output/wordcount
n 再次運行示例
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/bin# hadoop jar ../share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar wordcount /data/wordcount /output/wordcount
關閉hadoop
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0/bin# stop-all.sh
備注:如需重新運行應用需刪除output目錄及文件
root@lolo-virtual-machine:/usr/local/hadoop/hadoop-2.6.0#hadoop dfs -rm output
root@SparkMaster:/usr/local/spark/spark-1.3.1-bin-hadoop2.6# hadoop fs -put README.md /data/
scala> val file = sc.textFile("hdfs://SparkMaster:9000/data/README.md")
15/05/01 21:23:28 INFO storage.MemoryStore: ensureFreeSpace(182921) called with curMem=0, maxMem=278302556
15/05/01 21:23:28 INFO storage.MemoryStore: Block broadcast_0 stored as values in memory (estimated size 178.6 KB, free 265.2 MB)
15/05/01 21:23:28 INFO storage.MemoryStore: ensureFreeSpace(25373) called with curMem=182921, maxMem=278302556
15/05/01 21:23:28 INFO storage.MemoryStore: Block broadcast_0_piece0 stored as bytes in memory (estimated size 24.8 KB, free 265.2 MB)
15/05/01 21:23:28 INFO storage.BlockManagerInfo: Added broadcast_0_piece0 in memory on localhost:42086 (size: 24.8 KB, free: 265.4 MB)
15/05/01 21:23:28 INFO storage.BlockManagerMaster: Updated info of block broadcast_0_piece0
15/05/01 21:23:28 INFO spark.SparkContext: Created broadcast 0 from textFile at
file: org.apache.spark.rdd.RDD[String] = hdfs://SparkMaster:9000/data/README.md MapPartitionsRDD[1] at textFile at
scala> val count = file.flatMap(line => line.split(" ")).map(word => (word,1)).reduceByKey(_+_)
15/05/01 21:23:45 INFO mapred.FileInputFormat: Total input paths to process : 1
count: org.apache.spark.rdd.RDD[(String, Int)] = ShuffledRDD[4] at reduceByKey at
scala> count.collect
15/05/01 21:24:25 INFO spark.SparkContext: Starting job: collect at
15/05/01 21:24:25 INFO scheduler.DAGScheduler: Registering RDD 3 (map at
15/05/01 21:24:25 INFO scheduler.DAGScheduler: Got job 0 (collect at
……………
res0: Array[(String, Int)] = Array((package,1), (this,1), (Because,1), (Python,2), (cluster.,1), (its,1), ([run,1), (general,2), (YARN,,1), (have,1), (pre-built,1), (locally.,1), (changed,1), (locally,2), (sc.parallelize(1,1), (only,1), (several,1), (This,2), (basic,1), (first,1), (documentation,3), (Configuration,1), (learning,,1), (graph,1), (Hive,2), (["Specifying,1), ("yarn-client",1), (page](http://spark.apache.org/documentation.html),1), ([params]`.,1), (application,1), ([project,2), (prefer,1), (SparkPi,2), (
scala>
對於 Linux 虛擬機,您可以使用命令行工具手動安裝或升級 VMware Tools。在升級VMware Tools 前,請考察運行虛擬機的環境,並權衡不同升級策略的利弊。例如,您可以安裝最新版本的VMware Tools 以增強虛擬機的客戶機操作系統的性能並改進虛擬機管理,也可以繼續使用現有版本以在所處環境中提供更大的靈活性。
前提條件
■ 打開虛擬機電源。
■ 確認客戶機操作系統正在運行。
■ 由於 VMware Tools 安裝程序是采用 Perl 語言編寫的,因此請確認客戶機操作系統中已安裝Perl
方法一、圖形化界面安裝:
1.載入vmware tools光盤鏡像
系統自動裝載vmware tools光盤,並彈出窗口。
2.解壓安裝包
3.安裝vmware tools軟件
執行如下命令:
sudo /tmp/vmware-tools-distrib/vmware-install.pl
一路默認,就OK了!
方法二、命令行安裝方式
步驟
1 在主機上,從 Workstation 菜單欄中選擇虛擬機> 安裝VMware Tools。如果安裝了早期版本的VMware Tools,則菜單項為更新VMware Tools。
2 在虛擬機中,以 root 身份登錄客戶機操作系統,然後打開終端窗口。
3 不帶參數運行 mount 命令,以確定Linux 發行版是否自動裝載VMware Tools 虛擬CD-ROM 映像。
如果裝載了 CD-ROM 設備,將按如下方式列出 CD-ROM設備及其裝載點:/dev/cdrom on /mnt/cdrom type iso9660 (ro,nosuid,nodev)
4 如果未裝載 VMware Tools 虛擬CD-ROM 映像,請裝載CD-ROM 驅動器。
a 如果裝載點目錄尚不存在,請創建該目錄。
mkdir /mnt/cdrom
某些 Linux 發行版使用不同的裝載點名稱。例如,某些發行版上的裝載點是/media/VMware Tools 而不是/mnt/cdrom。請修改該命令以反映您的發行版使用的約定。
b 裝載 CD-ROM 驅動器。
mount /dev/cdrom /mnt/cdrom
某些 Linux 發行版使用不同的設備名稱,或者以不同的方式組織/dev 目錄。如果CD-ROM 驅動器不是/dev/cdrom 或CD-ROM 裝載點不是/mnt/cdrom,則必須修改該命令以反映您的發行版使用的約定。
5 轉到工作目錄,例如 /tmp。
cd /tmp
6 安裝 VMware Tools 之前,刪除先前的vmware-tools-distrib 目錄。
該目錄的位置取決於先前安裝時存儲的位置。通常,該目錄位於 /tmp/vmware-tools-distrib。
7 列出裝載點目錄的內容,並記下 VMware Tools tar安裝程序的文件名。
ls mount-point
8 解壓縮安裝程序。
tar zxpf /mnt/cdrom/VMwareTools-x.x.x-yyyy.tar.gz
x.x.x 值是產品版本號,yyyy 是產品發行版本的內部版本號。
如果您嘗試安裝 tar 安裝以覆蓋 RPM安裝或相反,安裝程序將檢測以前的安裝,並且必須轉換安裝程序數據庫格式後才能繼續操作。
9 如果需要,請卸載 CD-ROM 映像。
umount /dev/cdrom
如果 Linux 發行版自動裝載 CD-ROM,則不需要卸載該映像。
10 運行安裝程序並配置 VMware Tools。
cd vmware-tools-distrib
./vmware-install.pl
通常情況下,運行完安裝程序文件之後會運行 vmware-config-tools.pl 配置文件。
11 如果默認值符合您的配置,則請按照提示接受默認值。
12 按照腳本末尾的說明操作。
視所用的功能而定,這些說明可能包括重新啟動 X 會話、重新啟動網絡連接、重新登錄以及啟動 VMware 用戶進程。或者,也可以重新引導客戶機操作系統以完成所有這些任務。
如果自己改過vsftpd配置文件,錯誤的配置文件會導致vsftpd無法啟動。可以先嘗試徹底刪除vsftpd,然後重新安裝,用缺省的vsftpd配置文件。
n 刪除vsftpd
sudo apt-get purge vsftpd
n 重新安裝
sudo apt-get install vsftpd
n 查看服務
ps -ef |grep vsftpd
最後一條命令應該可以看到這樣的結果:
root@SparkWorker1:~# ps -ef |grep vsftpd
root 1312 1 0 15:34 ? 00:00:00 /usr/sbin/vsftpd <--看到這個就說明vsftpd起來了
root 3503 2708 0 17:43 pts/7 00:00:00 grep --color=auto vsftpd
n 修改配置文件vsftpd.conf
先備份配置文件
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.old
修改配置文件
gedit /etc/vsftpd.conf
把文件中的
# write_enable=YES的注釋去掉變為:
write_enable=YES
允許上傳文件,其他配置不變,這是最簡單的ftp配置,可實現文件的上傳和下載,使用win-scp工具,使用最開始安裝操作系統的用戶“lolo”可以查看和上傳文件,這裡主要用這個功能向linux裡傳文件。如果需要更多的安全性就需要配置其他的內容,略。
n 重新啟動vsftpd
sudo /sbin/service vsftpd restart
用lolo用戶登陸即可
n 使用Win-SCP連接Ftp服務器
在Windows中使用SecureCRT的SSH2協議連接到Ubuntu Linux上進行遠程管理,需要停止防火牆
l 關閉防火牆命令:
root@SparkMaster:~# sudo ufw disable
使用安裝時建立用戶“lolo”登陸,root用戶默認不允許使用ssh遠程連接。
l 打開防火牆命令:(打開後ssh登陸不上了,除非做訪問控制列表策略)
root@SparkMaster:~# sudo ufw enable
首先添加root用戶的密碼,然後編輯/etc/ssh/sshd_config。注釋了這句PermitRootLogin without-password,然後在這句下面添加如下這句:PermitRootLogin yes。最後重啟ssh即可實現root用戶使用ssh登錄。(沒成功,還沒細研究)
修改/etc/ssh/sshd_config文件.
將其中的PermitRootLogin no修改為yes
PubkeyAuthentication yes修改為no
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉,
PasswordAuthentication no修改為yes就可以了。
備注:百度雲盤上傳文件時需要用到Flash插件。
(1) 下載tar包:
http://get.adobe.com/flashplayer/
下載到一個目錄內,解壓。會出現三個文件或目錄:
libflashplayer.so
readme.txt
usr(目錄)
根據readme.txt說明:
(2) 安裝插件
要把libflashplayer.so這個文件拷貝到浏覽器插件目錄下
火狐的插件目錄為:/usr/lib/mozilla/plugins/
在解壓後的目錄下,執行命令:
sudo cp libflashplayer.so /usr/lib/mozilla/plugins/
sudo cp -r usr/* /usr/
這樣就安裝好了。
(3) 從其他浏覽器導入書簽
打開firefox浏覽器,在menubars裡找到Bookmarks選項,點擊第一項Show all bookmarks:
找到import and backup選項,選擇最後一項,import data from other browers,就可以導入書簽了。
下面到了同步的階段,在選項欄裡tools選項,選擇sync now,後面按步驟操作就行了。
備注:
判斷是否都是64位的hadoop,可用“file”命令查看
root@SparkMaster:/usr/local/hadoop/hadoop-2.6.0/lib/native# file libhadoop.so.1.0.0
libhadoop.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2bf804e2565fd12f70c8beba1e875f73b5ea30f9, not stripped
如上所示已經是64位的就不需要編譯了,經過驗證目前的官方發布的hadoop2.6.0已經是64位的,不需要編譯了。下面的方法你可以略過。
如果你對hadoop進行了源碼修改,那就需要進行編譯,下面的方法還可以看,期待會用到O(∩_∩)0!
1、安裝JDK,我這裡使用的是OpenJDK
(如果你使用的是官方的jdk1.7就不用安裝了)
sudo apt-get install default-jdk
注意:如果安裝了其他版本的JDK,需要修改~/.bashrc文件,修改JAVA_HOME的路徑為:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
java -version
顯示版本信息:
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
2、安裝maven
sudo apt-get install maven
mvn –version
或mvn --version
顯示版本信息:
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-30-generic", arch: "amd64", family: "unix"
3、安裝openssh
sudo apt-get install openssh-server
4、安裝依賴庫
sudo apt-get install g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev
5、安裝protoc
sudo apt-get install protobuf-compiler
protoc --version
顯示版本信息:
libprotoc 2.5.0
6、開始編譯
進入HADOOP源代碼目錄 hadoop-2.6.0-src,執行:
mvn clean package -Pdist,native -DskipTests -Dtar
好了,經過漫長等待, 應該就能得到編譯好的結果了。
7、編譯好的文件放在:
/usr/local/hadoop/hadoop-2.6.0-src/hadoop-dist/target/hadoop-2.6.0目錄中
另外有一個編譯好的壓縮包hadoop-2.6.0.tar.gz在
/usr/local/hadoop/hadoop-2.6.0-src/hadoop-dist/target/目錄中
將該目錄移動到hadoop目錄下或將壓縮包解壓到該目錄下即可。