原创

Centos7使用CDH6.3.0安装大数据集群

修改网络和主机名

cdh6-master

[root@cdh6-master ~]# hostnamectl set-hostname cdh6-master

[root@cdh6-master ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=bdf6fb11-50f4-403a-8ba6-b9dca61a591e
DEVICE=ens33
ONBOOT=yes

IPADDR=192.168.200.125
NETMASK=255.255.255.0
GATEWAY=192.168.200.2
DNS1=8.8.8.8

cdh6-slave1

[root@cdh6-slave1 ~]# hostnamectl set-hostname cdh6-slave1

[root@cdh6-slave1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=e2b4e53e-5a4d-4b20-b6ff-39a67539214a
DEVICE=ens33
ONBOOT=yes

IPADDR=192.168.200.126
NETMASK=255.255.255.0
GATEWAY=192.168.200.2
DNS1=8.8.8.8

cdh6-slave2

[root@cdh6-slave2 ~]# hostnamectl set-hostname cdh6-slave2

[root@cdh6-slave2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=a15136a1-c83b-4750-9ff3-2ca779e39818
DEVICE=ens33
ONBOOT=yes

IPADDR=192.168.200.127
NETMASK=255.255.255.0
GATEWAY=192.168.200.2
DNS1=8.8.8.8

关闭防火墙和SELinux

vi /etc/hosts

192.168.200.125        cdh6-master
192.168.200.126        cdh6-slave1
192.168.200.127        cdh6-slave2
# 关闭防火墙
systemctl stop firewalld
# 禁止防火墙开机自启
systemctl disable firewalld
# 临时生效
setenforce 0
# 永久生效
修改 /etc/selinux/config 下的 SELINUX=disabled

SSH免密登陆

cdh6-master节点(只需要主节点能免密登陆其它节点以及自己就可以了):

# 输入之后一直回车
ssh-keygen    

# 赋值秘钥到其它节点包括自己
ssh-copy-id   cdh6-master
ssh-copy-id   cdh6-slave1
ssh-copy-id   cdh6-slave2

注意事项:如果出现 ssh-copy-id: command not found 需要执行该命令(yum -y install openssh-clients

集群时间同步

所有节点

#全部节点安装ntp
rpm -qa |grep ntpd
###没有安装ntp,则需要安装此服务
yum install -y ntp

cdh6-master

vi /etc/ntp.conf
###去掉这个注释,将地址改成网段地址
restrict 192.168.200.2 mask 255.255.255.0 nomodify notrap

###注释掉这几个
#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
fudge  127.127.1.0  stratum  10

vi /etc/sysconfig/ntpd
###加入下面一句话,用于配置boot时间和系统时间同步
SYNC_HWCLOCK=yes
###可选,选择上海时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

cdh6-slave1cdh6-slave2

输入 crontab -e 命令进入编辑状态,然后输入一下内容(该任务保存在目录/var/spool/cron 下,必须用root用户才能看到  )
* * * * * /usr/sbin/ntpdate        cdh6-master

启动所有节点的ntp

service ntpd start

chkconfig ntpd on

安装repo、GPG key、jdk

所有节点。

# 安装repo,如果没有wget就yum install -y wget
wget https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/cloudera-manager.repo -P /etc/yum.repos.d/

# 导入GPG key
rpm --import https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPM-GPG-KEY-cloudera
# 安装jdk
yum install -y oracle-j2sdk1.8
# 配置java环境变量
vi /etc/profile
# 最后面加上
export JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
export PATH=$PATH:$JAVA_HOME/bin
# 生效环境变量
source /etc/profile

上传cdh资源包到cdh6-master节点

cdh6-slave1安装MySQL

cdh-slave1节点。

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum update

yum install -y mysql-server

systemctl start mysqld

systemctl enable mysqld
###初始化Mysql

/usr/bin/mysql_secure_installation

[...]
Enter current password for root (enter for none):
OK, successfully used password, moving on...
[...]
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
[...]
Disallow root login remotely? [Y/n] N
[...]
Remove test database and access to it [Y/n] Y
[...]
Reload privilege tables now? [Y/n] Y
All done!

安装MySQL JDBC Driver

所有节点。

wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz

tar -zxvf mysql-connector-java-5.1.46.tar.gz

mkdir -p /usr/share/java/

cd mysql-connector-java-5.1.46

cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar

注意:

一定要将mysql-connector-java-5.1.46-bin.jar改名为mysql-connector-java.jar,不然初始化cm的时候无法识别。

创建数据库

在安装MySQL数据库的cdh6-slave1节点。

需要建的库有scm、amon、rman、hue、metastore、sentry、nav、navms、oozie

CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

开放远程权限:

mysql> use mysql;

mysql> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

mysql> grant all privileges on *.* to 'scm'@'master.cdh6' identified by '123456' with grant option;

mysql> flush privileges;

初始化数据库

我这里MySQL安装在cdh6-slave1节点,cm-server安装在cdh6-master节点。

/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h cdh6-slave1 --scm-host cdh6-master scm scm

注意事项,如果MySQL和cm-server在一台服务器上:

/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm

离线安装cdh

下载安装包

CM

CDH

注意:

CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha256重命名为CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha,这点必须注意否则,系统会重新下载。

https://archive.cloudera.com/cdh6/6.3.0/parcels/manifest.json中有所有版本的秘钥,

然后,CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha中的秘钥修改为对应版本的秘钥。

我选的这个版本的秘钥:https://archive.cloudera.com/cdh6/6.3.0/parcels/CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha1。

解压CM安装包

环境依赖安装:

yum install -y perl

yum install -y bind-utils psmisc libxslt cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs httpd mod_ssl openssl-devel python-psycopg2 MySQL-python /lib/lsb/init-functions libpq.so.5

所有节点:

rpm -ivh cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm

rpm -ivh cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm

仅仅在master节点:

rpm -ivh cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm

修改所有节点的CM主机指向

vi /etc/cloudera-scm-agent/config.ini
# 将server_host修改为CM-Server所在的主机名
server_host=cdh6-master

启动cdh6-master节点的cloudera-scm-server

systemctl start cloudera-scm-server

等待server启动完毕之后,再启动所有节点的cloudera-scm-agent

systemctl start cloudera-scm-agent

安装大数据组件

可能会遇到的问题

虚拟内存设置

Cloudera 建议将 /proc/sys/vm/swappiness 设置为 0。当前设置为 60。使用 sysctl 命令在运行时更改该设置并编辑 /etc/sysctl.conf 以在重启后保存该设置。您可以继续进行安装,但可能会遇到问题,Cloudera Manager 报告您的主机由于交换运行状况不佳。以下主机受到影响:

临时解决

通过echo 0 > /proc/sys/vm/swappiness即可解决。

永久解决

sysctl -w vm.swappiness=0

echo vm.swappiness = 0 >> /etc/sysctl.conf

大内存设置

大内存页禁用

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

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

升级软件依赖版本

Starting with CDH 6, PostgreSQL-backed Hue requires the Psycopg2 version to be at least 2.5.4, see the documentation for more information. This warning can be ignored if hosts will not run CDH 6, or will not run Hue with PostgreSQL. The following hosts have an incompatible Psycopg2 version of '2.5.1'

解决方法:可以忽略。

yum install python-pip

pip install --upgrade psycopg2

安装Parcel提示主机运行状况不良

解决方法

删除agent目录下面的cm_guid文件,并重启失败节点的agent服务恢复。

find / -name cm_guid
/var/lib/cloudera-scm-agent/cm_guid

删除它/var/lib/cloudera-scm-agent/cm_guid

###重启agent
systemctl cloudera-scm-agent restart
↓↓↓ 打开微信关注我的微信公众号 ↓↓↓

会打篮球的程序猿

领取精品免费学习资料哦~
正文到此结束
本文目录