Hostname | IP | CPU(cores) | Memory(GB) | OS | Service | Remark |
---|---|---|---|---|---|---|
master | 172.30.200.75 | 2 | 4 | centos 7.5 | jdk, cloudera-scm-server, mysql | 實際部署後,master節點也須要部署cloudera-scm-agent 服務,或採用4個slave節點 |
slave01 | 172.30.200.76 | 2 | 4 | centos 7.5 | jdk, cloudera-scm-agent | |
slave02 | 172.30.200.77 | 2 | 4 | centos 7.5 | jdk, cloudera-scm-agent | |
slave03 | 172.30.200.78 | 2 | 4 | centos 7.5 | jdk, cloudera-scm-agent |
相關軟件放置在/usr/local/src/
目錄。html
Soft | Version | Download | Remark |
---|---|---|---|
CM(Cloudera Manager) | cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz |
bin包,根據版本下載 | |
CDH parcel | CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel |
根據版本下載 | 軟件安裝包 |
CDH parcel.sha | CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1 |
根據版本下載 | 軟件包hash碼 |
CDH manifest.json | manifest.json |
根據版本下載 | 版本說明文件 |
JDK | jdk-8u181-linux-x64.tar.gz |
bin包,根據版本下載 | |
MySQL | mysql-5.7.24-el7-x86_64.tar.gz |
bin包,根據版本下載 | 存放Cloudera Manager配置文件 |
MySQL-connector-Java | mysql-connector-java-8.0.13.jar |
jar包,根據版本下載 | JDBC |
全部節點執行如下操做:java
firewalld
或iptables
);selinux
;ntp
。全部節點設置/etc/hostsnode
cat << EOF >> /etc/hosts # hadoop nodes 172.30.200.75 master 172.30.200.76 slave01 172.30.200.77 slave02 172.30.200.78 slave03 EOF
在全部節點生成祕鑰mysql
ssh-keygen -t rsa
在master節點生成authorized_keys
文件linux
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
在master節點執行,將集羣每一個節點的公鑰id_rsa.pub
放入master節點的authorized_keys
文件中sql
for i in {1..3}; do ssh root@slave0$i cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys; done
authorized_keys
文件放置到集羣每一個節點的/root/.ssh/
目錄,依然命名位authorized_keys
公鑰檢查
,可經過在/etc/ssh/ssh_config
文件中設置StrictHostKeyChecking no
繞過,或使用-o
參數跳過。for i in {1..3}; do scp /root/.ssh/authorized_keys root@slave0$i:/root/.ssh/authorized_keys; done
全部節點都須要安裝JDK。shell
安裝JDK數據庫
cd /usr/local/src tar -zxvf jdk-8u181-linux-x64.tar.gz mkdir -p /usr/java mv jdk1.8.0_181/ /usr/java/ # 設置軟連接,方便升級替換 ln -s /usr/java/jdk1.8.0_181/ /usr/java/current
設置變量json
cat << EOF >> /etc/profile # JDK export JAVA_HOME=/usr/java/current export JRE_HOME=/usr/java/current/jre export PATH=$PATH:/usr/java/current/bin export CLASSPATH=./:/usr/java/current/lib:/usr/java/current/jre/lib EOF
驗證vim
# 加載變量 source /etc/profile # 驗證 java -version
只有master節點須要安裝MySQL。
卸載系統自帶的相關數據庫
rpm -qa | grep mysql rpm -qa | grep mariadb # --nodeps:不檢查依賴 rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
部署MySQL
# 採用bin包部署,解壓後直接使用 cd /usr/local/src tar -zxvf mysql-5.7.24-el7-x86_64.tar.gz -C /usr/local/ mv /usr/local/mysql-5.7.24-el7-x86_64/ /usr/local/mysql
帳號與權限
# 添加帳號 groupadd mysql useradd -g mysql -s /sbin/nologin mysql # 建立"data"目錄 mkdir /data # 賦權 chown -R mysql:mysql /usr/local/mysql/ chown -R mysql:mysql /data/
root@localhost
帳號的初始密碼Hqe6x<Re4jhK
cd /usr/local/mysql/ bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data
設置變量
cat << EOF >> /etc/profile # MySQL export PATH=$PATH:/usr/local/mysql/bin EOF # 加載變量 source /etc/profile # 軟連接 ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql ln -s /usr/local/mysql/include/mysql /usr/include/mysql
設置開機啓動
# 複製開機啓動腳本到系統服務 cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld chown mysql:mysql /etc/rc.d/init.d/mysqld # 修改默認的"basedir"與"datadir" vim /etc/rc.d/init.d/mysqld basedir=/usr/local/mysql datadir=/data # 添加開機啓動腳本 chkconfig --add mysqld chkconfig --level 35 mysqld on
文件路徑:log && pid && socket
# 日誌路徑 mkdir -p /var/log/mysqld touch /var/log/mysqld/mysqld.log chown -R mysql:mysql /var/log/mysqld/ # pid路徑 mkdir -p /var/run/mysqld chown -R mysql:mysql /var/run/mysqld/ # socker路徑 mkdir -p /var/lib/mysqld chown -R mysql:mysql /var/lib/mysqld/ ln -s /var/lib/mysqld/mysql.sock /tmp/mysql.sock
設置my.cnf文件
# 注意"log-error","pid-file"與"socket"的路徑 mkdir -p /usr/local/mysql/etc cat << EOF >> /usr/local/mysql/etc/my.cnf [mysqld] character-set-server=utf8 max_connections = 3000 log-error=/var/log/mysqld/mysqld.log pid-file=/var/run/mysqld/mysqld.pid socket=/var/lib/mysqld/mysql.sock sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysql] default-character-set=utf8 EOF # 軟連接 ln -s /usr/local/mysql/etc/my.cnf /etc/my.cnf # 賦權 chown -R mysql:mysql /usr/local/mysql/etc/
啓動MySQL服務
# 啓動服務 service mysqld start # 驗證 service mysqld status
設置MySQL帳號密碼與登錄權限
# 使用初始化密碼登錄 mysql -uroot -p # 修改密碼,注意不能使用"$"等特殊符號 set password=password('cdh12#hadoop'); flush privileges; # 遠程登錄權限 grant all privileges on *.* to 'root'@'%' identified by 'cdh12#hadoop' with grant option; flush privileges; # 查看帳號 select user, host, authentication_string from mysql.user;
在全部節點建立CM目錄/opt/cloudera-manager
mkdir /opt/cloudera-manager
在master節點向其他節點分發cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz
for i in {1..3}; do scp /usr/local/src/cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz root@slave0$i:/usr/local/src/ ; done
在全部節點解壓cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz
到/opt/cloudera-manager/
目錄
tar -zxvf /usr/local/src/cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz -C /opt/cloudera-manager/
在全部slave節點修改/opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent/config.ini
的server_host
參數爲master節點ip或主機名
sed -i "s/server_host=localhost/server_host=master/g" /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent/config.ini
在全部節點建立cloudera-scm
帳號,這是CM相關服務使用的默認帳號
# 禁止使用"cloudera-scm"帳號登錄 useradd --system --home=/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
在全部節點爲/opt/cloudera-manager
目錄賦權
chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager
在master節點設置系統服務
# 設置使用"cloudera-scm-server"爲系統啓動服務 cp /opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-server /etc/rc.d/init.d/ chown cloudera-scm:cloudera-scm /etc/rc.d/init.d/cloudera-scm-server # 修改"CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default}"的路徑 vim /etc/rc.d/init.d/cloudera-scm-server CMF_DEFAULTS=/opt/cloudera-manager/cm-5.16.1/etc/default # 添加系統啓動服務 chkconfig --add cloudera-scm-server chkconfig --level 35 cloudera-scm-server on checkconfig --list
在全部slave節點設置系統服務
# 設置使用"cloudera-scm-agent"爲系統啓動服務 cp /opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent /etc/rc.d/init.d/ chown cloudera-scm:cloudera-scm /etc/rc.d/init.d/cloudera-scm-agent # 修改"CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default}"的路徑"-/etc/default" vim /etc/rc.d/init.d/cloudera-scm-agent CMF_DEFAULTS=${CMF_DEFAULTS:/opt/cloudera-manager/cm-5.16.1/etc/default} # 添加系統啓動服務 chkconfig --add cloudera-scm-agent chkconfig --level 35 cloudera-scm-agent on checkconfig --list
注意:部署JDBC在任意節點,則後續"CDH安裝配置"階段Reports Manager
被分配在任意節點均可以
cp /usr/local/src/mysql-connector-java-8.0.13.jar /opt/cloudera-manager/cm-5.16.1/share/cmf/lib/ chown cloudera-scm:cloudera-scm /opt/cloudera-manager/cm-5.16.1/share/cmf/lib/mysql-connector-java-8.0.13.jar
在master節點重啓MySQL服務
service mysqld restart
database
以下:
database
與user
,但不是必須使用;database
在數據庫中可直接建立,但CM初始化時若是沒有database
,則自動建立。Service | Database | User |
---|---|---|
Cloudera Manager Server | scm | scm |
Activity Monitor | amon | amon |
Reports Manager | rman | rman |
Hue | hue | hue |
Hive Metastore Server | metastore | metastore |
Sentry Server | sentry | sentry |
Cloudera Navigator Audit Server | nav | nav |
Cloudera Navigator Metadata Server | navms | navms |
Oozie | oozie | oozie |
# 格式:scm_prepare_database.sh [options] (postgresql|mysql|oracle) database username [password] # scm_prepare_database.sh:建立與配置CMS須要的數據庫腳本,默認在"/opt/cloudera-manager/cm-5.16.1/share/cmf/schema/"目錄; # postgresql|mysql|oracle:必選項,數據庫類型; # database:必選項,針對postgresql|mysql,建立SCM數據庫;針對oracle,填寫sid; # username:必選項,SCM數據庫的帳號; # password:選填項,SCM數據庫的帳號密碼,若是不指定,會提示輸入; # options: # -h:數據庫主機ip或hostname,默認是"localhost"; # -u:數據庫帳號,須要具有增刪改查的權限,默認是"root"; # -p:帳號密碼,默認無密碼; # --scm-host:SCM server主機名,默認是"localhost" /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % scm scm scm_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % amon amon amon_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % rman rman rman_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % hue hue hue_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % metastore metastore metastore_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % sentry sentry sentry_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % nav nav nav_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % navms navms navms_pass /opt/cloudera-manager/cm-5.16.1/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -pcdh12#hadoop --scm-host % oozie oozie oozie_pass
返回以下信息,表示配置成功
[main] INFO com.cloudera.enterprise.dbutil.DbCommandExecutor - Successfully connected to database. All done, your SCM database is configured correctly!
在master節點製做本地parcel源
# 建立本地parcel源目錄 mkdir -p /opt/cloudera/parcel-repo # 將parcel相關安裝包放置到"/opt/cloudera/parcel-repo"目錄; # 說明:"/opt/cloudera/parcel-repo"目錄可放置多套parcel安裝包; # 將"CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1"重命名爲"CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha",不然會從新下載"CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel"安裝包 mv /usr/local/src/CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel /opt/cloudera/parcel-repo/ mv /usr/local/src/CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha mv /usr/local/src/manifest.json /opt/cloudera/parcel-repo/ # 賦權 chown -R cloudera-scm:cloudera-scm /opt/cloudera/
在全部salve節點建立軟件安裝目錄
mkdir -p /opt/cloudera/parcels # 賦權 chown -R cloudera-scm:cloudera-scm /opt/cloudera/
在master節點啓動cloudera-scm-server
服務
# "cloudera-scm-server"啓動須要鏈接數據庫,監聽端口啓動會延遲 service cloudera-scm-server restart service cloudera-scm-server status -l # 經過啓動後的狀態查看,腳本須要執行"pstree"命令,須要安裝依賴包 yum install psmisc -y
在全部salve節點啓動cloudera-scm-agent
服務
yum install psmisc -y service cloudera-scm-agent restart service cloudera-scm-agent status -l
admin/admin
Cloudera Enterprise 試用版
cloudera-scm-agent
正常啓動後,可發現相應的節點,指定集羣服務的安裝節點parcel
源配置正確,則"下載"階段瞬間完成,其他階段視節點數與內部網絡狀況決定/proc/sys/vm/swappiness
設置爲最大值10
。
swappiness
值控制操做系統嘗試交換內存的積極;swappiness=0
:表示最大限度使用物理內存,以後纔是swap空間;swappiness=100
:表示積極使用swap分區,而且把內存上的數據及時搬遷到swap空間;swappiness
。臨時調整:
sysctl vm.swappiness=10
永久調整:
cat << EOF >> /etc/sysctl.conf # Adjust swappiness value vm.swappiness=10 EOF
臨時調整:
echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled
永久調整:
cat << EOF >> /etc/rc.d/rc.local # Disable transparent_hugepage echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled EOF # centos7.x系統,須要爲"/etc/rc.d/rc.local"文件賦予執行權限 chmod +x /etc/rc.d/rc.local
自定義服務
的HDFS
服務Reports Manager
數據庫名稱rman
,用戶名rman