主机名 IP 角色
MASTER 192.168.0.64 Hadoop Master,CM Server,Data Node
SLAVE01 192.168.0.62 Data Node,MySQL,CM Agent
SLAVE02 192.168.0.63 Data Node,CM Agent
▼▼▼
[root@SLAVE01 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.62 SLAVE01
192.168.0.63 SLAVE02
192.168.0.64 MASTER
▼▼▼
[root@SLAVE01 ~]# service iptables stop
[root@SLAVE01 ~]# chkconfig iptables off
▼▼▼
[root@SLAVE01 ~]# cat /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
在 SLAVE 节点中的配置文件添加如下内容:
MASTER 节点开启 ntpd 服务:
SLAVE 节点执行如下命令:
▼▼▼
[root@SLAVE01 ~]# ntpdate master
1 Apr 20:54:11 ntpdate[3467]: adjust time server 192.168.0.64 offset -0.000141 sec
[root@SLAVE01 ~]# service ntpd start
Starting ntpd: [ OK ]
[root@SLAVE01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
MASTER LOCAL(0) 6 u 12 64 1 0.823 0.135 0.000
三台节点追加如下参数,并立即生效:
▼▼▼
[root@SLAVE01 ~]# vim /etc/sysctl.conf
vm.swappiness = 0
[root@SLAVE01 ~]# sysctl -p
[root@SLAVE01 ~]# echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
[root@SLAVE01 ~]# echo echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag >> /etc/rc.local
▼▼▼
[root@SLAVE01 ~]# python -V
Python 2.6.6
▼▼▼
[root@MASTER ~]# rpm -q chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi
chkconfig-1.3.49.3-2.el6_4.1.x86_64
python-2.6.6-51.el6.x86_64
bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64
psmisc-22.6-15.el6_0.1.x86_64
libxslt-1.1.26-2.el6_3.1.x86_64
zlib-1.2.3-29.el6.x86_64
sqlite-3.6.20-1.el6.x86_64
cyrus-sasl-plain-2.1.23-13.el6_3.1.x86_64
cyrus-sasl-gssapi-2.1.23-13.el6_3.1.x86_64
▼▼▼
[root@SLAVE01 ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-devel-5.1.71-1.el6.x86_64
[root@SLAVE01 ~]# rpm -e mysql-devel-5.1.71-1.el6.x86_64
[root@SLAVE01 ~]# rpm -e mysql
[root@SLAVE01 ~]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
[root@SLAVE01 ~]# rpm -qa | grep mysql
安装 MySQL
▼▼▼
[root@SLAVE01 ~]# tar -xvf ./MySQL-5.6.27-1.el6.x86_64.rpm-bundle.tar
[root@SLAVE01 ~]# rpm -ivh MySQL-*.rpm
▼▼▼
[root@SLAVE01 ~]# cat /root/.mysql_secret
# The random password set for the root user at Sun Apr 1 21:22:17 2018 (local time): KYFVIGg8KErbhsCE
启动 MySQL
▼▼▼
[root@SLAVE01 ~]# /usr/bin/mysqld_safe &
更改 MySQL root 用户的密码
▼▼▼
[root@SLAVE01 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.6.27
Copyright (c) 2000, 2015, 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> SET PASSWORD FOR root@localhost = PASSWORD(123456);
Query OK, 0 rows affected (0.00 sec)
创建需要用到的数据库
▼▼▼
mysql> create database scm;
Query OK, 1 row affected (0.00 sec)
mysql> create database hive;
Query OK, 1 row affected (0.00 sec)
mysql> create database rm;
Query OK, 1 row affected (0.00 sec)
mysql> create database oozie;
Query OK, 1 row affected (0.00 sec)
创建集群用户,并赋予相关权限
▼▼▼
mysql> CREATE USER cdh@% IDENTIFIED BY 123456;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON *.* TO cdh@%;
Query OK, 0 rows affected (0.00 sec)
▼▼▼
[root@SLAVE01 ~]# useradd --system --home=/opt/cloudera-manager/cm-5.5.0/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
▼▼▼
mkdir /opt/cloudera-manager
mkdir -p /opt/cloudera/parcel-repo
mkdir -p /opt/cloudera/parcels
mkdir -p /var/log/cloudera-scm-headlamp
mkdir -p /var/log/cloudera-scm-firehose
mkdir -p /var/log/cloudera-scm-alertpublisher
mkdir -p /var/log/cloudera-scm-eventserver
mkdir -p /var/lib/cloudera-scm-headlamp
mkdir -p /var/lib/cloudera-scm-firehose
mkdir -p /var/lib/cloudera-scm-alertpublisher
mkdir -p /var/lib/cloudera-scm-eventserver
mkdir -p /var/lib/cloudera-scm-server
chown cloudera-scm:cloudera-scm /opt/cloudera-manager
chown -R cloudera-scm:cloudera-scm /var/log/cloudera-*
chown -R cloudera-scm:cloudera-scm /var/lib/cloudera-*
chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo
chown cloudera-scm:cloudera-scm /opt/cloudera/parcels
▼▼▼
[root@SLAVE01 ~]# tar -xzf cloudera-manager-el6-cm5.5.0_x86_64.tar.gz -C /opt/cloudera-manager
[root@SLAVE01 ~]# chown cloudera-scm:cloudera-scm /opt/cloudera-manager
将 MySQL JDBC 驱动拷贝至对应目录中
▼▼▼
[root@SLAVE01 ~]# mkdir -p /usr/share/java
[root@SLAVE01 ~]# cp mysql-connector-java-5.1.38.jar /usr/share/java/
[root@SLAVE01 ~]# mkdir -p /usr/lib/hive/lib/
[root@SLAVE01 ~]# cp mysql-connector-java-5.1.38.jar /usr/lib/hive/lib/
▼▼▼
[root@SLAVE01 ~]# rpm -ivh jdk-7u80-linux-x64.rpm
在 /etc/profile 中配置 java 环境变量,并立即生效
▼▼▼
[root@SLAVE01 ~]# vim /etc/profile
export JAVA_HOME=/usr/java/default
export CLASS_PATH=./:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
[root@SLAVE01 ~]# source /etc/profile
检查 jdk 是否安装成功
▼▼▼
[root@SLAVE01 ~]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
▼▼▼
[root@MASTER ~]# cd /opt/cloudera-manager/cm-5.5.0/share/cmf/schema/
[root@MASTER schema]# ./scm_prepare_database.sh -h SLAVE01 -P 3306 mysql scm cdh 123456
▼▼▼
[root@SLAVE01 ~]# cd /opt/cloudera-manager/cm-5.5.0/etc/cloudera-scm-agent/
[root@SLAVE01 cloudera-scm-agent]# vim config.ini
修改为对应的 CM Server 所在的节点
server_host=MASTER
▼▼▼
[root@MASTER ~]# mv CDH-5.5.0-1.cdh5.5.0.p0.8-el6.parcel /opt/cloudera/parcel-repo/
[root@MASTER ~]# mv manifest.json /opt/cloudera/parcel-repo/
[root@MASTER ~]# mv CDH-5.5.0-1.cdh5.5.0.p0.8-el6.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.5.0-1.cdh5.5.0.p0.8-el6.parcel.sha
启动 CM Server
▼▼▼
[root@MASTER ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-server start
Starting cloudera-scm-server: [ OK ]
启动 CM Agent
▼▼▼
[root@MASTER ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK ]
[root@SLAVE01 cloudera-scm-agent]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK ]
[root@SLAVE02 ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK ]
版本可选择 Cloudera Enterprise Data Hub Edition Trial ,试用期60天过后,自动降为 Express 版本。
在当前管理的主机界面中,可以看到三个节点 MASTER、SLAVE01、SLAVE02。
在组件安装选择界面,选择 含Impala的内核即可。
组件规划上,由于是测试环境,因此 DataNode 选择所有主机。
数据库安装界面,规划如下:
▼▼▼
SLAVE01 DB Name:hive Username:cdh Password:123456
SLAVE01 DB Name:rm Username:cdh Password:123456
SLAVE01 DB Name:oozie Username:cdh Password:123456
集群搭建结束之后,出现了 Network Interface Speed 问题,应该是网络接口速度导致的,修改了相关配置之后,避免了该问题。
▼▼▼
Change Hosts Network Interfaces Slow Link Modes Thresholds for all hosts.
▼▼▼
[root@MASTER ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-agent stop
Stopping cloudera-scm-agent: [ OK ]
[root@MASTER ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-server stop
Stopping cloudera-scm-server: [ OK ]
[root@SLAVE01 ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-agent stop
Stopping cloudera-scm-agent: [ OK ]
[root@SLAVE02 ~]# /opt/cloudera-manager/cm-5.5.0/etc/init.d/cloudera-scm-agent stop
Stopping cloudera-scm-agent: [ OK ]
更多精彩干货分享
点击下方名片关注
IT那活儿
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/129922.html
Docker是一个开源容器引擎,可以轻松地在任何地方打包,运行和分发应用程序. 在Docker上安装CDH有以下几个步骤: 安装Docker: 在你的操作系统上安装Docker。如果你还没有安装Docker,请参考Docker官方文档来安装Docker。 下载CDH镜像: 使用以下命令下载CDH镜像: Copy codedocker pull cloudera/quickstart:l...
阅读 1250·2023-01-11 13:20
阅读 1559·2023-01-11 13:20
阅读 1013·2023-01-11 13:20
阅读 1680·2023-01-11 13:20
阅读 3972·2023-01-11 13:20
阅读 2520·2023-01-11 13:20
阅读 1356·2023-01-11 13:20
阅读 3486·2023-01-11 13:20