用cloudera manager在阿里云搭建hadoop環(huán)境

準備四臺機器,并且做同樣的操作

假設(shè)名字為cmf、hdp1、hdp2、hdp3、

系統(tǒng)全部為centos 6.5 x64

CDH版本 5.x

修改所有機器的機器名及hosts

以cmf為例

(1) vi /etc/sysconfig/network

修改這一行HOSTNAME=cmf.local ?#注意不同主機修改相應(yīng)的名字

(2) vi /etc/hosts

127.0.0.1 localhost

::1 ? ? ? ?localhost localhost.localdomain localhost6 localhost6.localdomain6

10.45.236.66 ? ?cmf.local ? ? ?cmf

10.45.235.201 ?hdp1.local ? ? ?hdp1

10.45.232.251 ?hdp2.local ? ? ?hdp2

10.45.236.21 ?hdp3.local ? ? ?hdp3

# The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopbackfe00

::0 ip6-localnetff00

::0 ip6-mcastprefixff02

::1 ip6-allnodesff02

::2 ip6-allrouters

設(shè)置時間同步

chkconfig ntpd on

service ntpd restart

ntpdate -u ntp1.aliyun.com

設(shè)置dns

vi /etc/resolv.conf

options timeout:1 attempts:1 rotate

nameserver 223.5.5.5

nameserver 223.6.6.6

編輯fstab,掛數(shù)據(jù)盤

注:需要實現(xiàn)申請好四塊同樣大小的數(shù)據(jù)盤

在所有需要掛在數(shù)據(jù)盤的機器上運行

fdisk -l

fdisk /dev/vdb

分別選擇n,p,1

回車兩次

按w退出

mkfs.ext4 /dev/vdb1

echo /dev/vdb1 ? ? ? /mnt/data ? ?ext4 ? ?defaults >>/etc/fstab

mkdir /mnt/data

mount -a

rm -rf /mnt/data/*


df -h

設(shè)置iptables

如果主機上開啟了iptables,則需要把主機設(shè)置成互相信任,方法是:

vi /etc/sysconfig/iptables,添加如下行,對于沒有內(nèi)網(wǎng)的,每臺主機一行,對于有內(nèi)網(wǎng)的,可以直接添加網(wǎng)段。

# Accept packets from trusted IP addresses

-A INPUT -s xxx.xxx.xxx.xxx -j ACCEPT

然后重啟服務(wù):service iptables restart

完成后重啟計算機

注意檢查:

1. df -h 看數(shù)據(jù)盤自動mount上了

2. 注意一定要保證/mnt/data是空的

3. 用hostname看機器名稱是否改過來了。

關(guān)閉hugepage

echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag

echo 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag' >>/etc/rc.local

在cmf主機上下載安裝包

1. 下載

wget http://archive.cloudera.com/cm5/installer/latest/cloudera-manager-installer.bin

2.運行

chmod 755 cloudera-manager-installer.bin

./cloudera-manager-installer.bin

3.安裝完成后,到瀏覽器訪問界面,一般為http://ip:7180

用admin/admin登錄,就到了安裝向?qū)Ы缑?/p>

調(diào)整日志目錄

安裝結(jié)束后,由于日志缺省是存在/var/log目錄中,而阿里云的主機的系統(tǒng)盤都較小,所以會報出警告來。要解除報警,就要把日志目錄都配置到/mnt/data下面去。

方法是:


圖1

點擊配置報警如圖1。


圖2

找到log directory free space的報警,點擊進去,如圖2。


圖3

在搜索框中輸入"Log Directory",找到所有相關(guān)的配置,并且把/var目錄變目錄到/mnt/data下,然后點保存。如圖3.

調(diào)整parcel目錄

agent的包目錄還會報空間不夠,解決方法是:

見上圖,找到parcel目錄配置,然后修改成/mnt/data下的目錄。

然后ssh登錄到所有agent機器上,執(zhí)行如下命令,將parcel目錄遷移到/mnt/data下:

mkdir /mnt/data/cloudera/ /mnt/data/cloudera/parcels

cp -r /opt/cloudera/parcels/* /mnt/data/cloudera/parcels/

錯誤處理

1. 注意一定要選擇安裝jdk

并正確設(shè)置java

rm -f /usr/java/latest

ln -sf /usr/java/jdk1.7.0_67-cloudera /usr/java/latest

export JAVA_HOME=/usr/java/latest

export PATH=$PATH:$JAVA_HOME/bin

echo export JAVA_HOME=/usr/java/latest >>/etc/profile.d/java.sh

echo export PATH=$PATH:$JAVA_HOME/bin >>/etc/profile.d/java.sh


2. 如果在安裝服務(wù)時,hdfs部署失敗試試下面的命令

在所有主機執(zhí)行:

chown -R hdfs:hdfs /mnt/data/dfs

3. 如果hdfs的nfs服務(wù)啟動出錯

報錯連接111端口失敗,可能是rpcbind服務(wù)沒有啟動,則在相應(yīng)的nfs主機上:

service rpcbind start

4. 遇到錯誤重裝的操作

在cmf服務(wù)器上刪除manageserver:

service cloudera-scm-server stop

service cloudera-scm-server-db stop

yum remove cloudera-manager-*

yum remove cloudera-manager-server-db

yum clean all

/usr/share/cmf/uninstall-cloudera-manager.sh

service cloudera-scm-agent hard_stop_confirmed

rm -Rf /usr/share/cmf /var/lib/cloudera* /var/cache/yum/cloudera* /etc/cloudera-scm-* /var/lib/cloudera-scm-server-db

yum remove 'cloudera-manager-*' hadoop hue-common 'bigtop-*'

yum clean all

rm -Rf /usr/share/cmf /var/lib/cloudera* /var/cache/yum/cloudera* /mnt/data/*

在所有的安裝agent的機器上:

service cloudera-scm-agent hard_stop_confirmed

yum remove 'cloudera-manager-*' hadoop hue-common 'bigtop-*'

yum clean all

rm -Rf /usr/share/cmf /var/lib/cloudera* /var/cache/yum/cloudera* /mnt/data/*


5. 萬一不小心關(guān)閉了頁面

安裝向?qū)鹗柬撁娴刂罚篽ttp://cmf.jinchongzi.com:7180/cmf/express-wizard/welcome

6. 報時鐘不同步

檢查ntpdc -c loopinfo的運行結(jié)果,如果是:

Name or service not known

很可能是/etc/hosts文件有錯,缺少127.0.0.1 localhost這一行。仔細檢查hosts文件,修改正確即可解決。

7. 重裝后,hbase啟動失敗,報master服務(wù)啟動錯誤

首先檢查java設(shè)置是否正確,參見常見錯誤1

(1)

service hbase-regionserver stop

service hbase-master stop

(2)

hbase org.apache.hadoop.hbase.util.hbck.OfflineMetaRepair

(3) 刪除zookeeper中的數(shù)據(jù)

cd /opt/cloudera/parcels/lib/zookeeper/bin/

./zkCli.sh

打開zookeeper的shell

執(zhí)行:

ls /

rmr /hbase

(4)啟動hbase

service hbase-master restart

service hbase-regionserver restart

7. 安裝高版本的cloudera manager時報找不到rpm包

錯誤內(nèi)容:

Error Downloading Packages:

cloudera-manager-daemons-5.4.0-1.cm540.p0.165.el6.x86_64: failure: RPMS/x86_64/cloudera-manager-daemons-5.4.0-1.cm540.p0.165.el6.x86_64.rpm from cloudera-manager: [Errno 256]

No more mirrors to try.

解決方案:

rm -r /etc/yum.repos.d/cloudera-manager.repo.*

vi /etc/yum.repos.d/cloudera-manager.repo

貼入如下內(nèi)容:

[cloudera-manager]

name = Cloudera Manager, Version 5.5.1

baseurl =http://archive.cloudera.com/cm5/redhat/6/x86_64/cm?/5.5.1/

gpgkey =http://archive.cloudera.com/redhat/cdh/RPM-GPG-KEY?-cloudera

gpgcheck = 1

重新運行安裝程序即可。

8. 安裝parcel時有時會很慢,下載不下來,甚至失敗

新開一個窗口,到http://xxxx:7180/cmf/parcel/status下面,取消某個包的下載操作(點右邊的cancel),然后再重新點download即可。

9. Acquiring Installation lock

rm /tmp/.scm_prepare_node.lock

10. hdfs增加機器rebalance使文件分布均勻

Running the Balancer

Go to the HDFS service.

Select Actions > Rebalance.

Click Rebalance that appears in the next screen to confirm. If you see a Finished status, the Balancer ran successfully.

Configuring the Balancer Threshold

The Balancer has a default threshold of 10%, which ensures that disk usage on each DataNode differs from the overall usage in the cluster by no more than 10%. For example, if overall usage across all the DataNodes in the cluster is 40% of the cluster's total disk-storage capacity, the script ensures that DataNode disk usage is between 30% and 50% of the DataNode disk-storage capacity. To change the threshold:

Go to the HDFS service.

Click the Configuration tab.

Expand the Balancer Default Group category.

Set the Rebalancing Threshold property.

Click Save Changes to commit the changes.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容