Redhat7.2环境cdh6.0的部署(3节点虚拟机测试)
文件准备 链接:https://pan.baidu.com/s/1kySDpX8yHASGjokwl3QF-g 密码: 8iyd 文件存放路径 Cloudera Manager包/opt/cm6/ parcels/opt//parcels...
文件准备
链接:https://pan.baidu.com/s/1kySDpX8yHASGjokwl3QF-g 密码: 8iyd
文件 | 存放路径 | |
Cloudera Manager包 | /opt/cm6/ | |
parcels | /opt//parcels | |
JDK1.8 | /opt/JDK/jdk-8u144-linux-x64.rpm | 所有节点 |
MYSQL5.7 | /opt/mysql//mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar | |
MYSQL_JDBC | /opt/mysql-jdbc/mysql-connector-java.jar | 所有节点 |
relh ISO镜像 | /opt/os/rhel-server-7.2-x86_64-dvd.iso |
CM包与parcels包官方下载地址:
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/
所有rpm包下载后放到/opt/cm6下
https://archive.cloudera.com/cm6/6.0.0/
allkeys.asc下载后放到/opt/cm6下
https://archive.cloudera.com/cdh6/6.0.0/parcels/
下载对应OS版本的parcel包.sha与manifest.json文件放在/opt/parcels下
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
操作系统配置
虚拟机建议配置mastet节点2核8G内存50G硬盘,其它节点2核4G内存40G硬盘(硬盘建议SSD)
red had 7.2 ip配置 (虚拟机nat模式)
参考:nat联网设置:https://blog.csdn.net/ping0817/article/details/45867547
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eno16777736
DEVICE=eno16777736
ONBOOT=yes
IPADDR=32.188.35.51
GATEWAY=32.188.35.2
NETMASK=255.255.255.0
DNS1=32.188.35.2
network配置(所有节点)
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cdh001
配置hosts(所有节点)
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
32.188.35.51 cdh001
32.188.35.52 cdh002
32.188.35.53 cdh003
关闭防火墙和selinux(所有节点)
systemctl stop firewalld
systemctl disable firewalld
vim /etc/selinux/config(修改下列)
SELINUX=disabled
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ssh无密码登录
1)在每一个节点根目录下执行以下操作:
ssh-keygen -t rsa
一路回车到结束,在/root/.ssh/下面会生成一个公钥文件
id_rsa.pub
2)将公钥追加到authorized_keys,在每个节点执行该操作:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
3)修改权限,在每个节点执行
chmod 600 ~/.ssh/authorized_keys
4)将id_rsa.pub从当前节点分发到其他各个节点
5)每个节点将远程复制过来的公钥追加到authorized_keys里面(即每个节点的authorized_keys存储所有节点的公匙)
6)各节点执行ssh root@hostname 测试是否可以实现免密登录
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
配置本地os的yum源(节点1操作)
mkdir /mnt/rhel7.2
mount -o loop /opt/os/rhel-server-7.2-x86_64-dvd.iso /mnt/rhel7.2
【重启后需重新mount,
可以修改/etc/fstab文件开机自动mount: vi /etc/fstab 添加
/opt/os/rhel-server-7.2-x86_64-dvd.iso /mnt/rhel7.2 iso9660 defaults,loop 0 0
mount –a #测试挂载】
vi /etc/yum.repos.d/local.repo
[iso]
name= rhel-server-7.2-x86_64-dvd.iso
baseurl=file:///mnt/rhel7.2
gpgcheck=0
enabled=1
yum clean all
yum makecache
安装Httpd服务(节点1)
yum install httpd
service httpd start
设置httpd服务开机自启
systemctl enable httpd.service
mkdir /var/www/html/iso/
ln -s /mnt/rhel7.2 /var/www/html/iso/
配置其他节点os的yum源(其他节点操作)
vi /etc/yum.repos.d/local.repo
[http_iso]
name=iso_7.2
baseurl=http://cdh001/iso/rhel7.2
gpgcheck=0
enabled=1
yum clean all
yum makecache
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
配置NTP服务(所有节点)
修改时区(改为中国标准时区)
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
安装ntp
yum -y install ntp
vi /etc/ntp.conf
ntp主机配置
restrict 32.188.35.0 mask 255.255.255.240 nomodify notrap
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
以下内容注释掉
#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
其它节点配置
server cdh001
fudge cdh001 stratum 10
重新启动 ntp 服务:
service ntpd restart
设置开机自启systemctl enable ntpd.service
rhel7.x中默认安装了chrony,关闭chronyd 的开机自启systemctl disable chronyd.service
ntpdc -c loopinfo #查看与时间同步服务器的时间偏差
ntpq -p #查看当前同步的时间服务器
ntpstat #查看状态
配置成功状态(服务开启后前面出现*说明成功):
参考:ntp相关配置:https://blog.csdn.net/wisdom_c_1010/article/details/56830837
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
修改Linux swappiness参数(所有节点)
【为了避免服务器使用swap功能而影响服务器性能,一般都会把vm.swappiness修改为0(cloudera建议10以下)
echo 0 > /proc/sys/vm/swappiness
这样操作重启机器还是还原
修改配置文件,开机自动设置参数
编辑vim /etc/sysctl.conf
在最后添加vm.swappiness=0】
上述方法rhel6有效,rhel7.2中
tuned服务会动态调整系统参数
查找tuned中配置,直接修改配置
[root@cdh01 ~]# cd /usr/lib/tuned/
[root@cdh01 tuned]# grep "vm.swappiness" * -R
查询出后依次修改
修改完确认
参考:sysctl修改内核参数 重启不生效https://blog.csdn.net/ygtlovezf/article/details/79014299
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
禁用透明页(所有节点)
设置方法
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
永久生效
在/etc/rc.local 添加上面命令
给与可执行权限:
chmod +x /etc/rc.d/rc.local
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
JDK安装(所有节点)
卸载原有java
rpm -qa | grep java # 查询已安装的java
yum remove java* # 卸载
安装JDK以及配置环境变量
rpm -ivh /opt/JDK/jdk-8u144-linux-x64.rpm
vi /etc/profile
# 末尾添加
export JAVA_HOME=/usr/java/jdk1.8.0_144
export CLASSPATH=.:$CLASSPTAH:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
创建/usr/share/java目录,将mysql-jdbc包放过去
mkdir -p /usr/share/java
mv /opt/mysql-j/mysql-connector-java.jar /usr/share/java/
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MYSQL安装(主节点)
1卸载mariadb
[root@cdh001 opt]# rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.x86_64
[root@cdh001 opt]# rpm -e mariadb-libs-5.5.44-2.el7.x86_64
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
[root@cdh001 opt]# rpm -e postfix-2:2.10.1-6.el7.x86_64
[root@cdh001 opt]# rpm -e mariadb-libs-5.5.44-2.el7.x86_64
2 MYSQL安装
cd /opt/mysql/
tar -xvf ./mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm
3 MYSQL配置
mysqld --initialize --user=mysql # 初始化mysql使mysql目录的拥有者为mysql用户
cat /var/log/mysqld.log # 最后一行将会有随机生成的密码
systemctl start mysqld.service # 设置mysql服务自启
mysql -uroot –p
# 输入临时密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; # 修改密码
4 创建库(后续安装服务等使用)
CREATE DATABASE cmserver DEFAULT CHARACTER SET utf8;
GRANT ALL on cmserver.* TO 'cmserveruser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8;
GRANT ALL on metastore.* TO 'hiveuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8;
GRANT ALL on amon.* TO 'amonuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8;
GRANT ALL on rman.* TO 'rmanuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8;
GRANT ALL on oozie.* TO 'oozieuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8;
GRANT ALL on hue.* TO 'hueuser'@'%' IDENTIFIED BY 'password';
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
配置Cloudera Manager包yum源(主节点)
mkdir -p /var/www/html/cloudera-repos
将下载的cm包文件移到此目录下
创建repodata
[root@cdh001 cm6]# createrepo .
创建.repo
[root@cdh001 cm6]# vim /etc/yum.repos.d/cloudera-manager.repo
[cloudera-manager]
name = Cloudera Manager, Version
baseurl = http://cdh001/cloudera-repos/cm6/
gpgcheck = 1
~
yum clean all
yum makecache
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
安装 Cloudera Manager(主节点)
sudo yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
#安装完CM后/opt/ 下会出现cloudera目录
mv /opt/parcels/* /opt/cloudera/parcel-repo # 将parcel包移动到指定位置
在/opt/cloudera/parcel-repo执行以下命令:
sha1sum CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel | awk '{ print $1 }' > CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha
# 执行初始化脚本
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql cmserver cmserveruser password
# 打开server服务
service cloudera-scm-server start
top命令查看cpu占用大幅升高,cpu使用率下降后说明服务已起
查看CM页面是否已可以打开
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
集群安装配置
按Option1说明配置auto-tls
JAVA_HOME=/usr/java/jdk1.8.0_144 /opt/cloudera/cm-agent/bin/certmanager --location /opt/cloudera/CMCA setup --configure-services
service cloudera-scm-server restart
重启后打开7180自动跳转至7183
所有节点JDK已安装,这里不勾选
Agents安装
parcels分发
检测
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
集群安装配置(可后续依需求单个服务安装,此处选择Essentials安装)
选择服务安装节点(namenode与secondaryNameNode尽量不要放在一个节点,我这里当时比较随意没注意,后续可以迁移)
填入之前创建的库名用户密码,测试连接success后continue
各项配置
初次运行
完成
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
安装过程中可能遇到的问题:
需要使用sha1sum校验parcel包生成校验文件,不然parcel包不识别
allkeys.asc 文件忘记下载,安装Agents会报错
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
官方安装手册
http://www.cloudera.com/documentation/enterprise/6/latest/topics/installation.html
更多推荐
所有评论(0)