CDH5.16.2三节点安装部署

一.安装虚拟机,最小化安装

vm设置好虚拟网络之后,先去电脑网络设置,将vm net8的属性中Ipv4协议进行更改
dns设置为先前设置的网关192.168.253.2
配置好后进行虚拟机安装
安装好后在hosts下配置映射

二.安装cdh:

设置ip地址:vi /etc/sysconfig/network-scripts/ifcfg-ens33
删除默认路由:DEFROUTE=yes
删除UUID
设置开机启动ONBOOT=yes

设置IPADDR=192.168.253.101
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
IPADDR=192.168.253.101
GATEWAY=192.168.253.2
DNS1=192.168.253.2
DNS2=8.8.8.8

重启网卡:service network restart

ping下外网是否正常

关闭NetworkManager
systemctl stop NetworkManager
systemctl disable NetworkManager

修改主机名和映射:

hostnamectl set-hostname cdh01 etc/hosts 添加192.168.253.101 cdh01
hostnamectl set-hostname cdh02 etc/hosts 添加192.168.253.102 cdh02
hostnamectl set-hostname cdh03 etc/hosts 添加192.168.253.103 cdh03

配置时间同步服务
主节点
yum install ntpd -y
vi /etc/ntp.conf
restrict 192.168.253.0 mask 255.255.255.0 nomodify notrap
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 1
时间同步外网
yum install ntpdate.x86_64 -y
ntpdate cn.pool.ntp.org
写入开机启动 chkconfig ntpdate on
其他节点安装yum install ntpdate.x86_64 -y
进行定时任务时间同步

配置免密登录(每个节点):
ssh-keygen -t rsa
cd .ssh
ssh-copy-id cdh01
ssh-copy-id cdh02
ssh-copy-id cdh03

设置虚拟化内存和禁用大叶内存(每个节点):
优化虚拟内存
echo ‘vm.swappiness = 0’ > /etc/sysctl.d/swappiness.conf
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/enabled” >> /etc/rc.local
echo “echo never > /sys/kernel/mm/transparent_hugepage/defrag” >> /etc/rc.local
chmod u+x /etc/rc.local

关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld

重启集群:
reboot

3.上传所需安装包:
创建文件夹
mkdir /usr/java
mkdir -p /usr/share/java
mkdir -p /opt/software
CDH5.16.2三节点安装部署_第1张图片

4.安装jdk:

mkdir /usr/java(注意:只能在usr下创建一层java,多层目录下将造成后续安装spark找不到jdk,建议每个节点)

tar -zxvf /opt/software/jdk-8u221-linux-x64.tar.gz -C /usr/java/

配置环境变量:
vi /etc/profile
#JAVA_HOME
export JAVA_HOME=/usr/java/jdk1.8.0_221
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
java -version

5.安装mysql:

centos7自带的是mariadb,需要先卸载掉

rpm -qa | grep mariadb

rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
安装mysql
cd /opt/software
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
安装mysql源:
yum -y install mysql57-community-release-el7-10.noarch.rpm
检查mysql源是否安装成功 :
yum repolist enabled | grep “mysql.*-community.*”
yum -y install mysql-community-server
CDH5.16.2三节点安装部署_第2张图片

启动MySQL服务

systemctl start mysqld

MySQL的启动状态

systemctl status mysqld

CDH5.16.2三节点安装部署_第3张图片

设置为开机启动:

systemctl enable mysqld

systemctl daemon-reload

修改默认密码:

grep ‘temporary password’ /var/log/mysqld.log
mysql -uroot -p
set password for ‘root’@‘localhost’=password(‘MyNewPass4!’);

修改密码策略和编码集:

/etc/my.cnf文件 :添加如下配置禁用即可:
validate_password = off

在[mysqld]下添加编码配置,如下所示:

[mysqld]
character_set_server=utf8
init_connect=‘SET NAMES utf8’

重启mysql

systemctl restart mysqld

添加远程账户

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘root@123’ WITH GRANT OPTION;

flush PRIVILEGES;
创建CM需要的库:
在MySQL中依次创建监控数据库、Hive数据库、Oozie数据库、Hue数据库
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
grant all privileges on amon.* to amon@’%’ identified by ‘amon@123’;
grant all privileges on amon.* to amon@‘cdh01’ identified by ‘amon@123’;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
grant all privileges on hue.* to hue@’%’ identified by ‘hue@123’;
grant all privileges on hue.* to hue@‘cdh01’ identified by ‘hue@123’;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
grant all privileges on hive.* to hive@’%’ identified by ‘hive@123’;
grant all privileges on hive.* to hive@‘cdh01’ identified by ‘hive@123’;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
grant all privileges on sentry.* to sentry@’%’ identified by ‘sentry@123’;
grant all privileges on sentry.* to sentry@‘cdh01’ identified by ‘sentry@123’;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
grant all privileges on oozie.* to oozie@’%’ identified by ‘oozie@123’;
grant all privileges on oozie.* to oozie@‘cdh01’ identified by ‘oozie@123’;
安装jar包:

mkdir -p /usr/share/java

cp /opt/software/mysql-connector-java-5.1.49.jar /usr/share/java/mysql-connector-java.jar

6.安装mysql缺失文件,否则后续安装hue失败:

CDH5.16.2三节点安装部署_第4张图片

如果后续安装可以看日志报错,这里先安装了:

cd /opt/cloudera-manager/cm-5.16.2/log/cloudera-scm-server

tail -n 10 cloudera-scm-server.log

在这里插入图片描述

mysql是重新安装的,服务器重新安装mysql的同时,会删除系统原来的mysql,此时会连带着删除 libmysqlclient.s0.18 文件

在一台从未装过mysql的服务器里,可以在 /usr/lib64/mysql/ 下找到 libmysqlclient.s0.18

做软连接:

ln -s /usr/lib64/mysql/libmysqlclient.so.18.0.0 /usr/lib64/mysql/libmysqlclient.so.18

#### 在 /etc/ld.so.conf 文件后追加 /usr/lib64/mysql (libmysqlclient.so.18 和libmysqlclient.so.18.0.0所在目录)
#### 运行 ldconfig 命令,让其生效

7.安装依赖包,否则集群起不来:

yum install chkconfig python bind-utils psmisc libxslt zlib sqlite fuse fuse-libs redhat-lsb cyrus-sasl-plain cyrus-sasl-gssapi -y

8.安装Cloudera-Manager

解压cm tar包到指定目录,所有服务器都要

mkdir /opt/cloudera-manager

tar -axvf cloudera-manager-centos7-cm5.16.2_x86_64.tar.gz -C /opt/cloudera-manager

创建cloudera-scm用户(所有节点)
useradd
–system
–home=/opt/cloudera-manager/cm/cm-5.14.2/run/cloudera-scm-server
–no-create-home
–shell=/bin/false
–comment “Cloudera SCM User” cloudera-scm
参数说明:
–system 创建一个系统账户
–home 指定用户登入时的主目录,替换系统默认值/home/<用户名>
–no-create-home 不要创建用户的主目录
–shell 用户的登录 shell 名
–comment 用户的描述信息
注意:Cloudera Manager默认去找用户cloudera-scm,创建完该用户后,将自动使用此用户。

配置从节点cloudera-manger-agent指向主节点服务器 ,所有节点

vim /opt/cloudera-manager/cm-5.16.2/etc/cloudera-scm-agent/config.ini

将server_host改为CMS所在的主机名
CDH5.16.2三节点安装部署_第5张图片

主节点中创建parcel-repo仓库目录(这个只在主节点 )

mkdir -p /opt/cloudera/parcel-repo

chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo

更改名称

mv CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha1 CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha

将文件复制到/opt/cloudera/parcel-repo

cp CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel manifest.json /opt/cloudera/parcel-repo

所有节点创建parcels目录(所有节点)

mkdir -p /opt/cloudera/parcels

授权用户组用户

chown cloudera-scm:cloudera-scm /opt/cloudera/parcels

解释:Clouder-Manager将CDHs从主节点的/opt/cloudera/parcel-repo目录中抽取出来,分发解压激活到各个节点的/opt/cloudera/parcels目录中

配置cm数据库,初始脚本配置数据库scm_prepare_database.sh(在主节点上)

/opt/cloudera-manager/cm-5.16.2/share/cmf/schema/scm_prepare_database.sh mysql -hCDH -uroot -proot@123 --scm-host CDH scm scm scm@123

在这里插入图片描述

说明:这个脚本就是用来创建和配置CMS需要的数据库的脚本。各参数是指:

mysql:数据库用的是mysql,如果安装过程中用的oracle,那么该参数就应该改为oracle。

-hCDH:数据库建立在CDH主机上面。也就是主节点上面。

-uroot:root身份运行mysql。-proot@123:mysql的root密码是***。

–scm-host CDH:CMS的主机,一般是和mysql安装的主机是在同一个主机上。

最后三个参数是:数据库名,数据库用户名,数据库密码。

启动主节点cloudera-scm-server

/opt/cloudera-manager/cm-5.16.2/etc/init.d/cloudera-scm-server start

启动cloudera-scm-agent所有节点

/opt/cloudera-manager/cm-5.16.2/etc/init.d/cloudera-scm-agent start
主节点
拷贝下载文件到CDH-5.14.2-1.cdh5.14.2.p0.3-el7.parcel 、CDH-5.14.2-1.cdh5.14.2.p0.3-el7.parcel.sha1 、manifest.json 到cdh01的/opt/cloudera/parcel-repo/目录下

8.安装

浏览器:

CDH01:7180 默认使用admin admin登录

主机检查

CDH5.16.2三节点安装部署_第6张图片

echo 0 > /proc/sys/vm/swappiness

echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled

再点击上面的重新运行会发现这次全部检查通过了

CDH5.16.2三节点安装部署_第7张图片

hdfs报错:

CDH5.16.2三节点安装部署_第8张图片

点击集群-HDFS-配置

搜索dfs. replication,设置为1后保存更改(个数与dn数一致)

在cm0中通过命令更改备份数:

su hdfs

hadoop fs -setrep -R 1 /

hue报错:
不良 : 该角色的进程启动失败。

需要提前安装环境 httpd, mod_ssl

yum install httpd

yum install mod_ssl

安装好之后, 重启就好了

点击集群-HDFS-配置

搜索dfs. replication,设置为1后保存更改(个数与dn数一致)

在cm0中通过命令更改备份数:

su hdfs

hadoop fs -setrep -R 1 /

hue 不良 : 该角色的进程启动失败。

需要提前安装环境 httpd, mod_ssl

yum install httpd

yum install mod_ssl

安装好之后, 重启就好了
oozie UI界面不显示:
报错Oozie web console is disabled. To enable Oozie web console install the Ext JS library
解决方式:
下载ext-2.2.zip,放到路径/var/lib/oozie
cd /var/lib/oozie
wget http://archive.cloudera.com/gplextras/misc/ext-2.2.zip
unzip ext-2.2.zip
chown -R oozie:oozie ext-2.2
重新访问UI即可

你可能感兴趣的:(CDH安装,cloudera,hadoop,hdfs,大数据)