CDH是Apache Hadoop和相關項目的最完整、最受測試和最流行的發行版。CDH提供Hadoop的核心元素-可伸縮存儲和分佈式計算-以及基於web的用戶界面和重要的企業功能。CDH是Apache許可的開放源碼,是惟一提供統一批處理、交互式SQL和交互式搜索以及基於角色的訪問控制的Hadoop解決方案。html
CDH 提供如下特性:java
Cloudera Manager 是用於管理cdh集羣的端到端應用程序。Cloudera Manager經過向CDH集羣的每一個部分提供細粒度的可見性並對其進行控制來設置企業部署標準-受權運營商提升性能、提升服務質量、提升聽從性和下降管理成本。使用Cloudera Manager,您能夠輕鬆地部署和集中操做完整的CDH堆棧和其餘託管服務。應用程序自動化安裝過程,將部署時間從數週減小到分鐘;爲您提供在集羣範圍內運行主機和服務的實時視圖;提供一個單一的中央控制檯來執行整個集羣的配置更改;並集成各類報告和診斷工具,以幫助您進行操做node
搭建方式的比較python
方式 | 費用成本 | 時間成本 | 難易度 | 適宜場景 |
---|---|---|---|---|
本身購買機器搭建 | 短時間投入高 | 高 | 須要本身掌握虛機和大數據組件的搭建細節,比較複雜 | 1.我的技術學習2.大公司構建本身的大數據集羣 |
基於雲服務器搭建 | 較高 | 較高 | 同上 | 中小型的大數據服務 |
使用阿里雲E-MapReduce | 可按小時付費,成本可控 | 低 | 環境由EMR搭建,使用便可 | 短時間、靈活的大數據服務 |
類目 | 版本 | 下載地址 |
---|---|---|
操做系統 | CentOS Linux release 7.5.1804 (Core) | 阿里雲服務器 |
數據庫 | mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz | 官網下載 |
JDK | jjdk-8u181-linux-x64.tar.gz | Oracle 官網下載 |
Cloudera Manager | Cloudera Manager 6.1.1 | 官方倉庫 |
CDH | CDH 6.1.1 | 使用parcels安裝 |
三臺8G+的主機mysql
名稱 | CM管理軟件 |
---|---|
cdh-master | Cloudera Manager Server&Agent 、Mysql |
cdh-slave001 | Cloudera Manager Agent |
cdh-slave002 | Cloudera Manager Agent |
全部節點都須要配置 vim /etc/hostslinux
172.26.86.11 cdh-master 172.26.86.12 cdh-slave001 172.26.86.10 cdh-slave002
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
將master主機的公鑰文件id_rsa.pub遠程複製到cdh00二、cdh003主機上。並放置/home/root/.ssh/authorized_keysweb
/root/.ssh>scp ~/.ssh/id_rsa.pub root@cdh-slave001:/root/.ssh/authorized_keys /root/.ssh>scp ~/.ssh/id_rsa.pub root@cdh-slave002:/root/.ssh/authorized_keys
全部主機都賦權600sql
chmod 600 ~/.ssh/authorized_keysshell
全部節點數據庫
yum install ntp -y # 開機啓動 chkconfig ntpd on # 啓動ntp service ntpd start
echo "* soft nofile 65536" >> /etc/security/limits.conf echo "* hard nofile 65536" >> /etc/security/limits.conf echo "* soft memlock unlimited" >> /etc/security/limits.conf echo "* hard memlock unlimited" >> /etc/security/limits.conf
全部節點
echo "vm.swappiness = 0" >> /etc/sysctl.conf
全部節點
echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag
全部節點
systemctl stop firewalld.service systemctl disable firewalld.service
能夠選擇CM管理頁面進行jdk安裝,但在以前須要安裝一個
wget http://blog-jupiter.oss-cn-shenzhen.aliyuncs.com/jdk-8u181-linux-x64.tar.gz mkdir -p /usr/java tar -zxvf jdk-8u181-linux-x64.tar.gz -C /usr/java/jdk1.8
vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8 CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CLASS_PATH PATH
source /etc/profile
這裏也能夠選擇mariadb,可是我安裝mariadb後,啓動服務建表步驟時,始終報用戶名或密碼錯誤
# 檢查系統是否存在mariadb rpm -qa | grep mariadb # 強制刪除 rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz # 解壓 tar -zxvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ mv /usr/local/mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql mkdir /usr/local/mysql/data chmod 777 /usr/local/mysql/data # 增長mysql用戶和組 groupadd mysql useradd -r -g mysql mysql chown -R mysql:mysql /usr/local/mysql
vim /etc/my.cnf
[mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data port=3306 socket=/tmp/mysql.sock pid-file=/tmp/mysqld/mysqld.pid character-set-server=utf8 log-error=/var/log/mysqld.log
安裝命令
touch /tmp/mysql.sock chown mysql:mysql /tmp/mysql.sock chmod 755 /tmp/mysql.sock mkdir -p /tmp/mysqld touch /tmp/mysqld/mysqld.pid chown -R mysql:mysql /tmp/mysqld chmod 755 /tmp/mysqld/mysqld.pid mkdir -p /var/log/ touch /var/log/mysqld.log chown -R mysql:mysql /var/log/ chmod 755 /var/log/mysqld.log yum install -y libaio # 初始化 cd /usr/local/mysql/bin/ ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql--datadir=/usr/local/mysql/data # 安全啓動 ./mysqld_safe --user=mysql & # 查看密碼 cat /var/log/mysqld.log | grep password My!U5LUWhjk3 # 登陸mysql cd /usr/local/mysql/bin/ ./mysql -u root -p mysql> set password=password("root"); mysql> grant all privileges on *.* to 'root'@'%' identified by 'root'; mysql> flush privileges; # 開機服務啓動設置 cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql chkconfig --add mysql # 建立快捷方式 ln -s /usr/local/mysql/bin/mysql /usr/bin
下載mysql-connector-java.jar,並保存到全部主機的/usr/share/java目錄下
wget http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar mv mysql-connector-java-5.1.47.jar mysql-connector-java.jar mkdir /usr/share/java cp mysql-connector-java.jar /usr/share/java/ scp mysql-connector-java.jar root@cdh-slave001:/usr/share/java/ scp mysql-connector-java.jar root@cdh-slave002:/usr/share/java/
yum -y install chkconfig bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs redhat-lsb
## wget <repo_file_url> -P /etc/yum.repos.d/ wget https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/cloudera-manager.repo -P /etc/yum.repos.d/ rpm --import https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/RPM-GPG-KEY-cloudera
安裝 CM Server 和 Agent
yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server sudo systemctl enable cloudera-scm-agent sudo systemctl enable cloudera-scm-server systemctl start cloudera-scm-server systemctl start cloudera-scm-agent
安裝 CM Agent
yum install cloudera-manager-daemons cloudera-manager-agent sudo systemctl enable cloudera-scm-agent systemctl start cloudera-scm-agent
須要建立scm、hue、hive,官網推薦建表以下
create database scm default character set utf8 default collate utf8_general_ci; grant all privileges on *.* to 'scm'@'%' identified by 'scm' with grant option ; create database amon default character set utf8 default collate utf8_general_ci; grant all privileges on amon.* to 'amon'@'%' identified by 'amon' with grant option; create database rman default character set utf8 default collate utf8_general_ci; grant all privileges on rman.* to 'rman'@'%' identified by 'rman' with grant option; create database hue default character set utf8 default collate utf8_general_ci; grant all privileges on *.* to 'hue'@'%' identified by 'hue' with grant option; create database metastore default character set utf8 default collate utf8_general_ci; grant all privileges on *.* to 'hive'@'%' identified by 'hive' with grant option; create database sentry default character set utf8 default collate utf8_general_ci; grant all privileges on sentry.* to 'sentry'@'%' identified by 'sentry' with grant option; create database nav default character set utf8 default collate utf8_general_ci; grant all privileges on nav.* to 'nav'@'%' identified by 'nav' with grant option; create database oozie default character set utf8 default collate utf8_general_ci; grant all privileges on oozie.* to 'oozie'@'%' identified by 'oozie' with grant option;
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm scm
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log vim /etc/cloudera-scm-agent/config.ini
2.運行以下命令
sudo -u hdfs hadoop fs -setrep -R 2 /
hue鏈接數據庫時使用python鏈接
yum install -y python-lxml
sudo -u
sudo -u hdfs hdfs dfsadmin -safemode leave
YarnRuntimeException: Error creating done directory: [hdfs://cdh001:8020/user/history/done
su hdfs後
hdfs dfs -chmod 777 /user hadoop fs -chmod -R 777 /tmp/
chmod 777 -R /var/log
su hdfs後 sudo -u hdfs hdfs dfs -chmod 777 /user sudo -u hdfs hadoop fs -chmod -R 777 /tmp