CDH6.3集群部署--研发环境安装实录

文章目录

  • 一、主机
  • 二、准备安装包
    • 2.1 MySQL 5.7.27
    • 2.2 MySQL驱动
    • 2.3 cloudera-manager包
    • 2.4 parcel数据包
    • 2.5 目录树
  • 三、初始化主机环境
    • 3.1 设置主机名
    • 3.2 关闭防火墙和Selinux
    • 3.3 启动NTP服务
  • 四、安装
    • 4.1 搭建本地yum源
    • 4.2 安装jdk
    • 4.3 安装MySQL
    • 4.4 安装Cloudera Manager
    • 4.5 配置本地Parcel存储库
    • 4.6 初始化scm库
    • 4.7 启动CM
  • 五、初始化CM
  • 六、后续优化

官网文档

一、主机

服务器的运行内存还是不要太小,很多服务例如Impala、Spark特别吃内存。如果上线生产环境,推荐128G保底。

主机 IP 内存 硬盘
master 192.168.0.31 16G 500G
tools 192.168.0.32 16G 500G
gateway 192.168.0.33 16G 500G
worker 192.168.0.34 16G 500G

主机角色划分

  • master

安装例如HDFS的NameNode、Hbase的Master server、YARN的ResourceManager等比较重要的组件。

  • tools

安装例如CM、Hue、Sqoop等工具辅助类组件。

  • gateway

安装例如HDFS的JournalNode、Hbase的HBase REST Server等集群间通讯类组件。

  • worker

安装例如HDFS的DataNode、Hbase的RegionServer、Kudu的tablet等用来存储数据的工作组件。

二、准备安装包

2.1 MySQL 5.7.27

mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar

2.2 MySQL驱动

mysql-connector-java-5.1.47.tar.gz

2.3 cloudera-manager包

cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm
cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm
cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm
cloudera-manager-server-db-2-6.3.0-1281944.el7.x86_64.rpm
enterprise-debuginfo-6.3.0-1281944.el7.x86_64.rpm
oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
allkeys.asc

2.4 parcel数据包

CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel
manifest.json

2.5 目录树

将这些安装包上传到tools主机上

[root@localhost ~]# tree -C cloudera/
cloudera/
├── cloudera-manager
│   ├── allkeys.asc
│   ├── cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm
│   ├── cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm
│   ├── cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm
│   ├── cloudera-manager-server-db-2-6.3.0-1281944.el7.x86_64.rpm
│   ├── enterprise-debuginfo-6.3.0-1281944.el7.x86_64.rpm
│   └── oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
├── mysql
│   └── mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
├── mysql-jdbc
│   └── mysql-connector-java-5.1.47.tar.gz
└── parcel
    ├── CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel
    └── manifest.json

4 directories, 11 files

三、初始化主机环境

先安装一些基本工具

yum install -y vim wget ntp net-tools

3.1 设置主机名

给四台主机分别设置主机名

hostnamectl set-hostname master.cdh
hostnamectl set-hostname tools.cdh
hostnamectl set-hostname gateway.cdh
hostnamectl set-hostname worker.cdh

每台主机修改/etc/hosts文件,追加

192.168.0.31 master.cdh
192.168.0.32 tools.cdh
192.168.0.33 gateway.cdh
192.168.0.34 worker.cdh

修改每台主机的/etc/sysconfig/network文件,分别追加

HOSTNAME=master.cdh
HOSTNAME=tools.cdh
HOSTNAME=gateway.cdh
HOSTNAME=worker.cdh

使用uname -a && hostname命令查看主机名

3.2 关闭防火墙和Selinux

每台主机关闭防火墙

systemctl stop firewalld \
&& systemctl disable firewalld \
&& systemctl status firewalld 

每台主机关闭Selinux

setenforce 0 #临时关闭
vim /etc/selinux/config #永久关闭
# SELINUX=enforcing 改成 SELINUX=permissive
getenforce #查看状态为Permissive

3.3 启动NTP服务

关闭chrony服务,该服务会影响到NTP服务的开机启动

systemctl stop chronyd && systemctl disable chronyd

设置NTP服务

vim /etc/ntp.conf
# 将时钟服务器更改为如下4个
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org	
server 3.cn.pool.ntp.org

启动时间同步服务器

systemctl start ntpd \
&& systemctl enable ntpd \
&& ntpdate -u 0.cn.pool.ntp.org \
&& hwclock --systohc \
&& date

四、安装

在tools主机上操作

4.1 搭建本地yum源

yum -y install httpd createrepo \
&& systemctl start httpd \
&& systemctl enable httpd \
&& cd /root/cloudera/cloudera-manager/ \
&& createrepo . \
&& mv /root/cloudera/cloudera-manager/ /var/www/html/

访问:http://192.168.0.32/cloudera-manager/

4.2 安装jdk

cd /var/www/html/cloudera-manager/;rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm

4.3 安装MySQL

卸载自带的mariadb

yum -y remove mariadb-libs

解压下载的MySQL包

cd /root/cloudera/mysql/;tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar

安装MySQL

yum install -y libaio \
&& rpm -ivh mysql-community-common-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-libs-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-libs-compat-5.7.27-1.el7.x86_64.rpm

配置my.cnf

echo character-set-server=utf8 >> /etc/my.cnf 

数据库授权

(
cat <<EOF
set password for root@localhost = password('123456Aa.');
grant all privileges on *.* to 'root'@'%' identified by '123456Aa.';
flush privileges;
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '123456Aa.';
SHOW DATABASES;
EOF
) >> /root/c.sql

启动MySQL

systemctl enable mysqld && systemctl start mysqld && grep password /var/log/mysqld.log | sed 's/.*\(............\)$/\1/'

执行脚本

[root@tools ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.27

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source /root/c.sql
Query OK, 0 rows affected, 1 warning (0.00 sec)

配置mysql jdbc驱动

mkdir -p /usr/share/java/ \
&& cd /root/cloudera/mysql-jdbc/;tar -zxvf mysql-connector-java-5.1.47.tar.gz \
&& cp /root/cloudera/mysql-jdbc/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar /usr/share/java/mysql-connector-java.jar

4.4 安装Cloudera Manager

tools主机配置本地yum源

(
cat <<EOF
[cloudera-manager]
name=Cloudera Manager 6.3.0
baseurl=http://192.168.0.32/cloudera-manager/
gpgcheck=0
enabled=1
EOF
) >> /etc/yum.repos.d/cloudera-manager.repo \
&& yum clean all \
&& yum makecache 

安装Cloudera Manager

yum install -y cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server

4.5 配置本地Parcel存储库

mv /root/cloudera/parcel/* /opt/cloudera/parcel-repo
cd /opt/cloudera/parcel-repo/
sha1sum CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel | awk '{ print $1 }' > CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha
chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/*

4.6 初始化scm库

执行scm_prepare_database.sh脚本

/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm 123456Aa.

4.7 启动CM

systemctl start cloudera-scm-server \
&& sleep 2 \
&& tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log | grep "INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server"

出现INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server则启动成功
访问http://192.168.0.32:7180
账号密码为admin/admin

五、初始化CM

欢迎界面,下一步
CDH6.3集群部署--研发环境安装实录_第1张图片
用户许可,同意,下一步
CDH6.3集群部署--研发环境安装实录_第2张图片
选择试用版60天到期,不用白不用,下一步
CDH6.3集群部署--研发环境安装实录_第3张图片
欢迎界面,下一步
CDH6.3集群部署--研发环境安装实录_第4张图片
设置集群名称,下一步
CDH6.3集群部署--研发环境安装实录_第5张图片
选择网络中的主机,下一步
CDH6.3集群部署--研发环境安装实录_第6张图片
输入本地yum源地址,下一步
CDH6.3集群部署--研发环境安装实录_第7张图片
同意jdk使用许可,下一步
CDH6.3集群部署--研发环境安装实录_第8张图片
输入其他主机密码,下一步
CDH6.3集群部署--研发环境安装实录_第9张图片
每台主机安装agent,安装完毕,下一步
CDH6.3集群部署--研发环境安装实录_第10张图片
安装Parcels包,安装完毕,下一步
CDH6.3集群部署--研发环境安装实录_第11张图片
主机健康检查,下一步,报错解决方法 https://blog.csdn.net/qq_39680564/article/details/100013275
CDH6.3集群部署--研发环境安装实录_第12张图片
选择安装的服务,下一步
CDH6.3集群部署--研发环境安装实录_第13张图片
自行分配角色至主机,下一步
CDH6.3集群部署--研发环境安装实录_第14张图片
测试数据库链接,下一步
CDH6.3集群部署--研发环境安装实录_第15张图片
配置实例的安装位置,数据目录尽量安装在大的分区下
CDH6.3集群部署--研发环境安装实录_第16张图片
安装服务,下一步
CDH6.3集群部署--研发环境安装实录_第17张图片
安装完成
CDH6.3集群部署--研发环境安装实录_第18张图片
CDH6.3集群部署--研发环境安装实录_第19张图片

六、后续优化

hive设置:https://blog.csdn.net/qq_39680564/article/details/101015864
Spark设置:https://blog.csdn.net/qq_39680564/article/details/101209640
root权限:https://blog.csdn.net/qq_39680564/article/details/101216414

你可能感兴趣的:(Hadoop_CDH)