计划用vmware虚拟机安装三个节点,其中Cloudera Manager Server一台(用来管理),cdh两台(Hadoop主从)。所有操作在root用户下进行。
版本:
软件 | 版本 |
---|---|
os | CentOS Linux release 7.5.1804 |
jdk | 1.8.0_141 |
cm(Cloudera Manager) | cm6(6.0.1) |
cdh(Parcels) | cdh6(6.0.1) |
mysql | mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar |
mysql-connector-java | 5.1.46 |
用vmware最小化安装centos7后,修改主机名和hosts文件。
vi /etc/hostname
vi /etc/hosts
进入vmware,菜单栏选择“编辑-虚拟网络编辑器”,在最上边选择nat那个网卡,取消勾选最下边的“使用本地dhcp服务……”,点击中间的“nat设置”,记住ip、子网掩码,网关。
然后本地的windows网络设置,适配器设置里找到vmware的对应的nat那个网卡,在ipv4设置里改成静态获取,填上边记住的内容。
进入虚拟机,vi /etc/sysconfig/network-scripts/ifcfg-ens33
,需要修改的:
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.xxx.xxx
NETMASK=255.255.255.0
GATEWAY=192.168.xxx.x
DNS1=8.8.8.8
DNS2=114.114.114.114
重启:service network restart
或者systemctl restart network
yum install -y lrzsz
yum install -y net-tools
yum install -y wget
yum install -y vim-enhanced
yum install -y bash-completion
yum install -y git
yum install -y telnet
yum install -y telnet-server
修改配置文件/etc/sysconfig/selinux
,设置SELINUX=disabled
。
systemctl disable firewalld && systemctl stop firewalld && systemctl status firewalld
修改/etc/rc.local
文件并添加以下两行:
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo "vm.swappiness=10" >> /etc/sysctl.conf
sysctl -p
rpm方式安装,下载地址用CM6 RPM的:
https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/
命令:
wget -c https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
rpm -ivh oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
# 使用rpm安装的java在/usr/java/jdk1.8XXXX
ls /usr/java/
vim /etc/profile
# 添加如下
export JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
export JRE_HOME=/usr/java/jdk1.8.0_141-cloudera/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
# 生效
source /etc/profile
以上是集群所有机器都要做的。可以配好一台后关机打快照克隆。
在打算安装cm server的那台机器执行:
ssh-keygen #三次回车
然后发送公钥给另两台机器以及自己本身:
ssh-copy-id 用户名@机器IP #输入yes和密码
测试免密:
ssh 用户名@机器IP
所有节点安装相关ntp组件,设置时区,启动:
yum install -y ntp
timedatectl set-timezone Asia/Shanghai
systemctl start ntpd
systemctl enable ntpd
配置ntp的服务器(选择cm server那台机器作为服务器,其余机器来同步它):
vim /etc/ntp.conf
# 修改
restrict 192.168.178.151 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
restrict 192.168.178.2 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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
说明:最开始添加本机ip,中间部分添加网关和子网掩码,最后部分注释掉默认的并照抄填写上述部分。
其余机器的配置(要改本机ip部分和最后的服务器地址):
restrict 192.168.178.152 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
restrict 192.168.178.2 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 192.168.178.151
Fudge 192.168.178.151 stratum 10
在其它节点上手动同步服务器的时间:
ntpdate -u 192.168.178.151
ntpstat
在cm server机器下载cm相关rpm包并搭建repo源。
CM6 RPM地址:
https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/
需要下载该链接下的所有RPM文件(jdk装过了就不用了),保存到cloudera-repos
目录下。
wget -c https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.0.1-610811.el7.x86_64.rpm
wget -c https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.0.1-610811.el7.x86_64.rpm
wget -c https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/cloudera-manager-server-db-2-6.0.1-610811.el7.x86_64.rpm
wget -c https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.0.1-610811.el7.x86_64.rpm
还有个ASC文件要下载,地址:
https://archive.cloudera.com/cm6/6.0.1/allkeys.asc
同样保存到cloudera-repos
目录下:
wget -c https://archive.cloudera.com/cm6/6.0.1/allkeys.asc
下载完毕,开始安装httpd和createrepo并启动:
yum -y install httpd createrepo
systemctl start httpd
systemctl enable httpd
然后进入到前面准备好的存放Cloudera Manager RPM包的目录cloudera-repos
下,生成RPM元数据:
createrepo .
然后将cloudera-repos
目录移动到httpd的html
目录下:
mv cloudera-repos /var/www/html/
确保可以通过浏览器查看到这些RPM包:
http://192.168.178.151/cloudera-repos/
接着在打算作为Cloudera Manager Server的主机上创建cm6的repo文件:
cd /etc/yum.repos.d
vim cloudera-manager.repo
添加如下内容:
[cloudera-manager]
name=Cloudera Manager 6.0.1
baseurl=http://cdh601/cloudera-repos/
gpgcheck=0
enabled=1
然后执行yum clean all && yum makecache
命令。
在CM Server节点上操作,执行下面的命令:
yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
其余节点需要装agent和daemon,这里先不装,后续用界面安装。
然后配置本地Parcel存储库,后续界面离线安装会用到,在Cloudera Manager Server安装完成后,进入到本地Parcel存储库目录:
cd /opt/cloudera/parcel-repo
CDH6 Parcels地址:https://archive.cloudera.com/cdh6/6.0.1/parcels/
需要下载CDH-6.0.1-1.cdh6.0.1.p0.590678-el7.parcel和manifest.json这两个文件:
wget -c https://archive.cloudera.com/cdh6/6.0.1/parcels/CDH-6.0.1-1.cdh6.0.1.p0.590678-el7.parcel
wget -c https://archive.cloudera.com/cdh6/6.0.1/parcels/manifest.json
然后执行命令生成sha文件:
sha1sum CDH-6.0.1-1.cdh6.0.1.p0.590678-el7.parcel | awk '{ print $1 }' > CDH-6.0.1-1.cdh6.0.1.p0.590678-el7.parcel.sha
然后执行下面的命令修改文件所有者:
chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/*
下载mysql的rpm地址:
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
记得下载RPM Bundle版本。只在cm server机器安装,移除自带的MariaDB后开始安装,顺序执行:
yum -y remove mariadb-libs
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
systemctl start mysqld
systemctl enable mysqld
查密码,改密码复杂度要求,设置新密码:
grep password /var/log/mysqld.log
mysql -u root -p
mysql> set global validate_password_policy=0;
mysql> set password = password('12345678');
设置远程登录权限:
mysql> grant all privileges on *.* to 'root'@'%' identified by '12345678';
mysql> flush privileges;
修改mysql数据库默认编码:编辑/etc/my.cnf
文件,在[mysqld]
下面添加一行character-set-server=utf8
。重启mysql服务:systemctl restart mysqld
。
jdbc驱动最好全部节点都装,后续别的组件也需要。
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
tar -xzvf mysql-connector-java-5.1.46.tar.gz
cd mysql-connector-java-5.1.46/
mkdir -p /usr/share/java/
cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar
需要为 Cloudera 各软件创建数据库,使用root登陆数据库,创建以下数据库和账号,密码因为复杂度要求都为2w3e$R%T
。
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '2w3e$R%T';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '2w3e$R%T';
FLUSH PRIVILEGES;
设置 Cloudera Manager 数据库:
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
输入前边设置的scm的密码。
启动Cloudera Manager Server服务:
systemctl start cloudera-scm-server
监控服务启动状态:
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
等一会访问页面http://cm的机器IP:7180
,默认账号和密码都为admin
。
这一步是要搜索并选择用于安装CDH集群的主机,在主机名称后面的输入框中输入各个节点的hostname,中间使用英文逗号分隔开,然后点击搜索,在结果列表中勾选要安装CDH的节点即可:
指的是前边配的cm rpm包和parcel的库。
这里选择自定义,填写上面使用httpd搭建好的Cloudera Manager YUM 库URL。如果我们之前的配置本地Parcel存储库步骤操作无误的话,这里会自动选择【使用Parcel】,并加载出CDH版本,确认无误后点击【继续】:
接下里选择是否安装jdk,我们已手动安装,不用选。
用于配置集群主机之间的SSH登录,填写root用户的密码,根据集群配置填写合适的【同时安装数量】值即可:
然后会安装agents和parcel。等待安装。安装完成后进入主机检测页面,检测完成即可继续安装大数据组件。
参考资料:
https://www.cnblogs.com/mylovelulu/p/10384732.html
https://www.cnblogs.com/wzlinux/p/10183357.html
https://www.cloudera.com/documentation/enterprise/6/release-notes/topics/rg_requirements_supported_versions.html