准备
- 建议最少4台物理机或者虚拟机(一个控制节点,3个数据节点),4核16G,硬盘500G,挂载根目录
- 如果用于学习,可以4核8G,如果是生产部署,推荐8核32G以上
- 系统为CentOS7.6,使用root用户登录
- CDH版本为5.13.1
配置hosts(所有节点)
假设4个节点IP为:
10.88.36.200
10.88.36.201
10.88.36.202
10.88.36.203
其中:
- 10.88.36.200作为控制节点
- 10.88.36.201-10.88.36.203作为数据节点
在所有节点的/etc/hosts中添加:
10.88.36.200 cdh1
10.88.36.201 cdh2
10.88.36.202 cdh3
10.88.36.203 cdh4
修改hostname(所有节点)
分别登录各个节点,修改hostname为cdh1,cdh2,cdh3,cdh4:
hostnamectl set-hostname YOUR_HOST_NAME
开启ssh免登录(cdh1)
在cdh1节点上执行:
ssh-keygen -t rsa -b 2048
一路回车,并拷贝至所有节点:
ssh-copy-id cdh1
ssh-copy-id cdh2
ssh-copy-id cdh3
ssh-copy-id cdh4
关闭防火墙(所有节点)
在所有节点上执行:
systemctl stop firewalld
systemctl disable firewalld
安装jdk8(所有节点)
在所有节点上执行:
yum install java-1.8.0-openjdk -y
安装mysql(cdh1)
在cdh1节点上安装mysql5.7,建议从官网下载rpm包安装
配置mysql(cdh1)
修改/etc/my.cnf,在末尾添加:
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
然后重启mysql:
systemctl restart mysqld
修改mysql密码及权限(cdh1)
在cdh1上,获取mysql临时密码:
cat /var/log/mysqld.log | grep -i password
登录mysql,卸载validate_password插件:
SET PASSWORD = PASSWORD('C@p19U#qfo');
UNINSTALL PLUGIN validate_password;
修改密码及权限:
grant all privileges on *.* to 'root'@'%' identified by 'C@p19U#qfo';
安装mysql驱动(所有节点)
在官网上下载mysql-connector-java-5.1.47.tar.gz,解压出 mysql-connector-java-5.1.47.jar
执行:
mkdir -p /usr/share/java
cp mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
下载cloudera资源:
cloudera manager & agent:
http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.13.1_x86_64.tar.gz
parcel:
http://archive.cloudera.com/cdh5/parcels/5.13.1/CDH-5.13.1-1.cdh5.13.1.p0.2-el7.parce
http://archive.cloudera.com/cdh5/parcels/5.13.1/CDH-5.13.1-1.cdh5.13.1.p0.2-el7.parcel.sha1
http://archive.cloudera.com/cdh5/parcels/5.13.1/manifest.json
安装cloudera manager(cdh1节点)
解压cloudera-manager-centos7-cm5.13.1_x86_64.tar.gz
tar -zxvf cloudera-manager-centos7-cm5.13.1_x86_64.tar.gz -C /opt
修改agent配置,将host_server修改为master
vim /opt/cm-5.13.1/etc/cloudera-scm-agent/config.ini
新建 cloudera-scm用户:
useradd --system --home-dir /opt/cm-5.13.1/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
初始化数据库:
/opt/cm-5.13.1/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -p'C@p19U#qfo' --scm-host localhost scm root 'C@p19U#qfo'
初始化parcel(cdh1)
mkdir -p /opt/cloudera/parcel-repo
mv CDH-5.13.1-1.cdh5.13.1.p0.2-el7.parcel /opt/cloudera/parcel-repo
mv CDH-5.13.1-1.cdh5.13.1.p0.2-el7.parcel.sha.1 /opt/cloudera/parcel-repo/CDH-5.13.1-1.cdh5.13.1.p0.2-el7.parcel.sha
mv manifest.json /opt/cloudera/parcel-repo
启动cloudera manager(cdh1)
/opt/cm-5.13.1/etc/init.d/cloudera-scm-server start
安装agent(所有数据节点)
将master节点的/opt/cm-5.13.1目录拷贝至所有控制节点的/opt目录下
scp -r /opt/cm-5.13.1 root@cdh2:/opt
scp -r /opt/cm-5.13.1 root@cdh3:/opt
scp -r /opt/cm-5.13.1 root@cdh4:/opt
在所有数据节点,新建 cloudera-scm用户:
useradd --system --home-dir /opt/cm-5.13.1/run/cloudera-scm-agent --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
启动cloudera agent(所有数据节点)
/opt/cm-5.13.1/etc/init.d/cloudera-scm-agent start
安装cloudera
打开浏览器,访问10.88.36.200:7180(启动比较慢,需要1-2分钟)
默认用户名/密码: admin/admin
按照步骤安装即可(建议选择社区版安装)
问题
如果zookeeper安装错误,提示权限问题或找不到version-2目录,在zookeeper节点上执行:
mkdir -p /var/lib/zookeeper/version-2
chown -R zookeeper:zookeeper /var/lib/zookeeper
chmod -R 755 /var/lib/zookeeper
如果其他组件安装错误(如yarn),提示权限问题,在相关节点上执行:
chown -R hdfs:hdfs /var/lib/hadoop-hdfs
chown -R httpfs:httpfs /var/lib/hadoop-httpfs
chown -R kms:kms /var/lib/hadoop-kms
chown -R mapred:mapred /var/lib/hadoop-mapreduce
chown -R yarn:yarn /var/lib/hadoop-yarn
chmod -R 755 /var/lib/hadoop-*
网友评论