Centos7下Cloudera Manager 5離線部署CDH5
Centos7下Cloudera Manager 5離線部署 CDH5
1.先決條件
2.準備工作
-
3臺16核32G記憶體260G硬碟CentOS 7機器
機器規劃:
HostName 角色 IP cdh001 CM節點,NameNode,Active Monitor,DataNode 192.168.31.151 cdh002 DataNode、 JobTracker 192.168.31.152 cdh003 DataNode、 JobTracker 192.168.31.153 -
JDK1.8u162
-
JDBC
-
作業系統依賴
-
psmisc
CM客戶端和服務端啟動指令碼會使用pstree命令,不安裝會報找不到命令
-
libxslt-devel
不安裝的話Hue安裝時測試MySQL會報錯
# 所有節點安裝 yum install -y psmisc libxslt-devel wget
-
3.CM安裝
3.1.網路配置
-
修改主機名
# 分別在對應機器上執行 hostnamectl set-hostname cdh01 hostnamectl set-hostname cdh02 hostnamectl set-hostname cdh03
-
配置hosts檔案 (所有節點)
vi /etc/hosts 192.168.31.151 cdh01 192.168.31.152 cdh02 192.168.31.153 cdh03
-
配置ssh免密登入
# 在cdh01上執行 ssh-keygen # 一路回車預設在~/.ssh目錄下生成RSA金鑰對id_rsa(私鑰),id_rsa.pub(公鑰) # 新增公鑰認證 ssh-copy-id -i cdh01 ssh-copy-id -i cdh02 ssh-copy-id -i cdh03 # 輸入機器使用者密碼 # 拷貝金鑰對到各個機器上去 scp -r ~/.ssh/ cdh01:~/ scp -r ~/.ssh/ cdh02:~/ scp -r ~/.ssh/ cdh03:~/
-
關閉防火牆 (所有節點)
# 檢查防火牆狀態 systemctl status firewalld # 關閉防火牆
-
關閉selinux(所有節點)
# 臨時關閉selinux setenforce 0 # 設定開機不自啟 vi /etc/selinux/config # 修改"SELINUX=enforcing"為"SELINUX=disabled" SELINUX=disabled # 檢視 SELINUX 狀態: /usr/sbin/sestatus –v # SELinux status: enabled(enabled:開啟;disabled:關閉)
3.2.JDK安裝
-
官方JDK安裝要求
- The JDK must be 64-bit. Do not use a 32-bit JDK.
- The installed JDK must be a supported version as documented in CDH and Cloudera Manager Supported JDK Versions.
- Oracle JDK 7 is supported across all versions of Cloudera Manager 5 and CDH 5.
- Oracle JDK 8 is supported in C5.3.x and higher.
- Oracle JDK 9 is not supported in any Cloudera Manager or CDH version.
- The same version of the Oracle JDK must be installed on each cluster host.
- The JDK must be installed at /usr/java/jdk-version.
Important:The RHEL-compatible and Ubuntu operating systems supported by Cloudera Enterprise all use AES-256 encryption by default for tickets. To support AES-256 bit encryption in JDK versions lower than 1.8u161, you must install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy File on all cluster and Hadoop user machines. Cloudera Manager can automatically install the policy files, or you can install them manually. For JCE Policy File installation instructions, see the README.txtfile included in the jce_policy-x.zip file. JDK 1.8u161 and higher enable unlimited strength encryption by default, and do not require policy files.On SLES platforms, do not install or try to use the IBM Java version bundled with the SLES distribution. CDH does not run correctly with that version.
根據官方指南因此本次安裝選擇JDK充分測試過且支援的最高版本JDK1.8u162
# 上傳下載的jdk到cdh01機器上 # 解壓縮 # 移動到/opt/java目錄下 mkdir /usr/java/ tar zxvf jdk-8u162-linux-x64.tar.gz -C /usr/java/ # 配置環境變數 vi /etc/profile # 在最末尾加上 # for jdk export JAVA_HOME=/usr/java/jdk1.8.0_162 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH # 生效環境變數 source /etc/profile # 檢查是否生效 java -version # 將jdk拷貝到其他節點上去 scp -r /usr/java/ cdh02:/usr/ scp -r /usr/java/ cdh03:/usr/ # 拷貝環境變數到其他節點上去 scp /etc/profile cdh02:/etc/ scp /etc/profile cdh03:/etc/ # 在其他節點檢查jdk環境是否生效 source /etc/profile java -version
3.3.配置ntp
-
安裝ntp(所有節點)
yum install -y ntp
-
配置
-
cdh01節點
# cdh01主節點配置 vi /etc/ntp.conf # 註釋預設的server,新增以下server server 210.72.145.44 perfer # 中國國家受時中心 server 202.112.10.36 # 1.cn.pool.ntp.org server 59.124.196.83 # 0.asia.pool.ntp.org server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10
-
cdh02、cdh03節點
vi /etc/ntp.conf ## 子節點把所有server行註釋掉,新增下面一行 server cdh01
-
所有節點
systemctl start ntpd systemctl enable ntpd ntpstat
synchronised to NTP server (192.168.31.151) at stratum 12
time correct to within 909 ms
polling server every 64 s
-
3.4.cdh01節點安裝配置MySQL
-
安裝
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum update yum install mysql-server systemctl start mysqld
-
配置
systemctl stop mysqld cp /etc/my.cnf /etc/my.cnf.default vi /etc/my.cnf # 刪除原有配置,並修改為如下建議配置
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock transaction-isolation = READ-COMMITTED # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: symbolic-links = 0 key_buffer_size = 32M max_allowed_packet = 32M thread_stack = 256K thread_cache_size = 64 query_cache_limit = 8M query_cache_size = 64M query_cache_type = 1 max_connections = 550 #expire_logs_days = 10 #max_binlog_size = 100M #log_bin should be on a disk with enough free space. #Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your #system and chown the specified folder to the mysql user. log_bin=/var/lib/mysql/mysql_binary_log #In later versions of MySQL, if you enable the binary log and do not set #a server_id, MySQL will not start. The server_id must be unique within #the replicating group. server_id=1 binlog_format = mixed read_buffer_size = 2M read_rnd_buffer_size = 16M sort_buffer_size = 8M join_buffer_size = 8M # InnoDB settings innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 64M innodb_buffer_pool_size = 4G innodb_thread_concurrency = 8 innodb_flush_method = O_DIRECT innodb_log_file_size = 512M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid sql_mode=STRICT_ALL_TABLES
# 設定開機自啟 systemctl enable mysqld # 啟動 systemctl start mysqld
-
設定root密碼
/usr/bin/mysql_secure_installation [...] Enter current password for root (enter for none): OK, successfully used password, moving on... [...] Set root password? [Y/n] Y New password: Re-enter new password: Remove anonymous users? [Y/n] Y [...] Disallow root login remotely? [Y/n] N [...] Remove test database and access to it [Y/n] Y [...] Reload privilege tables now? [Y/n] Y All done!
-
安裝配置MySQL JDBC 驅動
wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz tar zxvf mysql-connector-java-5.1.47.tar.gz mkdir -p /usr/share/java/ cp mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar \ /usr/share/java/mysql-connector-java.jar scp -r /usr/share/java/ cdh02:/usr/share/ scp -r /usr/share/java/ cdh03:/usr/share/
-
建立對應服務資料庫
mysql -uroot -p mysql>
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue'; CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'hive'; CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry'; CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie'; CREATE DATABASE am DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON am.* TO 'am'@'%' IDENTIFIED BY 'am';
3.5. 建立使用者 cloudera-scm ( 所有 節點)
useradd --system --home=/opt/cm-5.15.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
3.6.解壓CM包
# cdh01節點
tar -zxvf cloudera-manager-centos7-cm5.15.1_x86_64.tar.gz -C /opt/
mv CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel manifest.json /opt/cloudera/parcel-repo/
chown -R cloudera-scm:cloudera-scm /opt/cm-5.15.1/
mkdir -p /opt/cloudera/parcel-repo
chown -R cloudera-scm:cloudera-scm /opt/cloudera/
mkdir /var/lib/cloudera-scm-server
chown -R cloudera-scm:cloudera-scm /var/lib/cloudera-scm-server
3.7.修改agent配置
# cdh01節點
vi /opt/cm-5.15.1/etc/cloudera-scm-agent/config.ini
server_host=cdh01
3.8.拷貝CM包到所有節點
# cdh01節點
scp -r /opt/cm-5.15.1/ cdh02:/opt/
scp -r /opt/cm-5.15.1/ cdh03:/opt/
# cdh02、cdh03節點
mkdir -p /opt/cloudera/parcel-repo
chown -R cloudera-scm:cloudera-scm /opt/cloudera/
3.9.cdh01節點初始化資料庫
# cdh01節點
/opt/cm-5.15.1/share/cmf/schema/scm_prepare_database.sh mysql -hlocalhost -uroot -p123456 --scm-host localhost scm scm scm
3.10.啟動服務
# cdh01節點啟動cm服務端
/opt/cm-5.15.1/etc/init.d/cloudera-scm-server start
# 檢視啟動日誌
tail -f /opt/cm-5.15.1/log/cloudera-scm-server/cloudera-scm-server.log
# 檢視到如下日誌服務啟動完成
com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
# cdh01、cdh02、cdh03節點啟動客戶端
/opt/cm-5.15.1/etc/init.d/cloudera-scm-agent start
3.11.初始化CM
此處會報兩個錯誤:記憶體交換空間設定和啟用了透明大頁面壓縮,點選【檢視詳細資訊】檢視需要修改設定的主機
-
將機器設定成cloudera官方建議的配置
sysctl vm.swappiness=10 vi /etc/sysctl.conf # /etc/sysctl.conf加入或修改vm.swappiness配置 vm.swappiness=10 # 使配置生效 sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local cat /etc/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled
修改完成重新執行檢查主機檢查,此時警告消除點選【完成】。
4.安裝CDH服務
- 選擇服務
- 配置角色
- 設定資料庫連線
- 叢集設定
- 開始安裝
- 完成安裝