xumingxiang 大数据 2017-10-04 1,738 次浏览 cdh, hadoop, Linux 没有评论
准备4台机器,内存,磁盘尽量给足
node1(master) 192.168.231.128 内存16G,磁盘50G
node2 192.168.231.129 内存3G,磁盘50G
node3 192.168.231.130 内存3G,磁盘50G
node4 192.168.231.131 内存3G,磁盘50G
为了尽可能减少重复劳动,先在node1上配置好所有节点都需要进行的相同操作,然后克隆出其他3台虚拟机 node2,node3,node4
一:下载所需的安装包
1.1)下载cm ,下载地址 http://archive.cloudera.com/cm5/cm/5/ 选择 cloudera-manager-centos7-cm5.12.1_x86_64.tar.gz (708M )
1.2)下载cdh ,下载地址 http://archive.cloudera.com/cdh5/parcels/5.12.1/选择 CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel 、CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel.sha1 (1.6G,慢慢等吧)
1.3)下载 manifest.json 和cdh在同一个页面 ,下载地址 http://archive.cloudera.com/cdh5/parcels/5.12.1/manifest.json
1.4)下载mysql驱动, https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.44.tar.gz
1.6) mysql安装程序, http://mirrors.neusoft.edu.cn/mariadb//mariadb-10.2.7/bintar-linux-x86_64/mariadb-10.2.7-linux-x86_64.tar.gz下载后上传到node1 所有的安装文件都放在 /app 目录下
二:卸载openjdk
CentOS自带OpenJdk,不过运行CDH5需要使用Oracle的JDK,需要Java 7的支持。
卸载自带的OpenJdk,使用rpm -qa | grep java查询java相关的包,使用rpm -e –nodeps 包名卸载之。
三:去Oracle的官网下载jdk安装,最后配置环境变量。
- cd /app
- tar -zxvf jdk-8u144-linux-x64.tar.gz
- vim /etc/profile
- export JAVA_HOME=/app/jdk1.8.0_144
- export PATH=$JAVA_HOME/bin:$PATH
- export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- source /etc/profile
验证是否安装成功
- [root@localhost app]# java -version
- java version "1.8.0_144"
- Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
- Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
四:关闭防火墙
- service iptables stop #临时关闭
- chkconfig iptables off #重启后生效
- systemctl stop firewalld.service #停止firewall
- systemctl disable firewalld.service #禁止firewall开机启动
五:SELinux
set enforce 0 (临时生效)
修改 vim /etc/selinux/config 下的
SELINUX=disabled (重启后永久生效)
- # This file controls the state of SELinux on the system.
- # SELINUX= can take one of these three values:
- # enforcing - SELinux security policy is enforced.
- # permissive - SELinux prints warnings instead of enforcing.
- # disabled - No SELinux policy is loaded.
- SELINUX=disabled
- # SELINUXTYPE= can take one of these two values:
- # targeted - Targeted processes are protected,
- # mls - Multi Level Security protection.
- SELINUXTYPE=targeted
六:安装mysql
参见:http://blog.xumingxiang.com/271.html
七:所有节点配置NTP服务
(这一步暂时可以跳过,但是在集群启动以后,会提示时间不同步)
集群中所有主机必须保持时间同步,如果时间相差较大会引起各种问题。 具体思路如下:
master节点作为ntp服务器与外界对时中心同步时间,随后对所有datanode节点提供时间同步服务。
所有datanode节点以master节点为基础同步时间。
所有节点安装相关组件:
- yum install ntp
启动 ntp:
- service ntpd start
设置开机启动:
- chkconfig ntpd on
检查是否设置成功:chkconfig –list ntpd其中2-5为on状态就代表成功。
可以通过以下命令先进行时间同步:
- ntpdate us.pool.ntp.org
主节点配置(master节点)
- vim /etc/ntp.conf
ntp服务只有一个配置文件,配置好了就OK。 这里只给出有用的配置,不需要的配置都用#注掉,这里就不在给出(大部分把#去掉即可,不需要添加):
- driftfile /var/lib/ntp/drift
- # Permit time synchronization with our time source, but do not
- # permit the source to query or modify the service on this system.
- restrict default kod nomodify notrap nopeer noquery</