1、CDH下載:
cloudera-manager-installer.bin:http://archive.cloudera.com/cm5/installer/latest/,非生產環境安裝才須要
RPM: http://archive.cloudera.com/cm5/redhat/7/x86_64/cm/5.12/RPMS/x86_64/,保存至/usr/CDH/rpm
2、安裝cloudera manager:
1.關閉防火牆:
1.1關閉SELinux:vi /etc/selinux/config,修改SELinux=disabled,重啓生效,查看 /usr/sbin/sestatus -v
1.2關閉iptables:
1.2.1 禁止iptables:service iptables stop && chkconfig iptables off
1.2.2 清除iptables: iptables -F
1.3關閉防火牆
systemctl disable firewalld
systemctl stop firewalld
2.創建各節點無密碼SSH
2.1 ssh-keygen
2.2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
3.安裝rpm,cd /usr/CDH/rpm
3.1 若是以前有安裝剛先卸載:
3.1.1 卸載manager:yum -y remove cloudera-manager-daemons cloudera-manager-server
3.1.2 卸載agent:yum -y remove cloudera-manager-daemons cloudera-manager-agent
3.2 cp cloudera-manager.repo /etc/yum.repos.d/
3.3 manager server:yum -y install oracle-j2sdk1.7-1.7.0+update67-1.x86_64.rpm
cloudera-manager-daemons-5.12.0-1.cm5120.p0.120.el7.x86_64.rpm
cloudera-manager-server-5.12.0-1.cm5120.p0.120.el7.x86_64.rpm
3.4 manager agent:yum -y install oracle-j2sdk1.7-1.7.0+update67-1.x86_64.rpm
cloudera-manager-daemons-5.12.0-1.cm5120.p0.120.el7.x86_64.rpm
cloudera-manager-agent-5.12.0-1.cm5120.p0.120.el7.x86_64.rpm
3.5 cp /usr/CDH/mysql-connector-java-5.1.38.jar /usr/share/cmf/common_jars
4.創建mysq驅動軟鏈接:cd /usr/share/cmf/lib && ln -s ../common_jars/mysql-connector-java-5.1.15.jar mysql-connector-java-5.1.15.jar
5.Install the JDBC driver on the Cloudera Manager Server host, as well as hosts to which you assign the Activity Monitor, Reports Manager,
Hive Metastore Server, Hue Server, Sentry Server, Cloudera Navigator Audit Server, and Cloudera Navigator Metadata Server roles:
mkdir -p /usr/share/java/ && ln -s /usr/share/cmf/common_jars/mysql-connector-java-5.1.15.jar /usr/share/java/mysql-connector-java.jar
6.運行目錄:
6.1 java安裝目錄: /usr/java/jdk1.7.0_67-cloudera
6.2 cm server數據庫配置:/etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=mysql
com.cloudera.cmf.db.name=scm
com.cloudera.cmf.db.user=scm
com.cloudera.cmf.db.setupType=EXTERNAL
com.cloudera.cmf.db.password=scm
6.3 cm agent代理配置目錄: /etc/cloudera-scm-agent,修改config.ini中server_host爲cm server主機名或地址
6.4 cm jar包目錄: /usr/share/cmf/lib
6.5 cm server啓動日誌目錄: /var/log/cloudera-scm-server
6.6 cm agent啓動日誌目錄: /var/log/cloudera-scm-agent
7.升級mysql驅動:
7.1 將mysql-connector-java-5.1.38.jar上傳至全部主機/usr/share/cmf/common_jars目錄
7.2 將老版本驅動改名:mv /usr/share/cmf/common_jars/mysql-connector-java-5.1.15.jar /usr/share/cmf/common_jars/mysql-connector-java-5.1.15-old.jar
7.3 將新驅動改名: mv /usr/share/cmf/common_jars/mysql-connector-java-5.1.38.jar /usr/share/cmf/common_jars/mysql-connector-java-5.1.15.jar
3、cloudera數據庫初始化:
1.managent service數據庫
1.1 mysql命令行下執行:grant all on *.* to 'scm'@'%' identified by 'scm' with grant option;
1.2 bash下執行:/usr/share/cmf/schema/scm_prepare_database.sh mysql -h mysql -uroot -p123 --scm-host manager scm scm scm
1.3 mysql命令行下執行:drop user 'scm'@'%';
如下在mysql命令行下執行:
2.Activity Monitor:
create database if not exists `cdh_amon` default character set utf8 collate utf8_general_ci;
create user amon@'%' identified by 'amon';
grant all privileges on cdh_amon .* to amon @'%' identified by 'amon';
3.Reports Manager:
create database if not exists `cdh_rman` default character set utf8 collate utf8_general_ci;
create user rman@'%' identified by 'rman';
grant all privileges on cdh_rman.* to rman@'%' identified by 'rman';
4.Hive Metastore Server:
create database if not exists `cdh_hive` default character set utf8 collate utf8_general_ci;
create user hive@'%' identified by 'hive';
grant all privileges on cdh_hive.* to hive@'%' identified by 'hive';
5.Sentry Server:
create database if not exists `cdh_sentry` default character set utf8 collate utf8_general_ci;
create user sentry@'%' identified by 'sentry';
grant all privileges on cdh_sentry.* to sentry@'%' identified by 'sentry';
6.Cloudera Navigator Audit Server:
create database if not exists `cdh_nav` default character set utf8 collate utf8_general_ci;
create user nav@'%' identified by 'nav';
grant all privileges on cdh_nav.* to nav@'%' identified by 'nav';
7.Cloudera Navigator Metadata Server:
create database if not exists `cdh_navms` default character set utf8 collate utf8_general_ci;
create user navms@'%' identified by 'navms';
grant all privileges on cdh_navms.* to navms@'%' identified by 'navms';
8.Hue:
create database if not exists `cdh_hue` default character set utf8 collate utf8_general_ci;
create user hue@'%' identified by 'hue';
grant all privileges on cdh_hue.* to hue@'%' identified by 'hue';
9.Oozie:
create database if not exists `cdh_oozie` default character set utf8 collate utf8_general_ci;
create user oozie@'%' identified by 'oozie';
grant all privileges on cdh_oozie.* to oozie@'%' identified by 'oozie';
4、啓動主節點:service cloudera-scm-server start,在/run/cloudera-scm-server.pid裏保存進程ID
5、啓動代理節點:service cloudera-scm-agent start,瀏覽器輸入http://CM Server IP:7180
6、各類坑:
1.代理節點啓動報錯:
錯誤信息:Error, CM server guid updated, expected df16790a-2e44-44ec-9db2-8731cc635c61, received b6fecabc-8e32-46be-8a43-5f261064b2c7
解決方法:刪除/var/lib/cloudera-scm-agent下cm_guid文件
2.oozie缺乏ext-2.2:
解決方法:將ext-2.2拷貝至/var/lib/oozie目錄
3.spark運行報錯:Required executor memory (1024+384 MB) is above the max threshold (1024 MB) of this cluster!
Please check the values of 'yarn.scheduler.maximum-allocation-mb' and/or 'yarn.nodemanager.resource.memory-mb'
解決方法:修改服務YARN (MR2 Included)中以下配置項並保存,重啓YARN:
最小容器內存(大於1G):yarn.scheduler.minimum-allocation-mb
最大容器內存(大於1G):yarn.scheduler.maximum-allocation-mb
容器內存(大於1G):yarn.nodemanager.resource.memory-mb
4.linux shell運行hdfs及運行spark時報錯:org.apache.hadoop.security.AccessControlException: Permission denied: user=root, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-x
解決方法:將export HADOOP_USER_NAME=hdfs添加到~/.bash_profile或/etc/profile中,而後source ~/.bash_profile或source /etc/profile
5.hive執行引擎默認爲mapreduce的配置修改:hive.execution.engine由mr改成spark
6.agent節點沒法經過http從manager下載安裝文件,取消原來安裝的JDK8版本,換成cloudera指定的jdk安裝包則OK,分析多是JDK8某些安全方面的控制形成
7.agent節點沒法經過http從manager下載CDH-5.12.0-1.cdh5.12.0.p0.29-el7.parcel.torrent文件,形成安裝頁面中止
緣由:manager節點下/opt/cloudera/parcel-repo/全部文件是經過另外一環境COPY而來,torrent文件全部者爲root,形成cm沒法訪問
解決:刪除CDH-5.12.0-1.cdh5.12.0.p0.29-el7.parcel.torrent文件,由cm自行從cloudera官網下載此文件
8.agent節點啓動後沒法生成主機ID,形成CM不能識別該主機
緣由:發現該節點下/var/lib/cloudera-scm-agent目錄uuid文件大小爲0k,未生成此主機ID
解決:刪除此uuid文件,輸入命令service cloudera-scm-agent restart從新啓動agent