您好,登录后才能下订单哦!
温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。
1.概述
本文档主要描述离线环境下,CentOS6.5操作系统部署CDH5.12.1企业版的过程。本安装文档主要分为4个步骤:
1.前期准备(包括hostname、关闭防火墙、关闭SELinux、时钟同步等)
2.安装Cloudera Manager Server
3.安装CDH集群
4.集群完整性检查(包括HDFS文件系统、MapReduce、Hive等服务是否可以正常运行)
这篇文档将着重介绍Cloudera管理器与CDH的安装,并基于以下假设:
1.操作系统版本:CentOS6.5
2.MySQL版本:5.1.73
3.CM版本:CM 5.12.1
4.CDH版本:CDH 5.12.1
5.采用root对集群进行部署
6.您已经下载CDH和CM的安装包(CDH使用parcels包方式安装)
2.前期准备
2.1hostname及hosts配置
集群中各个节点之间能互相通信使用静态IP地址。IP地址和主机名通过/etc/hosts配置,主机名/etc/hostname进行配置(推荐hostname使用FQDN完全域名的方式配置)。
以服务器(172.31.6.148)为例:
修改/etc/sysconfig/network文件:
[root@ip-172-31-6-148~]# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=ip-172-31-6-148.fayson.com
注意:修改hostname后需要重启服务器。
检查hostname是否修改成功:
[root@ip-172-31-6-148~]# hostname
ip-172-31-6-148.fayson.com
[root@ip-172-31-6-148 ~]#
/etc/hosts文件如下:
[root@ip-172-31-6-148~]# more /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
172.31.6.148 ip-172-31-6-148.fayson.com
172.31.5.190 ip-172-31-5-190.fayson.com
172.31.10.118 ip-172-31-10-118.fayson.com
172.31.9.33 ip-172-31-9-33.fayson.com
[root@ip-172-31-6-148 ~]#
以上两步操作,在集群中其它节点做相应配置。
2.2禁用SELinux
在所有节点执行sudo setenforce 0 命令
[root@ip-172-31-6-148~]# sudo setenforce 0
修改集群所有节点的/etc/selinux/config文件,内容如下:
[root@ip-172-31-6-148~]# vim /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
2.3关闭防火墙
在集群所有节点执行如下操作,并永久关闭防火墙
[root@ip-172-31-6-148~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@ip-172-31-6-148 ~]# chkconfig iptables off
[root@ip-172-31-6-148 ~]#
2.4配置操作系统本地yum源
[root@ip-172-31-6-148~]# mkdir /mnt/iso
[root@ip-172-31-6-148 ~]# mount -o loop CentOS-6.5-x86_64-minimal.iso/mnt/iso/
[root@ip-172-31-6-148 ~]# df -h
Filesystem Size UsedAvail Use% Mounted on
/dev/xvde 99G 3.4G 91G 4% /
tmpfs 7.4G 0 7.4G 0%/dev/shm
/root/CentOS-6.5-x86_64-minimal.iso 398M 398M 0 100% /mnt/iso
[root@ip-172-31-6-148 ~]#
[root@ip-172-31-6-148~]# vim /etc/yum.repos.d/os.repo
localrepo
name=CentOS6.5
baseurl=file:///mnt/iso
gpgcheck=false
enabled=true
查看yum源列表是否有新建的localrepo
[root@ip-172-31-6-148~]# yum repolist
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: mirror.0x.sg
* extras: mirror.0x.sg
* updates: mirror.0x.sg
localrepo | 3.6 kB 00:00...
localrepo/primary_db | 492 kB 00:00 ...
repo id reponame status
base CentOS-6 - Base 6,706
cloudera-manager Cloudera Manager, Version 5.12.0 7
cmrepo cm_repo 7
extras CentOS-6 - Extras 45
localrepo CentOS6.5 248
updates CentOS-6 - Updates 589
repolist: 7,602
[root@ip-172-31-6-148 ~]#
2.5安装http服务
在集群其中一节点上安装http服务,执行如下命令:
[root@ip-172-31-6-148~]# yum -y install httpd
如上图所示则表明安装成功。
[root@ip-172-31-6-148~]# chkconfig --add httpd
[root@ip-172-31-6-148 ~]# chkconfig httpd on
[root@ip-172-31-6-148 ~]# chkconfig --list |grep httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@ip-172-31-6-148 ~]#
[root@ip-172-31-6-148~]# service httpd start
Starting httpd: [ OK ]
2.6重做操作系统yum源
在2.5安装了httpd服务后,重新制作操作系统的yum源,使用http的方式,操作如下:
_root@ip-172-31-6-148_html# mkdir centos6.5
[root@ip-172-31-6-148 html]# ll
total 4
drwxr-xr-x 2 rootroot 4096 Sep 4 16:04 centos6.5
[root@ip-172-31-6-148 html]#
_root@ip-172-31-6-148_html# scp -r /mnt/iso/*/var/www/html/centos6.5/
[root@ip-172-31-6-148~]# vim /etc/yum.repos.d/os.repo
localrepo
name=CentOS6.5
baseurl=http://ip-172-31-6-148.fayson.com/centos6.5
gpgcheck=false
enabled=true
将/etc/yum.repo.d/os.repo配置文件同步到集群所有节点的/etc/yum.repo.d/目录下
2.7集群时钟同步
在集群的所有服务器上安装ntp服务,用于集群时钟同步,此处选择ip-172-31-6-148.fayson.com服务器作为本地NTP服务器,集群其它节点与其保持同步,配置如下:
[root@ip-172-31-6-148~]# yum -y install ntp
如上图显示,则说明安装成功。
在所有节点执行如下操作:
[root@ip-172-31-6-148~]# chkconfig --add ntpd
[root@ip-172-31-6-148 ~]# chkconfig ntpd on
[root@ip-172-31-6-148~]# vim /etc/ntp.conf
...
#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 #local clock
fudge 127.127.1.0 stratum 10
[root@ip-172-31-5-190~]# vim /etc/ntp.conf
...
#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 172.31.6.148 iburst
[root@ip-172-31-6-148~]# service ntpd restart
Shutting down ntpd: [ OK ]
Starting ntpd: [ OK ]
[root@ip-172-31-6-148 ~]#
[root@ip-172-31-6-148~]# ntpq -p
remote refid stt when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 10 l 15 64 7 0.000 0.000 0.001
[root@ip-172-31-6-148 ~]# ssh -i fayson.pem.txtip-172-31-5-190.fayson.com "ntpq-p"
remote refid st t when pollreach delay offset jitter
==============================================================================
*ip-172-31-6-148 LOCAL(0) 11 u 68 128 377 0.274 1.005 0.243
[root@ip-172-31-6-148 ~]# ssh -i fayson.pem.txtip-172-31-10-118.fayson.com "ntpq-p"
remote refid stt when poll reach delay offset jitter
==============================================================================
*ip-172-31-6-148 LOCAL(0) 11 u 75 128 377 0.285 1.214 0.213
[root@ip-172-31-6-148 ~]# ssh -i fayson.pem.txt ip-172-31-9-33.fayson.com"ntpq -p"
remote refid stt when poll reach delay offset jitter
==============================================================================
*ip-172-31-6-148 LOCAL(0) 11 u 1 64 367 0.294 -9.249 1.511
[root@ip-172-31-6-148 ~]#
注:标记部分,有“*”显示则表示同步成功。
2.8安装MySQL
[root@ip-172-31-6-148~]# yum -y install mysql mysql-server
如上截图则表示MySQL安装成功。
[root@ip-172-31-6-148~]# chkconfig --add mysqld
[root@ip-172-31-6-148 ~]# chkconfig mysqld on
[root@ip-172-31-6-148~]# service mysqld start
...
[ OK ]
Starting mysqld: [ OK ]
[root@ip-172-31-6-148~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTIONUSE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the passwordwill be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? Y/n y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing,and to make the installation
go a bit smoother. You should removethem before moving into a
production environment.
Remove anonymous users? Y/n y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? Y/n n
... skipping.
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only fortesting, and should be removed
before moving into a production environment.
Remove test database and access to it? Y/n y
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? Y/n y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for usingMySQL!
[root@ip-172-31-6-148 ~]#
注意:标红部分为输入项,出现“Thanks for using MySQL!”则表示初始化成功。
建库语句:
create database metastore default character set utf8;
CREATE USER 'hive'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON metastore. * TO 'hive'@'%';
FLUSH PRIVILEGES;
create database cm default character set utf8;
CREATE USER 'cm'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON cm. * TO 'cm'@'%';
FLUSH PRIVILEGES;
create database am default character set utf8;
CREATE USER 'am'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON am. * TO 'am'@'%';
FLUSH PRIVILEGES;
create database rm default character set utf8;
CREATE USER 'rm'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON rm. * TO 'rm'@'%';
FLUSH PRIVILEGES;
create database hue default character set utf8;
CREATE USER 'hue'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON hue. * TO 'hue'@'%';
FLUSH PRIVILEGES;
create database oozie default character set utf8;
CREATE USER 'oozie'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON oozie. * TO 'oozie'@'%';
FLUSH PRIVILEGES;
命令行操作如下:
[root@ip-172-31-6-148~]# mysql -uroot -p
Enter password:
...
mysql> create database metastore default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'hive'@'%' IDENTIFIEDBY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON metastore. * TO 'hive'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> create databasecm default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'cm'@'%' IDENTIFIEDBY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON cm. * TO 'cm'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql_> create database_am default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'am'@'%' IDENTIFIEDBY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON am. * TO 'am'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> create databaserm default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'rm'@'%' IDENTIFIEDBY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON rm. * TO 'rm'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> create databasehue default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'hue'@'%' IDENTIFIEDBY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON hue. * TO 'hue'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> create databaseoozie default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'oozie'@'%' IDENTIFIEDBY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON oozie. * TO 'oozie'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
[root@ip-172-31-6-148~]# mkdir -p /usr/share/java
[root@ip-172-31-6-148 ~]# mv mysql-connector-java-5.1.34.jar/usr/share/java/
[root@ip-172-31-6-148 ~]# cd /usr/share/java/
[root@ip-172-31-6-148 java]# ln -s mysql-connector-java-5.1.34.jar mysql-connector-java.jar
[root@ip-172-31-6-148 java]# ll
total 940
-rwxr-xr-x. 1 root root 960372 Aug 30 15:16 mysql-connector-java-5.1.34.jar
lrwxrwxrwx 1root root 31 Sep 4 16:32 mysql-connector-java.jar -> mysql-connector-java-5.1.34.jar
[root@ip-172-31-6-148 java]#
3.Cloudera Manager安装
3.1配置CM本地repo源
CM5.12.1下载地址:
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/cloudera-manager-agent-5.12.1-1.cm5121.p0.6.el6.x86\_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/cloudera-manager-daemons-5.12.1-1.cm5121.p0.6.el6.x86\_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/cloudera-manager-server-5.12.1-1.cm5121.p0.6.el6.x86\_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/cloudera-manager-server-db-2-5.12.1-1.cm5121.p0.6.el6.x86\_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/enterprise-debuginfo-5.12.1-1.cm5121.p0.6.el6.x86\_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/jdk-6u31-linux-amd64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86\_64/cm/5.12.1/RPMS/x86\_64/oracle-j2sdk1.7-1.7.0+update67-1.x86\_64.rpm
[root@ip-172-31-6-148~]# mkdir -p /var/www/html/cm5.12.1
[root@ip-172-31-6-148 ~]# cd /var/www/html/cm5.12.1/
[root@ip-172-31-6-148 cm5.12.1]# ll
total 942088
-rw-r--r-- 1 rootroot 9676820 Aug 30 14:45cloudera-manager-agent-5.12.1-1.cm5121.p0.6.el6.x86_64.rpm
-rw-r--r-- 1 rootroot 709818804 Aug 30 14:45 cloudera-manager-daemons-5.12.1-1.cm5121.p0.6.el6.x86_64.rpm
-rw-r--r-- 1 rootroot 8692 Aug 30 14:45cloudera-manager-server-5.12.1-1.cm5121.p0.6.el6.x86_64.rpm
-rw-r--r-- 1 rootroot 10600 Aug 30 14:45cloudera-manager-server-db-2-5.12.1-1.cm5121.p0.6.el6.x86_64.rpm
-rw-r--r-- 1 rootroot 31918952 Aug 30 14:45enterprise-debuginfo-5.12.1-1.cm5121.p0.6.el6.x86_64.rpm
-rw-r--r-- 1 rootroot 71204325 Aug 30 14:45jdk-6u31-linux-amd64.rpm
-rw-r--r-- 1 rootroot 142039186 Aug 30 14:45 oracle-j2sdk1.7-1.7.0+update67-1.x86_64.rpm
[root@ip-172-31-6-148 cm5.12.1]#
[root@ip-172-31-6-148 cm5.12.1]# pwd
/var/www/html/cm5.12.1
[root@ip-172-31-6-148 cm5.12.1]#createrepo .
Spawning worker 0 with 7 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@ip-172-31-6-148 cm5.12.1]#
[root@ip-172-31-6-148~]# vim /etc/yum.repos.d/cm.repo
cmrepo
name=CM5.12.1
baseurl=http://ip-172-31-6-148.fayson.com/cm5.12.1
gpgcheck=false
enabled=true
[root@ip-172-31-6-148~]# yum repolist
...
cmrepo CM5.12.1 7
localrepo CentOS6.5 248
[root@ip-172-31-6-148 ~]#yum -y install oracle-j2sdk1.7-1.7.0+update67-1
3.2配置http访问CDH Parcel包
CDH5.12.1下载地址:
http://archive.cloudera.com/cdh6/parcels/5.12.1/CDH-5.12.1-1.cdh6.12.1.p0.3-el6.parcel
http://archive.cloudera.com/cdh6/parcels/5.12.1/CDH-5.12.1-1.cdh6.12.1.p0.3-el6.parcel.sha1
http://archive.cloudera.com/cdh6/parcels/5.12.1/manifest.json
[root@ip-172-31-6-148~]# mkdir -p /var/www/html/cdh6.12.1
[root@ip-172-31-6-148 ~]# cd /var/www/html/cdh6.12.1/
[root@ip-172-31-6-148 cdh6.12.1]# ll
total 1582508
-rw-r--r-- 1 rootroot 1620405492 Aug 30 19:09 CDH-5.12.1-1.cdh6.12.1.p0.3-el6.parcel
-rw-r--r-- 1 rootroot 41 Aug 30 19:09 CDH-5.12.1-1.cdh6.12.1.p0.3-el6.parcel.sha1
-rw-r--r-- 1 rootroot 72312 Aug 30 19:11 manifest.json
[root@ip-172-31-6-148 cdh6.12.1]#
3.3安装Cloudera Manager Server
[root@ip-172-31-6-148~]# yum -y installcloudera-manager-server
如上图所示则表明安装成功。
[root@ip-172-31-6-148~]#/usr/share/cmf/schema/scm_prepare_database.sh mysql cm cm password
JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing: /usr/java/jdk1.7.0_67-cloudera/bin/java-cp/usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/schema/../lib/*com.cloudera.enterprise.dbutil.DbCommandExecutor/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!
[root@ip-172-31-6-148 ~]#
[root@ip-172-31-6-148~]# service cloudera-scm-server start
Starting cloudera-scm-server: [ OK ]
[root@ip-172-31-6-148 ~]#
[root@ip-172-31-6-148~]# netstat -lnpt | grep 7180
tcp 0 0 0.0.0.0:7180 0.0.0.0:* LISTEN 4056/java
[root@ip-172-31-6-148 ~]#
4.CDH安装
4.1CDH集群安装向导
1.admin/admin登录到CM
2.同意license协议,点击继续
3.选择60试用,点击继续
4.点击“继续”
5.输入主机ip或者名称,点击搜索找到主机后点击继续
6.点击“继续”
7.使用parcel选项,点击“更多选项”,点击“-”删除其它所有地址,输入
http:// ip-172-31-6-148.fayson.com/cdh6.12.1/点击“保存更改”
8.选择自定义存储库,输入cm的http地址
9.点击“继续”,进入下一步安装jdk
10.点击“继续”,进入下一步,默认多用户模式
11.点击“继续”,进入下一步配置ssh账号密码
12.点击“继续”,进入下一步,安装Cloudera Manager相关到各个节点
13.点击“继续”,进入下一步安装cdh到各个节点
14.点击“继续”,进入下一步主机检查,确保所有检查项均通过
点击完成进入服务安装向导。
4.2集群设置安装向导
1.选择需要安装的服务
此处使用自定义服务,如下图
2.点击“继续”,进入集群角色分配
HDFS角色分配:
Hive角色分配:
Cloudera Manager Service角色分配:
Spark角色分配:(Spark on Yarn所以没有spark的master和worker角色)
Yarn角色分配:
Zookeeper角色分配:(至少3个Server)
3.角色分配完成点击“继续”,进入下一步,测试数据库连接
4.测试成功,点击“继续”,进入目录设置,此处使用默认默认目录,根据实际情况进行目录修改
5.点击“继续”,等待服务启动成功
6.点击“继续”,显示集群安装成功
7.安装成功后进入home管理界面
醉酒鞭名马,少年多浮夸! 岭南浣溪沙,呕吐酒肆下!挚友不肯放,数据玩的花!
温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。
欢迎关注Hadoop实操,第一时间,分享更多Hadoop干货,喜欢请关注分享。
原创文章,欢迎转载,转载请注明:转载自微信公众号Hadoop实操
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。