超詳細hadoop集羣服務器安裝配置教程

超詳細hadoop集羣服務器安裝配置教程mysql

虛擬機以及Linux系統安裝在以前的兩篇分享中已經詳細的介紹了方法,而且每一步的都配圖了。若是有朋友仍是看不懂,那我也心有餘而力不足了。本篇主要就hadoop服務器操做系統配置進行詳細說明,hadoop安裝會在下一篇文章中詳細的介紹。sql

hadoop安裝包用的是大快DKHadoop發行版,我的以爲DKHadoop的安裝過程是比較簡單,關於dkhadoop的安裝在下一次的分享中再詳細介紹吧。下面進入到本篇的主題——服務器操做系統配置教程數據庫

 1、安裝包準備centos

1、虛擬機分佈式安裝(三臺及以上虛擬機)tomcat

如果我的電腦Windows系統或Linux系統,虛擬機上虛擬的三臺服務器,則將安裝包拷貝到服務器上,進行安裝操做便可。服務器

2、物理集羣(三臺及以上實體服務器)網絡

  1. 外網下載模式
  2. 本地文件模式

將安裝包文件直接拷貝到實體服務器root目錄下,進行安裝操做便可。ssh

三、上傳模式分佈式

當服務器在機房,且無顯示和輸入設備的狀況下,應用該模式。oop

現將文件,安裝在本地計算機上(默認爲筆記本電腦,在機房現場),並將計算機與服務器鏈接,將安裝包install、DKHInstall上傳到服務器root目錄下。

 

2、服務器操做系統配置教程

準備工做完成以後,就要進行服務器配置操做,首先必須三臺服務器之間要互相ping通。所謂ping通,就是兩臺設備之間網絡是通的。從一端發送一個數據包,另外一端就可以收到,就表明兩臺設備是可以ping通了。

1、修改權限

目的:使install、DKHInstall兩個安裝包有可執行的權限。權限不足沒法執行一些操做。install裏面是腳本和全部組件,DKHInstall裏面是安裝界面。

步驟:在準備工做中拷貝安裝包 install、DKHInstall到主節點目錄後,修改文件權限。首先進入root目錄,安裝目錄 install、DKHInstall的權限改成:文件全部者可讀可寫可執行,與文件全部者屬於一個用戶組的其餘用戶可讀可執行,其餘用戶組可讀可執行。

命令:

cd /root/

unzip DKHPlantform.zip

chmod -R 755 DKHPlantform

 

2搭建Hadoop集羣設置SSH免密登陸

目的:Hadoop運行過程當中須要管理遠端Hadoop守護進程,在Hadoop啓動之後,NameNode是經過SSH(Secure Shell)來啓動和中止各個DataNode上的各類守護進程的。這就必須在節點之間執行指令的時候是不須要輸入密碼的形式,因此咱們須要配置SSH運用無密碼公鑰認證的形式,這樣NameNode使用SSH無密碼登陸並啓動DataName進程,一樣原理,DataNode上也能使用SSH無密碼登陸到NameNode。

步驟:

(1)修改本機hosts文件,寫入對應關係

爲了區分局域網內的每臺主機,都會給主機配一個主機名,每臺主機之間又是經過IP進行通訊,但IP地址不方便記憶,因此配置主機名和IP映射可以實現主機之間的快速方便的訪問。

命令:

vi /etc/hosts

經過按鍵盤上的insert或是I鍵進入編輯模式,編輯完成後按一下Esc鍵而後按一下按Shift+: 鍵,輸入wq,後回車就能夠保存。輸入q!後回車則是放棄保存並退出.

進入編輯模式後,按照規則寫入主機與ip的對應關係(主機名稱dk41是本身命名的,以下圖)例:

       192.168.1.41    dk41

192.168.1.42    dk42

192.168.1.43    dk43

編輯完後,保存退出。把對應關係拷到其餘兩臺或多臺機器上。

命令:

scp  -r  /etc/hosts  192.168.1.42:/etc

scp  -r  /etc/hosts  192.168.1.43:/etc

(2)執行集羣之間免密前的準備工做   

執行sshpass.sh的腳本的時候會去讀sshhosts和sshslaves這兩個文件,替換sshpass.sh中的master和slave文件。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

修改文件sshhosts,輸入所有機器的主機名,每行一個主機名(以下圖)

命令:

vi /root/DKHPlantform/autossh/sshhosts

經過按鍵盤上的insert或是I鍵進入編輯模式,編輯完成後按一下Esc鍵而後按一下按Shift+:鍵,輸入wq,後回車就能夠保存。輸入q!後回車則是放棄保存並退出.

修改文件sshslaves,寫入除主機名以外的全部機器名(以下圖)

命令:

vi /root/DKHPlantform/autossh/sshslaves

經過按鍵盤上的insert或是I鍵進入編輯模式,編輯完成後按一下Esc鍵而後按一下按Shift+:鍵,輸入wq,後回車就能夠保存。輸入q!後回車則是放棄保存並退出.

 

(3)執行集羣免密工做

命令:

cd /root/DKHPlantform/autossh

./autossh 主節點主機名 集羣密碼

例: ./autossh dk41 123456

(4)關閉防火牆

防止訪問服務器時某些服務被攔截,需關閉防火牆。

命令:

cd /root/DKHPlantform/autossh

./offIptables.sh

 

3、 安裝雙機熱備份的MySQL

目的:存放Hive的元數據

步驟:

(1)從主節點分發mySQL安裝目錄到第二節點

命令:

scp -r /root/DKHPlantform/mysqlInst/ 192.168.1.42:/root/

(2)主節點執行:

命令:                                                                                                                                

cd /root/DKHPlantform/mysqlInst/

./mysql.sh 1

從節點執行:

命令:

cd /root/mysqlInst/

./mysql.sh 2

 

(3)執行成功以後執行熱備份(兩臺機器上都要執行,兩個ip互換,41上寫42,42上寫41,密碼是MySQL的密碼爲:123456。平臺內已經設定好,請勿修改):

命令:

source /etc/profile

./sync.sh 192.168.1.xxx(另外一臺mysql地址)

4、 建立數據庫

目的:MySQL是一種關聯數據庫管理系統,關聯數據庫將數據保存在不一樣的表中,增長了速度並提升了靈活性。

步驟:

(1)導入MySQL數據表,只在主節點執行:

命令:

mysql -uroot -p123456 < { 此處爲sql文件,主目錄下文件: dkh.sql}

如:mysql -uroot -p123456 </root/DKHPlantform/dkh.sql

(2)執行完後查看一下兩臺mysql的數據表是否存在,從主節點中查看執行:

命令:

mySQL  -uroot  -p123456
show databases;

use dkh;

show tables;

 

5、啓動安裝

目的:服務器配置操做完成以後,啓動DKH。

步驟:執行如下命令。

命令:

cd /root/DKHPlantform/dkh-tomcat*/bin/

./startup.sh

6、本地時間服務器搭建步驟

沒聯網或者裝系統時時間未同步,須要搭建本地時間服務器。

(1)搭建內網的ntp服務器

修改/etc/ntp.conf

命令:

Vim /etc/ntp.conf

經過按鍵盤上的insert或是I鍵進入編輯模式,編輯完成後按一下Esc鍵而後按一下按Shift+:鍵,輸入wq後回車就能夠保存。輸入q!後回車則是放棄保存並退出.

修改下列三行:

#server 0.centos.pool.ntp.org  

#server 1.centos.pool.ntp.org  

#server 2.centos.pool.ntp.org  

 在文件最後添加下列兩行:

server  127.127.1.0   

fudge   127.127.1.0 stratum 10

(2)啓動ntp服務

service ntpd start

(3)開機自動啓動

chkconfig ntpd on

(4)客戶端同步時間

命令:

Vim /etc/ntp.conf

經過按鍵盤上的insert或是I鍵進入編輯模式,編輯完成後按一下Esc鍵而後按一下按Shift+:鍵,輸入wq,後回車就能夠保存。輸入q!後回車則是放棄保存並退出.

在文件最後添加一行:

*/15 * * * * root ntpdate 192.168.27.35;hwclock -w 

相關文章
相關標籤/搜索