阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 7.2下搭建CDH5.8.3

226次阅读
没有评论

共计 6799 个字符,预计需要花费 17 分钟才能阅读完成。

1. 基本环境:

操作系统:

CentOS 7.2.1511

jdk 环境

版本:jdk-8u45-linux-x64.rpm

mysql 环境:

rpm 包:http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar

jdbc 链接包:http://101.96.10.72/cdn.mysql.com//Downloads/Connector-J/mysql-connector-Java-5.1.40.tar.gz

CDH 安装相关的包:

cloudera manager 包:http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.8.3_x86_64.tar.gz

CDH 包:http://archive.cloudera.com/cdh5/parcels/5.8.3/CDH-5.8.3-1.cdh5.8.3.p0.2-el7.parcel.sha1

http://archive.cloudera.com/cdh5/parcels/5.8.3/CDH-5.8.3-1.cdh5.8.3.p0.2-el7.parcel

http://archive.cloudera.com/cdh5/parcels/5.8.3/manifest.json

集群规划

IP 地址 主机名说明

192.168.50.123Hadoop1 主节点 master,datanode

192.168.50.124hadoop2datanode

192.168.50.125hadoop3 datanode

开始安装前配置

1. 安装 jdk(每个机器都要装)

安装前要先卸载掉原有的 jdk 版本,避免造成冲突

2. 修改三个机器上面的 hosts

192.168.50.123  hadoop1

192.168.50.124  hadoop2

192.168.50.125  hadoop3

3. 同步时间

ntpdate -s  pool.ntp.org

4. 关闭防火墙和 selinux

sed -i ‘s/SELINUX=.*/SELINUX=disabled/’ /etc/selinux/config  #重启机器

systemctl stop firewalld

systemctl disable firewalld

5. 配置 ssh 无密码登陆

[root@localhost ~]# ssh-keygen  -t rsa -P ”
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
62:b0:4c:aa:e5:37:92:89:4d:db:c3:38:e2:f1:2a:d6 root@admin-node
The key’s randomart image is:
+–[RSA 2048]—-+
|                |
|                |
|    o            |
|  + o          |
|  + o o S        |
| B B . .        |
|+.@ *            |
|oooE o          |
|oo..            |
+—————–+

ssh-copy-id hadoop1

ssh-copy-id hadoop2

ssh-copy-id hadoop3

6. 安装 mysql

[root@hadoop1]#tar -xvf MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar
[root@hadoop1]#rpm -ivh MySQL-*.rpm
修改配置文件路径:cp /usr/share/mysql/my-default.cnf /etc/my.cnf

# 配置 mysql

[root@hadoop1]#vim /etc/my.cnf
[mysqld]
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = ‘SET NAMES utf8’
character-set-server = utf8

# 初始化数据库

/usr/local/mysql/scripts/mysql_install_db  –basedir=/usr/local/mysql/ –datadir=/data/mysql/ –user=mysql  >>/dev/null

# 启动 mysql

service mysqld start
chkconfig mysqld on

– 查看 mysql root 初始化密码

[root@hadoop1]# cat /root/.mysql_secret
# The random password set for the root user at Fri Sep 16 11:13:25 2016 (local time): 9mp7uYFmgt6drdq3
– 登录进行去更改密码
[root@hadoop1]# mysql -u root -p
mysql> SET PASSWORD=PASSWORD(‘123456’);
– 允许 mysql 远程访问
mysql> grant all on *.* to root@”%” Identified by “www.123”;
Query OK, 1 row affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

创建 cdh 所需要的库

create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
 create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

7. 第三方依赖包安装(所有节点都安装)

1 yum install chkconfig Python bind-utils psmisc libxslt zlib sqlite fuse fuse-libs RedHat-lsb cyrus-sasl-plain cyrus-sasl-gssapi

注意这个地方依赖包不安装完下面启动集群的时候会死活启动不了的,这是血的教训啊!

在 hadoop1 上准备 mysql 的 jar 包

[root@hadoop1]# mkdir -p /usr/share/java
修改 jar 包的名字,并拷贝到 /usr/share/java/ 目录
[root@hadoop1]# cp mysql-connector-java-5.1.40-bin.jar /usr/share/java/mysql-connector-java.jar

8. 安装 Cloudera-Manager

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

[root@hadoop1 ~]#mkdir /opt/cloudera-manager
[root@hadoop1 ~]# tar -axvf cloudera-manager-centos7-cm5.8.3_x86_64.tar.gz -C /opt/cloudera-manager

创建 cloudera-scm 用户(所有节点)

[root@hadoop1 ~]# useradd -r -d /opt/cloudera-manager/cm-5.8.3/run/cloudera-scm-server -M -c “Cloudera SCM User” cloudera-scm

在 hadoop2 和 hadoop3 配置 agent

vim /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-agent/config.ini
将 server_host 改为 CMS 所在的主机名即 hadoop1

主节点中创建 parcel-repo 仓库

[root@hadoop1 ~]# chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo
[root@hadoop1 ~]# mv CDH-5.8.3-1.cdh5.8.3.p0.2-el7.parcel.sha1  CDH-5.8.3-1.cdh5.8.3.p0.2-el7.parcel.sha
[root@hadoop1 ~]# cp CDH-5.8.3-1.cdh5.8.3.p0.2-el7.parcel CDH-5.8.3-1.cdh5.8.3.p0.2-el7.parcel.sha manifest.json /opt/cloudera/parcel-repo

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

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

[root@hadoop1 ~]# /opt/cloudera-manager/cm-5.8.3/share/cmf/schema/scm_prepare_database.sh  mysql -h hadoop1 -P 3306 -uroot -pwww.123 –scm-host master scm scm scm
JAVA_HOME=/usr/java/jdk1.8.0_45
Verifying that we can write to /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-server
Creating SCM configuration file in /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-server
Executing:  /usr/java/jdk1.8.0_45/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/Oracle-connector-java.jar:/opt/cloudera-manager/cm-5.8.3/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
[main] DbCommandExecutor              INFO  Successfully connected to database.
All done, your SCM database is configured correctly!

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

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

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

-uroot:root 身份运行 mysql。-123456:mysql 的 root 密码是 ***。

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

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

10. 在各个节点启动 agent 服务

/opt/cloudera-manager/cm-5.8.3/etc/init.d/cloudera-scm-agent start

在 master 启动 server 服务

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

浏览器访问

http://192.168.50.123:7180/cmf/login  用户名 admin 密码 admin

问题 1:

service cloudera-scm-server status

cloudera-scm-server dead but pid file exists

解决

[root@master cm-5.8.3]# rm /root/hadoop/cm-5.8.3/run/cloudera-scm-server.pid

[root@master hadoop]# ./cm-5.8.3/etc/init.d/cloudera-scm-server restart

cloudera-scm-server is already stopped

Starting cloudera-scm-server:                              [OK]

问题 2:

2016-12-08 03:40:57,479 ERROR WebServerImpl:com.cloudera.server.web.cmf.search.components.SearchRepositoryManager: The server storage directory [/var/lib/cloudera-scm-server] doesn’t exist.

2016-12-08 03:40:57,479 ERROR WebServerImpl:com.cloudera.server.web.cmf.search.components.SearchRepositoryManager: No read permission to the server storage directory [/var/lib/cloudera-scm-server]

2016-12-08 03:40:57,479 ERROR WebServerImpl:com.cloudera.server.web.cmf.search.components.SearchRepositoryManager: No write permission to the server storage directory [/var/lib/cloudera-scm-server]

解决:

创建目录并加上权限以后成功

mkdir /var/lib/cloudera-scm-server

chown -R cloudera-scm.cloudera-scm /var/lib/cloudera-scm-server

问题 3:在 CDH 检查主机哪里会有两个警告

解决:

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

echo 10 > /proc/sys/vm/swappiness

CDH 的安装和设置 http://www.linuxidc.com/Linux/2017-02/140707.htm

yum 安装 CDH5.5 Hadoop 集群 http://www.linuxidc.com/Linux/2017-02/140186.htm

CDH5.9.0 集群部署与搭建 http://www.linuxidc.com/Linux/2017-01/139615.htm

CDH5.7.2 离线部署笔记 http://www.linuxidc.com/Linux/2016-08/133924.htm

Cloudera Manager 5 和 CDH5 离线安装  http://www.linuxidc.com/Linux/2016-07/133360.htm

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-03/141294.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计6799字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中