天天看點

利用雲伺服器搭建hadoop叢集測試連接配接

利用雲伺服器搭建hadoop叢集

  • 測試連接配接
    • 一. Linux配置
    • 二. 3台伺服器免密碼登入
        • 1. 三台機器生成公鑰與私鑰:
        • 2. 拷貝公鑰到同一台機器
        • 3. 複制第一台機器的認證到其他機器
        • 4. 通過網絡時鐘同步;
    • 三.基礎環境安裝
        • 1. 安裝jdk
        • 2. [安裝zookeeper](https://blog.csdn.net/qq_42822962/article/details/94999259)
    • 55
    • 12312
      • 312
    • 132
    • 312
    • 312
    • 123
    • 312
    • 3123
    • 312312
    • 321入
      • 312321
      • 1231

測試連接配接

有一台騰訊雲的伺服器,最近有買了兩台百度雲的,打算搭建一個叢集,從零開始記錄一下.

測試連接配接:

利用雲伺服器搭建hadoop叢集測試連接配接
利用雲伺服器搭建hadoop叢集測試連接配接

百度雲之間互ping在1ms左右,可惜太窮了買不起,隻能把一台成都的和兩台保定的串起來,湊合着用吧.

一. Linux配置

  1. 關閉防火牆和selinux
    #關閉防火牆
    service iptables stop
    chkconfig iptables off
    
    #關閉selinux
    vim /etc/selinux/config
    #設定為disabled
    SELINUX=disabled    
               
#檢視防火牆狀态
   service iptables status 
   #關閉防火牆 
   service iptables stop
   #檢視防火牆開機啟動狀态 chkconfig iptables --list
   #關閉防火牆開機啟動
   chkconfig iptables off
           
  1. 百度雲配置設定的名字太麻煩了,為友善操作修改主機名,但是遇到了一些問題,詳細請點選 Linux修改hostname的幾種方式:
    #百度雲   修改後,重新開機(reboot -h)永久生效
    vi /etc/sysconfig/network
    #第2台  将hostname改為node01
    HOSTNAME=node01
    #第2台  将hostname改為node01
    HOSTNAME=node03
     
    #騰訊雲   可能我裝的不是原版的,出來的居然是這個鬼東西
    # Created by cloud-init on instance boot automatically, do not edit.
    #在下面添加一行
    NETWORKING=yes
    HOSTNAME=node02
    然後使用: vi /etc/hostname
    node02
    #reboot -h 重新開機後生效了
    
               

    2.域名映射并測試

    /etc/hosts 檔案用于在通過主機名進行通路時做 ip 位址解析之用。

    是以,你想通路一個什麼樣的主機名,就需要把這個主機名和它對應的 ip 位址. 配置在/etc/hosts 檔案中.

    #三台伺服器進行域名映射操作
    vim /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    #172.16.0.4 instance-mv524v7d instance-mv524v7d.novalocal
    
    #添加以下配置,前面為你伺服器的ip
    192.168.221.100 node01
    192.168.221.110 node02
    192.168.221.120 node03
    
    # 測試騰訊雲與百度雲 互ping:
    [email protected] etc# ping node01
    PING node01 (106.13.你的ip.你的ip) 56(84) bytes of data.
    64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=1 ttl=48 time=60.1 ms
    64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=2 ttl=48 time=59.6 ms
    64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=3 ttl=48 time=59.7 ms
    
    [[email protected] ~]# ping node02
    PING node02 (132.232.你的ip.你的ip) 56(84) bytes of data.
    64 bytes from node02 (132.232.你的ip.你的ip): icmp_seq=1 ttl=49 time=60.1 ms
    64 bytes from node02 (132.232.你的ip.你的ip): icmp_seq=2 ttl=49 time=59.6 ms
    64 bytes from node02 (132.232.你的ip.你的ip): icmp_seq=3 ttl=49 time=59.6 ms
    
    [[email protected] ~]# ping node01
    PING node01 (106.13.你的ip.你的ip) 56(84) bytes of data.
    64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=1 ttl=59 time=1.29 ms
    64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=2 ttl=59 time=0.526 ms
    64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=3 ttl=59 time=0.570 ms
               
    重新開機伺服器

二. 3台伺服器免密碼登入

1. 三台機器生成公鑰與私鑰:

[[email protected] ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):  #回車
Enter passphrase (empty for no passphrase):  #回車
Enter same passphrase again:  #回車
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
35:8f:46:e1:19:d1:91:20:44:01:cb:6c:58:bd:4f:85 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|      o==.==.o   |
|     = ..oE++    |
|    . =  .*.     |
|     .  .o.+     |
|        Soo .    |
|         ..      |
|                 |
|                 |
|                 |
+-----------------+
           

2. 拷貝公鑰到同一台機器

[[email protected] ~]# ssh-copy-id node01
The authenticity of host 'node01 (106.13.55.197)' can't be established.
RSA key fingerprint is 7c:70:21:11:f4:64:f4:2a:db:db:f9:42:65:63:9b:c6.
Are you sure you want to continue connecting (yes/no)? yes  #輸入yes
Warning: Permanently added 'node01,106.13.55.197' (RSA) to the list of known hosts.
[email protected]'s password:   #輸入第一台伺服器的密碼
Now try logging into the machine, with "ssh 'node01'", and check in:

 .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

           

3. 複制第一台機器的認證到其他機器

#根據提示,輸入yes,和伺服器的登陸密碼
scp /root/.ssh/authorized_keys node02:/root/.ssh/
scp /root/.ssh/authorized_keys node03:/root/.ssh/
           

4. 通過網絡時鐘同步;

#設定定時任務
[[email protected] ~]#  crontab -e
#添加阿裡雲時鐘同步定時任務
*/1 * * * * /usr/sbin/ntpdate ntp4.aliyun.com;
           

三.基礎環境安裝

這裡安裝cdh5.14.0版本

1. 安裝jdk

#檢視自帶的openjdk
[[email protected] ~]# rpm -qa | grep java
#如果有就解除安裝
[[email protected] ~]# rpm -e jdk的名稱

#建立兩個約定俗稱的檔案夾,來進行我們的軟體包的存放和軟體的安裝
所有軟體的安裝路徑
/usr/local
所有軟體壓縮包的存放路徑
mkdir -p /usr/local/software

#上傳jdk到software目錄,并解壓
[email protected] ~# tar -zxvf jdk-8u181-linux-x64.tar.gz -C /usr/local/java

#配置java環境變量,在文檔末尾追加
vim /etc/profile
#配置java環境變量
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export PATH=:$JAVA_HOME/bin:$PATH

#編譯
source /etc/profile

#測試
[[email protected] software]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

表示安裝成功
           

2. 安裝zookeeper

55

  • 項目
    • 項目
      • 項目

12312

一個簡單的表格是這麼建立的:

項目 Value
電腦 $1600
手機 $12
導管 $1

312

SmartyPants将ASCII标點字元轉換為“智能”印刷标點HTML實體。例如:

TYPE ASCII HTML
Single backticks

'Isn't this fun?'

‘Isn’t this fun?’
Quotes

"Isn't this fun?"

“Isn’t this fun?”
Dashes

-- is en-dash, --- is em-dash

– is en-dash, — is em-dash

132

Markdown
Text-to- HTML conversion tool
Authors
John
Luke

312

一個具有注腳的文本。1

312

Markdown将文本轉換為 HTML。

123

您可以使用渲染LaTeX數學表達式 KaTeX:

Gamma公式展示 Γ ( n ) = ( n − 1 ) ! ∀ n ∈ N \Gamma(n) = (n-1)!\quad\forall n\in\mathbb N Γ(n)=(n−1)!∀n∈N 是通過歐拉積分

Γ ( z ) = ∫ 0 ∞ t z − 1 e − t d t   . \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,. Γ(z)=∫0∞​tz−1e−tdt.

你可以找到更多關于的資訊 LaTeX 數學表達式[here][1].

312

  • 關于 甘特圖 文法,參考 [這兒][2],

3123

可以使用UML圖表進行渲染。 Mermaid. 例如下面産生的一個序列圖::

這将産生一個流程圖。:

  • 關于 Mermaid 文法,參考 [這兒][3],

312312

我們依舊會支援flowchart的流程圖:

321入

312321

如果你想嘗試使用此編輯器, 你可以在此篇文章任意編輯。當你完成了一篇文章的寫作, 在上方工具欄找到 文章導出 ,生成一個.md檔案或者.html檔案進行本地儲存。

1231

如果你想加載一篇你寫過的.md檔案或者.html檔案,在上方工具欄可以選擇導入功能進行對應擴充名的檔案導入,

繼續你的創作。

  1. 注腳的解釋 ↩︎

繼續閱讀