小編給大家分享一下hadoop 2偽分布式如何搭建,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
創(chuàng)新互聯(lián)從2013年開(kāi)始,是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元六合做網(wǎng)站,已為上家服務(wù),為六合各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話(huà):13518219792
單點(diǎn)偽分布式
1.下載hadoop
2.安裝jdk,設(shè)置環(huán)境變量
export JAVA_HOME=/usr/local/java/jdk1.7.0_79
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=./:/$JAVA_HOME/lib:$JAVA_HOME/jre/lib
[root@iZ281cu2lqjZ etc]# source /etc/profile
3.創(chuàng)建用于和組
groupadd hadoop
useradd -g hadoop yarn
useradd -g hadoop hdfs
useradd -g hadoop mapred
4.創(chuàng)建數(shù)據(jù)和日志目錄
mkdir -p /var/data/hadoop/hdfs/nn
mkdir -p /var/data/hadoop/hdfs/snn
mkdir -p /var/data/hadoop/hdfs/dn
chown hdfs:hadoop /var/data/hadoop/hdfs -R
mkdir -p /var/log/hadoop/yarn
chown yarn:hadoop /var/log/hadoop/yarn -R
進(jìn)入yarnhadoop的目錄中
mkdir logs
chmod g+w logs
chown yarn:hadoop . -R
5.配置core-site.xml
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.http.staticuser.user</name>
<value>hdfs</value>
</property>
fs.default.name 是Namenode指定了主機(jī)名和請(qǐng)求端口號(hào);
hadoop.http.staticuser.user 是hdfs的默認(rèn)用戶(hù)名
6.配置hdfs.site.xml
<property>
<name>dfs.replication</name>
<value>1</value> ---默認(rèn)為3
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/var/data/hadoop/hdfs/nn</value>
</property>
<property>
<name>fs.checkpoint.dir</name>
<value>file:/var/data/hadoop/hdfs/snn</value>
</property>
<property>
<name>fs.checkpoint.edit.dir</name>
<value>file:/var/data/hadoop/hdfs/snn</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/var/data/hadoop/hdfs/db</value>
</property>
7.配置mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
為mapreduce制定框架名,使用 yarn
8 配置yarn-site.xml
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
主要是配置shuffle,默認(rèn)是沒(méi)有配置shuffle
9.調(diào)整JAVA堆大小
hadoop-env.sh
HADOOP_HEAPSIZE="500"
yarn-env.sh
YARN_HEAPSIZE=500
10.格式化HDFS
切換到hdfs用戶(hù),進(jìn)入到hadoop bin目錄執(zhí)行
./hdfss namenode -format
碰到問(wèn)題
11../hdfs namenode -format
12.[hdfs@localhost sbin]$ ./hadoop-daemon.sh start namenode
starting namenode, logging to /opt/yarn/hadoop-2.7.1/logs/hadoop-hdfs-namenode-localhost.out
[hdfs@localhost sbin]$ ./hadoop-daemon.sh start secondarynamenode
starting secondarynamenode, logging to /opt/yarn/hadoop-2.7.1/logs/hadoop-hdfs-secondarynamenode-localhost.out
[hdfs@localhost sbin]$ ./hadoop-daemon.sh start datanode
starting datanode, logging to /opt/yarn/hadoop-2.7.1/logs/hadoop-hdfs-datanode-localhost.out
使用JPS可以檢查進(jìn)程
結(jié)果:
[hdfs@localhost sbin]$ jps
3915 SecondaryNameNode
3969 DataNode
3833 NameNode
4047 Jps
12.啟動(dòng)yarn
[yarn@localhost sbin]$ ./yarn-daemon.sh start nodemanager
/opt/yarn/hadoop-2.7.1/etc/hadoop/yarn-env.sh: line 121: unexpected EOF while looking for matching `"'
/opt/yarn/hadoop-2.7.1/etc/hadoop/yarn-env.sh: line 124: syntax error: unexpected end of file
starting nodemanager, logging to /opt/yarn/hadoop-2.7.1/logs/yarn-yarn-nodemanager-localhost.out
/opt/yarn/hadoop-2.7.1/etc/hadoop/yarn-env.sh: line 121: unexpected EOF while looking for matching `"'
/opt/yarn/hadoop-2.7.1/etc/hadoop/yarn-env.sh: line 124: syntax error: unexpected end of file
[yarn@localhost sbin]$ jps
4132 ResourceManager
4567 Jps
4456 NodeManager
13 驗(yàn)證
訪(fǎng)問(wèn): ip:50070
ip:8088
最后可以運(yùn)行hadoop包中的例子進(jìn)行檢驗(yàn)。這就是偽分布式簡(jiǎn)單的安裝步驟。
問(wèn)題:如果遇到50070端口不能訪(fǎng)問(wèn)就是 yarn沒(méi)有成功啟動(dòng)。
去sbin啟動(dòng)yarn ./start-yarn.sh時(shí)報(bào)
localhost: Error: JAVA_HOME is not set and could not be found.
需要修改 hadoop-env.xml中java_home設(shè)置為絕對(duì)路徑。
重啟yarn 解決問(wèn)題。
配置hbase:
修改hbase-env.sh
修改# export JAVA_HOME=/usr/local/java/jdk1.7.0_79
修改 hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>
啟動(dòng)hbase:
[root@iZ281cu2lqjZ bin]# ./start-hbase.sh
root@localhost's password:
localhost: starting zookeeper, logging to /usr/local/hbase/hbase-1.1.4/bin/../logs/hbase-root-zookeeper-iZ281cu2lqjZ.out
starting master, logging to /usr/local/hbase/hbase-1.1.4/bin/../logs/hbase-root-master-iZ281cu2lqjZ.out
starting regionserver, logging to /usr/local/hbase/hbase-1.1.4/bin/../logs/hbase-root-1-regionserver-iZ281cu2lqjZ.out
[root@iZ281cu2lqjZ bin]# jps
1597 DataNode
3180 ResourceManager
3463 NodeManager
1462 NameNode
8680 HRegionServer
1543 SecondaryNameNode
8536 HQuorumPeer
8597 HMaster
8729 Jps
完成
看完了這篇文章,相信你對(duì)“hadoop 2偽分布式如何搭建”有了一定的了解,如果想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
當(dāng)前標(biāo)題:hadoop2偽分布式如何搭建
文章來(lái)源:http://aaarwkj.com/article30/jjhjpo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站、微信小程序、品牌網(wǎng)站建設(shè)、搜索引擎優(yōu)化、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)