Reminder: To see the high-definition uncoded set of pictures, please use your mobile phone to open and click the picture to enlarge it.
1. Overview
This document mainly describes the process of deploying CDH5.12.1 Enterprise Edition with CentOS6.5 operating system in an offline environment. This installation document is mainly divided into 4 steps:
Preliminary preparation (including hostname, turn off firewall, turn off SELinux, clock synchronization, etc.)
Install Cloudera Manager Server
Install CDH cluster
Cluster integrity check (including whether services such as HDFS file system, MapReduce, Hive, etc. can run normally)
This document will focus on the installation of Cloudera Manager and CDH, and is based on the following assumptions:
Operating system version: CentOS6.5
MySQL version: 5.1.73
CM version: CM 5.12.1
CDH version: CDH 5.12.1
Use root to deploy the cluster
You have downloaded the installation packages of CDH and CM (CDH uses parcels package to install)
2. Preliminary preparation
2.1 hostname and hosts configuration
Each node in the cluster can communicate with each other using static IP addresses. The IP address and host name are configured through /etc/hosts, and the host name is configured in /etc/hostname (it is recommended that hostname be configured using FQDN full domain name).
Take the server (172.31.6.148) as an example:
Modify the /etc/sysconfig/network file:
[ root@ip-172-31-6-148~]# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=ip-172-31-6-148.fayson.com
Note: You need to restart the server after modifying the hostname.
Check whether the hostname is successfully modified:
[ root@ip-172-31-6-148~]# hostname
[ root@ip-172-31-6-148 ~]#
The /etc/hosts file is as follows:
[ 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 ~]#
For the above two steps, configure the other nodes in the cluster accordingly.
2.2 Disable SELinux
Execute the sudo setenforce 0 command on all nodes
[ root@ip-172-31-6-148~]# sudo setenforce 0
Modify the /etc/selinux/config file of all nodes in the cluster, the content is as follows:
[ root@ip-172-31-6-148~]# vim /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
2.3 Turn off the firewall
Perform the following operations on all nodes in the cluster and permanently turn off the firewall
[ 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 Configure OS local yum source
[ 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
name=CentOS6.5
baseurl=file:///mnt/iso
gpgcheck=false
enabled=true
Check if there is a new localrepo in the yum source list
[ 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 Install http service
To install the http service on one of the nodes in the cluster, execute the following command:
[ root@ip-172-31-6-148~]# yum -y install httpd
As shown in the figure above, the installation is successful.
[ 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
[ root@ip-172-31-6-148 ~]#
[ root@ip-172-31-6-148~]# service httpd start
2.6 Redo operating system yum source
After installing the httpd service in 2.5, remake the yum source of the operating system, using http, the operation is as follows:
_ 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
name=CentOS6.5
baseurl=http://ip-172-31-6-148.fayson.com/centos6.5
gpgcheck=false
enabled=true
Synchronize the /etc/yum.repo.d/os.repo configuration file to the /etc/yum.repo.d/ directory of all nodes in the cluster
2.7 Cluster clock synchronization
Install the ntp service on all servers in the cluster for cluster clock synchronization. Here, the ip-172-31-6-148.fayson.com server is selected as the local NTP server, and other nodes in the cluster are synchronized with it. The configuration is as follows:
[ root@ip-172-31-6-148~]# yum -y install ntp
As shown in the figure above, the installation is successful.
Perform the following operations on all nodes:
[ 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* 127.127.1.0 #local clock
fudge* 127.127.1.0 stratum 10
[ root@ip-172-31-5-190~]# vim /etc/ntp.conf
...
[ 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
==============================================================================
*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"
==============================================================================
*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"
==============================================================================
*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"
==============================================================================
*ip-172-31-6-148 LOCAL(0) 11 u 1 64 367 0.294 -9.249 1.511
[ root@ip-172-31-6-148 ~]#
Note: In the marked part, "*" shows that the synchronization is successful.
2.8 Install MySQL
[ root@ip-172-31-6-148~]# yum -y install mysql mysql-server
The screenshot above indicates that MySQL is successfully installed.
[ 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 ]
[ 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
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 ~]#
Note: The parts marked in red are input items. If "Thanks for using MySQL!" appears, the initialization is successful.
Library statement:
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;
The command line operation is as follows:
[ root@ip-172-31-6-148~]# mysql -uroot -p
...
mysql> create* database metastore default character set utf8;
Query* OK, 1 row affected (0.00 sec)
mysql*> CREATE USER* 'hive'@'%' IDENTIFIEDBY 'password';
mysql*> GRANT ALL* PRIVILEGES ON metastore. * TO 'hive'@'%';
mysql*> FLUSH PRIVILEGES*;
mysql*>*
mysql> create* databasecm default character set utf8;
Query* OK, 1 row affected (0.00 sec)
mysql*> CREATE USER* 'cm'@'%' IDENTIFIEDBY 'password';
mysql*> GRANT ALL* PRIVILEGES ON cm. * TO 'cm'@'%';
mysql*> FLUSH PRIVILEGES*;
mysql_> create database_am default character set utf8;
mysql*> CREATE USER* 'am'@'%' IDENTIFIEDBY 'password';
mysql*> GRANT ALL* PRIVILEGES ON am. * TO 'am'@'%';
mysql*> FLUSH PRIVILEGES*;
mysql*>*
mysql> create* databaserm default character set utf8;
Query* OK, 1 row affected (0.00 sec)
mysql*> CREATE USER* 'rm'@'%' IDENTIFIEDBY 'password';
mysql*> GRANT ALL* PRIVILEGES ON rm. * TO 'rm'@'%';
mysql*> FLUSH PRIVILEGES*;
mysql*>*
mysql> create* databasehue default character set utf8;
Query* OK, 1 row affected (0.00 sec)
mysql*> CREATE USER* 'hue'@'%' IDENTIFIEDBY 'password';
mysql*> GRANT ALL* PRIVILEGES ON hue. * TO 'hue'@'%';
mysql*> FLUSH PRIVILEGES*;
mysql*>*
mysql> create* databaseoozie default character set utf8;
Query* OK, 1 row affected (0.00 sec)
mysql*> CREATE USER* 'oozie'@'%' IDENTIFIEDBY 'password';
mysql*> GRANT ALL* PRIVILEGES ON oozie. * TO 'oozie'@'%';
mysql*> FLUSH PRIVILEGES*;
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
- rwxr-xr-x. 1 root root 960372 Aug 30 15:16 mysql-connector-java-5.1.34.jar
[ root@ip-172-31-6-148 java]#
3. Cloudera Manager installation
3.1 Configure CM local repo source
CM5.12.1 download link:
* http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.12.1/RPMS/x86_64/jdk-6u31-linux-amd64.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
- 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
[ 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
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 Configure http to access CDH Parcel package
CDH5.12.1 download address:
* http://archive.cloudera.com/cdh5/parcels/5.12.1/CDH-5.12.1-1.cdh5.12.1.p0.3-el6.parcel*
* http://archive.cloudera.com/cdh5/parcels/5.12.1/CDH-5.12.1-1.cdh5.12.1.p0.3-el6.parcel.sha1*
* http://archive.cloudera.com/cdh5/parcels/5.12.1/manifest.json*
[ root@ip-172-31-6-148~]# mkdir -p /var/www/html/cdh5.12.1
[ root@ip-172-31-6-148 ~]# cd /var/www/html/cdh5.12.1/
[ root@ip-172-31-6-148 cdh5.12.1]# ll
- rw-r--r-- 1 rootroot 1620405492 Aug 30 19:09 CDH-5.12.1-1.cdh5.12.1.p0.3-el6.parcel
- rw-r--r-- 1 rootroot 41 Aug 30 19:09 CDH-5.12.1-1.cdh5.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 cdh5.12.1]#
3.3 Install Cloudera Manager Server
[ root@ip-172-31-6-148~]# yum -y installcloudera-manager-server
As shown in the figure above, the installation is successful.
[ 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
[ root@ip-172-31-6-148 ~]#
[ root@ip-172-31-6-148~]# netstat -lnpt | grep 7180
[ root@ip-172-31-6-148 ~]#
4. CDH installation
4.1 CDH cluster installation wizard
admin/admin login to CM
Agree to the license agreement, click continue
http:// ip-172-31-6-148.fayson.com/cdh5.12.1/ Click "Save Changes"
Click Finish to enter the service installation wizard.
4.2 Cluster Setup Installation Wizard
Custom service is used here, as shown below
HDFS role assignment:
Hive role assignment:
Cloudera Manager Service role assignment:
Spark role assignment: (Spark on Yarn so there is no spark master and worker roles)
Yarn role assignment:
Zookeeper role assignment: (at least 3 servers)
A drunk whip famous horse, how ostentatious a young man! Lingnan Huanxisha, vomiting wine shop! My best friend refuses to release, the data is a flower!
Reminder: To see the high-definition uncoded set of pictures, please use your mobile phone to open and click the picture to enlarge it.
Welcome to pay attention to Hadoop practical operation, the first time, share more Hadoop dry goods, if you like, please follow and share.
Original article, welcome to reprint, please indicate: Reprinted from WeChat public account Hadoop practical operation
Recommended Posts