CentOS7下CDH5.11.1集羣離線部署

本文章僅作爲個人筆記

  • CDH官網地址:https://www.cloudera.com/
  • CDH鏡像地址:
  • 筆者使用VMware進行模擬安裝,爲了滿足基礎配置,這裏分配3臺虛擬機(hadoopb01(4g/4核/40g/192.168.75.136/master),hadoopb02(2g/2核/40g/192.168.75.144/slave),hadoopb03(2g/2核/40g/192.168.75.145/slave)),另外wget下載文件非常緩慢並且不方便反覆測試及安裝,筆者這裏下載好所有資源文件放在本地(.sha1文件結尾的文件統一重命名爲.sha)。(如果虛擬機開機後無網絡(使用net橋接方式),可與命令行運行dhclient分配ip,若後續斷開了可運行dhclient -r後再運行dhclient)
  • 本地虛擬機,本地文件
  • 在3臺服務器共同操作:
    • 安裝基本工具: yum install vim wget net-tools unzip -y
    • 關閉SELINUX:
    • 運行 setenforce 0 臨時關閉
    • 永久關閉SELINUX:
      echo 「SELINUX=disabled」 > /etc/selinux/config
      echo 「SELINUXTYPE=targeted」 >> /etc/selinux/config
    • 關閉iptables防火牆:
      • 運行 systemctl stop firewalld.service 停止防火牆
      • 運行 systemctl status firewalld.service 查看防火牆狀態
      • 運行 systemctl disable firewalld.service 關閉防火牆開機啓動
    • 更改主機名:
      • 運行 hostname hadoopb01 更改主機名,根據不同主機選擇不同主機名(hadoopb01/hadoopb02/hadoopb03)
      • 運行 echo 「HOSTNAME=hadoopb01」 > /etc/sysconfig/network ,根據不同主機選擇不同主機名(hadoopb01/hadoopb02/hadoopb03)
      • 運行 echo 「hadoopb01」 > /etc/hostname ,根據不同主機選擇不同主機名(hadoopb01/hadoopb02/hadoopb03)
    • 安裝jdk(參考http://www.jianshu.com/p/c5fc4dd47754
    • **生成:
      • 運行 ssh-****** 一路回車回車生成
    • ip與hostname綁定:
      echo 「192.168.75.136 hadoopb01」 >> /etc/hosts
      echo 「192.168.75.144 hadoopb02」 >> /etc/hosts
      echo 「192.168.75.145 hadoopb03」 >> /etc/hosts
    • 運行python –version 檢查python版本,如果不是python2.6.6建議改爲python2.6.6
    • 時間同步:
      • 運行 yum install ntp -y 安裝ntp服務
      • 運行 systemctl enable ntpd 使ntp服務開機啓動
    • 在從服務器操作(hadoopb02(2g/2核/40g/192.168.75.144/slave),hadoopb03(2g/2核/40g/192.168.75.145/slave):
    • 配置時鐘同步:
      echo 「driftfile /var/lib/ntp/ntp.drift」 > /etc/ntp.conf
      echo 「statistics loopstats peerstats clockstats」 >> /etc/ntp.conf
      echo 「filegen loopstats file loopstats type day enable」 >> /etc/ntp.conf
      echo 「filegen peerstats file peerstats type day enable」 >> /etc/ntp.conf
      echo 「filegen clockstats file clockstats type day enable」 >> /etc/ntp.conf
      echo 「server 192.168.75.136 prefer」 >> /etc/ntp.conf
      echo 「fudge 192.168.75.136 stratum 5」 >> /etc/ntp.conf
      echo 「restrict -4 default kod notrap nomodify nopeer noquery」 >> /etc/ntp.conf
      echo 「restrict -6 default kod notrap nomodify nopeer noquery」 >> /etc/ntp.conf
      echo 「restrict 127.0.0.1」 >> /etc/ntp.conf
      echo 「restrict ::1」 >> /etc/ntp.conf
    • 運行 service ntpd restart 重啓ntpd並使配置生效
    • 運行 ntpdate –u 192.168.75.136 同步時間
  • 在主服務器操作(hadoopb01(4g/4核/40g/192.168.75.136/master):
    • 運行
      ssh-copy-id hadoopb01
      ssh-copy-id hadoopb02
      ssh-copy-id hadoopb03 完成各服務器免密登錄
    • 配置時鐘同步:
      echo 「driftfile /var/lib/ntp/ntp.drift」 > /etc/ntp.conf
      echo 「restrict 192.168.75.0 mask 255.255.255.0 nomodify notrap」 >> /etc/ntp.conf
      echo 「server 210.72.145.44」 >> /etc/ntp.conf
      echo 「server 202.112.10.36 perfer」 >> /etc/ntp.conf
      echo 「server 59.124.196.83」 >> /etc/ntp.conf
      echo 「restrict 210.72.145.44 nomodify notrap noquery」 >> /etc/ntp.conf
      echo 「restrict 202.112.10.36 nomodify notrap noquery」 >> /etc/ntp.conf
      echo 「restrict 59.124.196.83 nomodify notrap noquery」 >> /etc/ntp.conf
      echo 「server 127.127.1.0」 >> /etc/ntp.conf
      echo 「fudge 127.127.1.0 stratum 10」 >> /etc/ntp.conf
    • 運行 service ntpd restart 重啓ntpd並使配置生效
    • 運行 ntpdate –u 202.112.10.36 同步時間
    • 使用filezilla將上文所述文件傳輸至主服務器(放置於root用戶~目錄)
    • 安裝配置mysql5.6(可參考http://www.jianshu.com/p/c5fc4dd47754
    • 創建相關用戶及數據庫:
      create database cmf default character set utf8
      grant all on cmf.* to ‘cmf’@’localhost’ identified by ‘cmf_password’
      grant all on cmf.* to ‘cmf’@’%’ identified by ‘cmf_password’
      grant all on cmf.* to ‘cmf’@’ m h o s t s [ $ c i n d e x ] i d e n t i f i e d b y c m f p a s s w o r d d r o p d a t a b a s e c m f c r e a t e d a t a b a s e c m f c r e a t e d a t a b a s e h i v e d e f a u l t c h a r a c t e r s e t u t f 8 g r a n t a l l o n h i v e . t o h i v e @ l o c a l h o s t i d e n t i f i e d b y h i v e p a s s w o r d g r a n t a l l o n h i v e . t o h i v e @ g r a n t a l l o n h i v e . t o h i v e @ {m_hosts[ {c_index}]}’ identified by ‘hive_password’      drop database hive      create database hive      create database hue default character set utf8      grant all on hue.* to ‘hue’@’localhost’ identified by ‘hue_password’      grant all on hue.* to ‘hue’@’%’ identified by ‘hue_password’      grant all on hue.* to ‘hue’@’ {m_hosts[ {c_index}]}’ identified by ‘hue_password’      drop database hue      create database hue      create database am default character set utf8      grant all on am.* to ‘am’@’localhost’ identified by ‘am_password’      grant all on am.* to ‘am’@’%’ identified by ‘am_password’      grant all on am.* to ‘am’@’ {m_hosts[ {c_index}]}’ identified by ‘am_password’      drop database am      create database am      create database os default character set utf8      grant all on os.* to ‘os’@’localhost’ identified by ‘os_password’      grant all on os.* to ‘os’@’%’ identified by ‘os_password’      grant all on os.* to ‘os’@’ {m_hosts[${c_index}]}’ identified by ‘os_password’
      drop database os
      create database os
      flush privileges
    • 安裝並啓動httpd服務:
    • 運行 yum install -y httpd 安裝httpd服務
    • 運行 systemctl enable httpd 設置httpd服務開機啓動
    • 運行 service httpd start 啓動httpd服務
    • 創建parcels服務(依次運行如下命令):
      cd /var/www/html
      mkdir parcels
      cd parcels
      mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel ./
      mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel.sha ./
      mv ~/manifest.json ./
    • 創建cm5服務(依次運行如下命令):
      mkdir /opt/rpminstall
      cd /opt/rpminstall
      mv ~/cm5.11.1-centos7.tar.gz ./
      mv ~/cm5.11.1-centos7.tar.gz.sha ./
      tar -zxf cm5.11.1-centos7.tar.gz -C /var/www/html/
      cd /var/www/html/
      mkdir -p cm5/redhat/7/x86_64/
      mv cm cm5/redhat/7/x86_64/
      chown apache:apache -R /var/www/html
      cd /var/www/html/cm5/redhat/7/x86_64/cm/5/RPMS/x86_64
      yum install -y cloudera-manager-daemons-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
      yum install -y cloudera-manager-server-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
      mkdir /usr/share/java
      cd /usr/share/java
      mv ~/mysql-connector-java-5.1.42.zip ./
      unzip mysql-connector-java-5.1.42.zip
      cd mysql-connector-java-5.1.42
      cp mysql-connector-java-5.1.42-bin.jar ../mysql-connector-java.jar
      echo 「com.cloudera.cmf.db.type=mysql」 > /etc/cloudera-scm-server/db.properties
      echo 「com.cloudera.cmf.db.host=localhost」 >> /etc/cloudera-scm-server/db.properties
      echo 「com.cloudera.cmf.db.name=cmf」 >> /etc/cloudera-scm-server/db.properties
      echo 「com.cloudera.cmf.db.user=cmf」 >> /etc/cloudera-scm-server/db.properties
      echo 「com.cloudera.cmf.db.password=cmf_password」 >> /etc/cloudera-scm-server/db.properties
    • 運行 service cloudera-scm-server start 啓動 cloudera-scm 服務
    • 運行 tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log 查看運行日誌,待日誌停止且顯示Started Jetty server.表示服務運行完成。
    • 與瀏覽器輸入 http://192.168.75.136:7180開始正式的集羣部署
    • 默認用戶名密碼都爲admin
    • 同意並繼續
    • 選擇適合自己的版本並繼續
    • 點擊繼續
    • 填入3臺服務器的ip並點擊搜索
    • 確認可行後點擊繼續
    • 與瀏覽器訪問 http://192.168.75.136/parcels/確認parcels服務,若出現如圖則表示ok
    • 與瀏覽器訪問 http://192.168.75.136/cm5/redhat/7/x86_64/cm/5/ 確認cm5服務,若出現如圖則表示ok
    • 點擊更多選項配置parcel服務
    • 填入之前部署的本地parcel服務並刪除多餘的url點擊保存更改
    • 點擊自定義存儲庫配置cm5服務
    • 配置cm5服務並點擊繼續
    • 直接點擊繼續
    • 直接點擊繼續
    • 選擇合適的登陸配置(密碼或私鑰),點擊繼續
    • 等待安裝完成點擊繼續
    • 等待安裝完parcel點擊繼續
    • 檢測完成後點擊完成(這裏忽略這兩個警告,可自行修復)
    • 這裏選擇所有服務以測試是否可以完成所有服務的安裝
    • 這裏直接點繼續,如果需要自定義可自行定義。
    • 填寫創建好的數據庫信息測試鏈接ok後點擊繼續
    • 這裏直接點擊繼續(用戶可自行配置)
    • 等都通過後點擊繼續,如果hive的安裝出現問題可參考文件末尾教程再操作。
    • 點擊完成,完成安裝
    • 至此完成安裝
  • 文章的最後附上個人的腳本(吐槽下簡書的書寫爲了格式會導致粘貼部分文案行不對號,如果要使用這個腳本需要更改( 主機ip,主機名)):
  • 最後爲了使腳本能夠運行,需要運行 chmod +x filepath 爲文件添加權限,運行時執行 bash filepath n 例如(bash cdh.sh 0),運行此腳本可能mysql初始化不完全,如果可以,最好還是弄懂所有的步驟。
    ====================================================================================================master
    #!/bin/bash
    c_index=$1
    m_names=(「master」 「slave01」 「slave02」)
    m_hosts=(「192.168.1.131」 「192.168.1.129」 「192.168.1.226」)
    function auto_ssh_******(){
    expect -c 「set timeout -1;
    spawn ssh-******;
    expect {
    id_rsa {
    send \n\r;
    exp_continue;
    };
    Overwrite {
    send y\n\r;
    exp_continue;
    };
    passphrase {
    send \n\r;
    exp_continue;
    };
    again {
    send \n\r;
    exp_continue;
    };
    };

    }
    function auto_ssh_copy(){
    expect -c 「set timeout -1;
    spawn ssh-copy-id $1;
    expect {
    yes/no {
    send yes\n\r;
    exp_continue;
    };
    password {
    send 2\n\r;        exp_continue;        };        };        」        }        #初始化必要工具        yum install expect -y        yum install unzip -y        #關閉selinux        setenforce 0        echo 「SELINUX=disabled」 > /etc/selinux/config        echo 「SELINUXTYPE=targeted」 >> /etc/selinux/config        #關閉防火牆        systemctl stop firewalld.service        systemctl status firewalld.service        systemctl disable firewalld.service        #定義主機名        hostname {m_names[ {c_index}]}        echo 「HOSTNAME= {m_names[ {c_index}]}」 > /etc/sysconfig/network        #ip與hostname綁定        echo 「 {m_names[ {c_index}]}」 > /etc/hostname        t_index=0        for m_name in {m_names[@]};
    do
    echo 「 m h o s t s [ t i n d e x ] m_name」 >> /etc/hosts
    let t_index++
    done
    #時間同步
    yum install ntp -y
    systemctl enable ntpd
    if [ {c_index} == 0 ]        then        echo 「driftfile /var/lib/ntp/ntp.drift」 > /etc/ntp.conf        echo 「restrict 192.168.75.0 mask 255.255.255.0 nomodify notrap」 >> /etc/ntp.conf        echo 「server 210.72.145.44」 >> /etc/ntp.conf        echo 「server 202.112.10.36 perfer」 >> /etc/ntp.conf        echo 「server 59.124.196.83」 >> /etc/ntp.conf        echo 「restrict 210.72.145.44 nomodify notrap noquery」 >> /etc/ntp.conf        echo 「restrict 202.112.10.36 nomodify notrap noquery」 >> /etc/ntp.conf        echo 「restrict 59.124.196.83 nomodify notrap noquery」 >> /etc/ntp.conf        echo 「server  127.127.1.0」 >> /etc/ntp.conf        echo 「fudge  127.127.1.0 stratum 10」 >> /etc/ntp.conf        service ntpd restart        ntpdate –u 202.112.10.36        #免密登陸        for m_name in {m_names[@]};
    do
    auto_ssh_copy m n a m e r o o t d o n e e l s e e c h o d r i f t f i l e / v a r / l i b / n t p / n t p . d r i f t > / e t c / n t p . c o n f e c h o s t a t i s t i c s l o o p s t a t s p e e r s t a t s c l o c k s t a t s >> / e t c / n t p . c o n f e c h o f i l e g e n l o o p s t a t s f i l e l o o p s t a t s t y p e d a y e n a b l e >> / e t c / n t p . c o n f e c h o f i l e g e n p e e r s t a t s f i l e p e e r s t a t s t y p e d a y e n a b l e >> / e t c / n t p . c o n f e c h o f i l e g e n c l o c k s t a t s f i l e c l o c k s t a t s t y p e d a y e n a b l e >> / e t c / n t p . c o n f e c h o s e r v e r {m_hosts[0]} prefer」 >> /etc/ntp.conf
    echo 「fudge m h o s t s [ 0 ] s t r a t u m 5 >> / e t c / n t p . c o n f e c h o r e s t r i c t 4 d e f a u l t k o d n o t r a p n o m o d i f y n o p e e r n o q u e r y >> / e t c / n t p . c o n f e c h o r e s t r i c t 6 d e f a u l t k o d n o t r a p n o m o d i f y n o p e e r n o q u e r y >> / e t c / n t p . c o n f e c h o r e s t r i c t 127.0.0.1 >> / e t c / n t p . c o n f e c h o r e s t r i c t :: 1 >> / e t c / n t p . c o n f s e r v i c e n t p d r e s t a r t n t p d a t e u {m_hosts[0]}
    fi
    #生成私鑰
    rm -rf /root/.ssh/id_rsa
    rm -rf /root/.ssh/id_rsa.pub
    auto_ssh_******
    #安裝jdk
    rpm -Uvh jdk-8u121-linux-x64.rpm
    echo 「JAVA_HOME=/usr/java/jdk1.8.0_121」 > /etc/profile.d/java.sh
    echo 「PATH=$PATH:$JAVA_HOME/bin」 >> /etc/profile.d/java.sh
    echo 「CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar」 >> /etc/profile.d/java.sh
    echo 「export JAVA_HOME PATH CLASSPATH」 >> /etc/profile.d/java.sh
    source /etc/profile
    if [ {c_index} == 0 ]        then        #安裝並初始化配置mysql        tar -zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz        mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql        touch /etc/my.cnf        echo 「[mysql]」 > /etc/my.cnf        echo 「default-character-set=utf8」 >> /etc/my.cnf        echo 「socket=/var/lib/mysql/mysql.sock」 >> /etc/my.cnf        echo 「[mysqld]」 >> /etc/my.cnf        echo 「skip-name-resolve」 >> /etc/my.cnf        echo 「port=3306」 >> /etc/my.cnf        echo 「socket=/var/lib/mysql/mysql.sock」 >> /etc/my.cnf        echo 「basedir=/usr/local/mysql」 >> /etc/my.cnf        echo 「datadir=/usr/local/mysql/data」 >> /etc/my.cnf        echo 「max_connections=200」 >> /etc/my.cnf        echo 「character-set-server=utf8」 >> /etc/my.cnf        echo 「default-storage-engine=INNODB」 >> /etc/my.cnf        echo 「lower_case_table_names=1」 >> /etc/my.cnf        echo 「max_allowed_packet=16M」 >> /etc/my.cnf        mkdir -p /var/lib/mysql/mysql        groupadd mysql        useradd -g mysql mysql        chown -R mysql:mysql /usr/local/mysql        chown -R mysql:mysql /var/lib/mysql        yum install -y perl-Module-Install.noarch        /usr/local/mysql/scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql        chown -R mysql:mysql /usr/local/mysql        chown 777 /etc/my.cnf        cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld        chmod +x /etc/rc.d/init.d/mysqld        chkconfig –add mysqld        echo 「export PATH=\$PATH:/usr/local/mysql/bin」 > /etc/profile.d/mysql.sh        source /etc/profile        service mysqld restart        /usr/local/mysql/bin/mysql -e 「delete from mysql.user where user = 」」        /usr/local/mysql/bin/mysql -e 「update mysql.user set password = (select password(‘root’)) where user = ‘root’」        /usr/local/mysql/bin/mysql -e 「create database cmf default character set utf8」        /usr/local/mysql/bin/mysql -e 「grant all on cmf.* to ‘cmf’@’localhost’ identified by ‘cmf_password’」        /usr/local/mysql/bin/mysql -e 「grant all on cmf.* to ‘cmf’@’%’ identified by ‘cmf_password’」        /usr/local/mysql/bin/mysql -e 「grant all on cmf.* to ‘cmf’@’ {m_hosts[ {c_index}]}’ identified by ‘cmf_password’」        /usr/local/mysql/bin/mysql -e 「drop database cmf」        /usr/local/mysql/bin/mysql -e 「create database cmf」        /usr/local/mysql/bin/mysql -e 「create database hive default character set utf8」        /usr/local/mysql/bin/mysql -e 「grant all on hive.* to ‘hive’@’localhost’ identified by ‘hive_password’」        /usr/local/mysql/bin/mysql -e 「grant all on hive.* to ‘hive’@’%’ identified by ‘hive_password’」        /usr/local/mysql/bin/mysql -e 「grant all on hive.* to ‘hive’@’ {m_hosts[ {c_index}]}’ identified by ‘hive_password’」        /usr/local/mysql/bin/mysql -e 「drop database hive」        /usr/local/mysql/bin/mysql -e 「create database hive」        /usr/local/mysql/bin/mysql -e 「create database hue default character set utf8」        /usr/local/mysql/bin/mysql -e 「grant all on hue.* to ‘hue’@’localhost’ identified by ‘hue_password’」        /usr/local/mysql/bin/mysql -e 「grant all on hue.* to ‘hue’@’%’ identified by ‘hue_password’」        /usr/local/mysql/bin/mysql -e 「grant all on hue.* to ‘hue’@’ {m_hosts[ {c_index}]}’ identified by ‘hue_password’」        /usr/local/mysql/bin/mysql -e 「drop database hue」        /usr/local/mysql/bin/mysql -e 「create database hue」        /usr/local/mysql/bin/mysql -e 「create database am default character set utf8」        /usr/local/mysql/bin/mysql -e 「grant all on am.* to ‘am’@’localhost’ identified by ‘am_password’」        /usr/local/mysql/bin/mysql -e 「grant all on am.* to ‘am’@’%’ identified by ‘am_password’」        /usr/local/mysql/bin/mysql -e 「grant all on am.* to ‘am’@’ {m_hosts[ {c_index}]}’ identified by ‘am_password’」        /usr/local/mysql/bin/mysql -e 「drop database am」        /usr/local/mysql/bin/mysql -e 「create database am」        /usr/local/mysql/bin/mysql -e 「create database os default character set utf8」        /usr/local/mysql/bin/mysql -e 「grant all on os.* to ‘os’@’localhost’ identified by ‘os_password’」        /usr/local/mysql/bin/mysql -e 「grant all on os.* to ‘os’@’%’ identified by ‘os_password’」        /usr/local/mysql/bin/mysql -e 「grant all on os.* to ‘os’@’ {m_hosts[${c_index}]}’ identified by ‘os_password’」
    /usr/local/mysql/bin/mysql -e 「drop database os」
    /usr/local/mysql/bin/mysql -e 「create database os」
    /usr/local/mysql/bin/mysql -e 「flush privileges」
    #安裝httpd服務
    yum install -y httpd
    systemctl enable httpd
    service httpd restart
    cd /var/www/html
    mkdir parcels
    cd parcels
    mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel ./
    mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel.sha ./
    mv ~/manifest.json ./
    mkdir /opt/rpminstall
    cd /opt/rpminstall
    mv ~/cm5.11.1-centos7.tar.gz ./
    mv ~/cm5.11.1-centos7.tar.gz.sha ./
    tar -zxf cm5.11.1-centos7.tar.gz -C /var/www/html/
    cd /var/www/html/
    mkdir -p cm5/redhat/7/x86_64/
    mv cm cm5/redhat/7/x86_64/
    chown apache:apache -R /var/www/html
    cd /var/www/html/cm5/redhat/7/x86_64/cm/5/RPMS/x86_64
    yum install -y cloudera-manager-daemons-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
    yum install -y cloudera-manager-server-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
    mkdir /usr/share/java
    cd /usr/share/java
    mv ~/mysql-connector-java-5.1.42.zip ./
    unzip mysql-connector-java-5.1.42.zip
    cd mysql-connector-java-5.1.42
    cp mysql-connector-java-5.1.42-bin.jar ../mysql-connector-java.jar
    echo 「com.cloudera.cmf.db.type=mysql」 > /etc/cloudera-scm-server/db.properties
    echo 「com.cloudera.cmf.db.host=localhost」 >> /etc/cloudera-scm-server/db.properties
    echo 「com.cloudera.cmf.db.name=cmf」 >> /etc/cloudera-scm-server/db.properties
    echo 「com.cloudera.cmf.db.user=cmf」 >> /etc/cloudera-scm-server/db.properties
    echo 「com.cloudera.cmf.db.password=cmf_password」 >> /etc/cloudera-scm-server/db.properties
    service cloudera-scm-server restart
    source /etc/profile
    fi
    ======================================================================================================end
  • 坑錦集:

    • 腳本運行完成後可能需要再次於master運行source /etc/profile 使環境變量生效。
    • 如果遇到hive安裝失敗的問題可能需要再開個瀏覽器窗口訪問cdh搭建主網站更改hive配置,且需要使用獨立的mysql數據庫及用戶。
    • 更改hive配置

    • ntp時間同步服務如果報警,可於crontab -e添加定時同步時間。

    • 當3臺機器服務時,可將master也添加namenode節點。