经过无数次的重装,呕心沥血,最终成功!
详细记录每一步。
一、下载相关文件
ubuntu16.04
http://old-releases.ubuntu.com/releases/16.04.3/ubuntu-16.04.4-server-amd64.iso
cloudera manager 相关下载
http://archive.cloudera.com/cm5/cm/5/cloudera-manager-xenial-cm5.15.1_amd64.tar.gz
http://archive.cloudera.com/cdh5/parcels/latest/CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel
http://archive.cloudera.com/cdh5/parcels/latest/CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel.sha1
http://archive.cloudera.com/cdh5/parcels/latest/manifest.json
二、安装虚拟机
安装过程略。
划重点:
本人资源紧张,这里讲的是配置最小化安装,土豪可跳过。
- 硬盘:
虚拟机的硬盘大小推荐20G。
最初设置10G硬盘,总是出现错误,排查了各种原因,无果。
怀疑是安装包进行解压时,空间不足。 - 内存:
主节点内存尽量大一些,4G以上
从节点内存1G以上
如果内存过小会出现内存不足安装失败的情况,调整内存,重新安装。
最终完成内存情况(主节点:8G,从节点:2G*2)
三、环境准备
修改root密码,为方便操作,之后所有的命令均可使用root执行
sudo passwd root
安装vim
sudo apt-get remove vim-common
sudo apt-get install vim
安装ssh,即使使用虚拟机,也推荐使用ssh工具进行操作,如SecureCRT、XShell等
sudo apt-get install openssh-server
sudo vim /etc/ssh/sshd_config
#修改以下内容
#----------------------------------#
#PermitRootLogin prohibit-password
PermitRootLogin yes
#----------------------------------#
# 重启服务
sudo service ssh restart
设置静态ip
ifconfig
# 查看网卡名为 ens33
sudo vim /etc/network/interfaces
# 设置静态IP
#----------------------------------#
auto ens33
#iface ens33 inet dhcp
iface ens33 inet static
address 192.168.60.132
netmask 255.255.255.0
gateway 192.168.60.2
#----------------------------------#
# 重启网络服务
sudo /etc/init.d/networking restart
#设置dns
sudo vim /etc/resolvconf/resolv.conf.d/base
# 添加以下内容
#----------------------------------#
nameserver 8.8.8.8
#----------------------------------#
# 使dns配置生效
sudo resolvconf -u
设置时区
# 依次选择 Asia -> ShangHai
dpkg-reconfigure tzdata
为方便操作,关闭防火墙,卸载iptables组件
sudo ufw disable
sudo apt-get remove iptables
安装常用软件
sudo apt-get install lrzsz
sudo apt-get install unzip
# mysql jdbc 驱动
sudo apt-get install libmysql-java
安装jdk8
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
# 重启后可查看JAVA_HOME
echo $JAVA_HOME
# 记录JAVA_HOME:/usr/lib/jvm/java-8-oracle
ntp
sudo apt-get install ntp
# 启动ntp
service ntp restart
# 观察npt
watch ntpq -p
修改hostname
sudo vim /etc/hostname
# 使hostname生效
sudo /etc/init.d/hostname.sh start
# 3台机器分别为:
# master: hadoopm
# slaves: hadoops1, hadoops2
修改hosts
sudo vim /etc/hosts
# 添加以下内容
#----------------------------------#
#127.0.1.1 ubuntu
192.168.60.132 hadoopm
192.168.60.133 hadoops1
192.168.60.134 hadoops2
#----------------------------------#
免密码登录ssh
# 在每个节点上分别生成密钥
sudo ssh-keygen -t rsa
# 会在~/.ssh下面生成2个文件
# id_rsa,id_rsa.pub
# 以下按顺序执行
# 在hadoopm上执行
sudo cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
sudo scp ~/.ssh/authorized_keys root@hadoops1:~/.ssh/
sudo ssh hadoops1
sudo cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
sudo scp ~/.ssh/authorized_keys root@hadoops2:~/.ssh/
sudo ssh hadoops2
sudo cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
sudo scp ~/.ssh/authorized_keys root@hadoops1:~/.ssh/
sudo scp ~/.ssh/authorized_keys root@hadoopm:~/.ssh/
安装mysql(主节点)
sudo apt-get install mysql-server
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 在[mysqld]区域中加上
#----------------------------------#
#bind-address = 127.0.0.1
lower_case_table_names=1
default-time_zone = '+8:00'
skip_ssl
#----------------------------------#
sudo service mysql stop
sudo service mysql start
将下载的安装文件放至主节点根目录
cloudera-manager-xenial-cm5.15.1_amd64.tar.gz
CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel
CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel.sha1
manifest.json
四、测试环境是否正常
重启(各个节点)
sudo reboot
测试host是否正常(各个节点)
ping hadoopm
ping hadoops1
ping hadoops2
测试免密码登录ssh(各个节点)
# 若正常进入,输入exit退出
sudo ssh hadoopm
# sudo ssh root@hadoopm
sudo ssh hadoops1
# sudo ssh root@hadoops1
sudo ssh hadoops2
# sudo ssh root@hadoops2
五、安装Cloudera Manager
解压、复制文件
tar zxvf ~/cloudera-manager-xenial-cm5.15.1_amd64.tar.gz -C /opt/
mkdir /opt/cloudera /opt/cloudera/parcels /opt/cloudera/parcel-repo
mv ~/CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel.sha
mv ~/CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel /opt/cloudera/parcel-repo/CDH-5.15.1-1.cdh5.15.1.p0.4-xenial.parcel
mv ~/manifest.json /opt/cloudera/parcel-repo/manifest.json
rm -rf ~/cloudera-manager-xenial-cm5.15.1_amd64.tar.gz
添加mysql 驱动
cp /usr/share/java/mysql-connector-java.jar /opt/cm-5.15.1/share/cmf/lib/mysql-connector-java.jar
根据Cloudera Manager的建议修改/proc/sys/vm/swappiness
echo 10 > /proc/sys/vm/swappiness
创建数据库
Service | Database | User |
---|---|---|
Cloudera Manager Server | scm | scm |
Activity Monitor | amon | amon |
Reports Manager | rman | rman |
Hue | hue | hue |
Hive Metastore Server | metastore | hive |
Sentry Server | sentry | sentry |
Cloudera Navigator Audit Server | nav | nav |
Cloudera Navigator Metadata Server | navms | navms |
Oozie | oozie | oozie |
# 进入mysql
mysql -u root -p
CREATE DATABASE DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON .* TO ''@'%' IDENTIFIED BY '';
# 以下为具体的创建语句
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'abc123_';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'abc123_';
# SHOW DATABASES;
# SHOW GRANTS FOR ''@'%';
创建scm数据库
# 重新配置时,防止scm数据库已经存在而终止执行命令可加参数 -f
/opt/cm-5.15.1/share/cmf/schema/scm_prepare_database.sh mysql scm scm
配置agent
sudo vim /opt/cm-5.15.1/etc/cloudera-scm-agent/config.ini
#修改以下内容
server_host=hadoopm
复制cm-5.15.1文件夹至slaves
sudo scp -r /opt/cm-5.15.1 hadoops1:/opt/
sudo scp -r /opt/cm-5.15.1 hadoops2:/opt/
创建cloudera-scm用户(各个节点)
useradd --system --home=/opt/cm-5.15.1/run/cloudera-scm-server --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
更改文件夹所有用户与用户组(各个节点)
mkdir /opt/cloudera /opt/cloudera/parcels /opt/cloudera/parcel-repo
sudo chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcels
sudo chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo
sudo chown -R cloudera-scm:cloudera-scm /opt/cm-5.15.1
启动Cloudera Manager的Server和Agent
#在hadoopm执行
/opt/cm-5.15.1/etc/init.d/cloudera-scm-server start
#在各个节点执行
/opt/cm-5.15.1/etc/init.d/cloudera-scm-agent start
# 查看运行状态
/opt/cm-5.15.1/etc/init.d/cloudera-scm-agent status
/opt/cm-5.15.1/etc/init.d/cloudera-scm-server status
# 查看server日志
tail -f /opt/cm-5.15.1/log/cloudera-scm-server/cloudera-scm-server.log
# 查看agent日志
tail -f /opt/cm-5.15.1/log/cloudera-scm-agent/cloudera-scm-agent.log
六、图形化安装
访问管理界面
http://192.168.60.132:7180/
# 账号密码均为admin
其他看图说话