centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

时间:2024-09-25 12:05:08

1.在已经安装好系统的linux服务器上关闭selinux和iptables

2.在所有linux服务器上配置ntp服务并设置ntp时间同步

3.在所有linux服务器上安装好cm和cdh版本所需要对应的java版本

(1).下载java包到/usr/local目录解压

(2).添加java环境到/root/.bash_profile目录下

export JAVA_HOME=/usr/local/jdk1.8.0_211
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin

4.为所有服务器配置host主机名并配置hosts(**配置所有主机的hosts;配置cm主机免密码登录所有服务器**)

**注意主机名不要出现”_”不然在cm为主机安装CDH后开启cloudera-manager-agent时会有问题**

**注意主机名不要出现用如:(Test.node01;Test.node02;Test.cm)这样”.”分割的第一段都相同;这样的host在是不法配置HA,因为cm配置HA自动认别主机就是以”.”为分割取第一段**

5.在CM服务器上安装数据库,这里作者选择安装的是mysql5.7(可以选择安装oraclea或postgresql)

(1).安装好mysql5.7

(2).初始化mysql5.7

[root@centos7 bin]# ./mysqld --initialize --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2019-02-21T09:09:32.773141Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-21T09:09:34.064508Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-02-21T09:09:34.252282Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-02-21T09:09:34.320052Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 67cc2fdb-35b8-11e9-a738-000c29186a7c.
2019-02-21T09:09:34.321735Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-02-21T09:09:34.330050Z 1 [Note] A temporary password is generated for root@localhost: >aHMp/_V3(Aq

**注意>aHMp/_V3(Aq为初始化第一次登录的临时密码**

(3).启动mysql5.7;登录后修改root密码

mysql> alter user 'root'@'localhost' identified by 'xxx' PASSWORD EXPIRE NEVER account unlock;    #原本密码有效期为360天需要取消这个限制。

mysql> flush privileges;

**注意添加root用户时加上WITH GRANT OPTION给予赋权的权限**

6.所有服务器安装必要的包

yum  -y  install psmisc MySQL-python at bc bind-libs bind-utils cups-client cups-libs cyrus-sasl-gssapi cyrus-sasl-plain ed fuse fuse-libs httpd httpd-tools keyutils-libs-devel krb5-devel libcom_err-devel libselinux-devel libsepol-devel libverto-devel mailcap noarch mailx mod_ssl openssl-devel pcre-devel postgresql-libs python-psycopg2 redhat-lsb-core redhat-lsb-submod-security  x86_64 spax time zlib-devel

7.下载安装Cloudera-manager5.16.2

下载地址:https://www.cloudera.com/downloads/manager/6-2-0.html

(1).选择要下载的版本下载

(2).下载包放至/opt目录解压 tar –xzvf cloudera-manager-centos7-cm5.16.2_x86_64.tar.gz

(3).创建mysql库

create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
1.CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

(4).创建clouder-manager的mysql账号

grant all on scm.* to scm@"%" Identified by "Bigdata@123";

(5).复制mysql Jar包到环境

cp mysql-connector-java-5.1.30-bin.jar /usr/share/java/mysql-connector-java.jar
cp /usr/share/java/mysql-connector-java.jar /opt/cm-5.16.2/share/cmf/lib/

(6).下载CDH5.16.5 centos7版本

下载地址:http://archive.cloudera.com/cdh5/parcels/5.16.2/

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

下载三个包到/opt/cloudera/parcel-repo目录下改名CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha1为CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha

(7).初始化CM库

/opt/cm-5.16.2/share/cmf/schema/scm_prepare_database.sh mysql -hlocalhost -P31000 -p123456 -scm-host localhost scm(库) scm(用户名) Bigdata@123(密码)

(8).所有节点创建系统用户

useradd --system --home=/opt/cm-5.16.1/run/cloudera-scm-server  --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm

(9).修改cm配置文件

sed -i "s/server_host=localhost/server_host=mcserver/" /opt/cm-5.16.2/etc/cloudera-scm-agent/config.ini

(10).cm服务器上chown –R cloudera-scm:cloudera-scm /opt/**;同步/opt/cmd-5.16.2到所有服务器上;

(11).在CM服务器上开启cm和agent服务

/opt/cm-5.16.1/etc/init.d/cloudera-scm-server start
/opt/cm-5.16.1/etc/init.d/cloudera-scm-agent start

(12).在其它服务器上开启agent服务

8.登录CM平台

(1).在cm服务器netstat –tpln看到7180端口已经监听起来http://cmserver:7180用户名admin密码admin登录

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(2).选择要作为集群的主机,第一确认/opt/cm-5.16.2/etc/clouder-scm-agent/config.ini已经配置为master,第二确认cloudera-scm-agent是否正常启动

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(3)选择要安装的CDH版本

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(4).安装完成会显示100%如果主机的域名是含有”_”的在安装完后会报clouser-manager-agent连接失败检查9000,9001端口是否被占用的错:

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(5)待安装完成后,会自动运行主机正确性检查,检查完后的结果如下图所示。如果出现图中所示的警告,按照上面的提示,运行提示中的命令,进行修改即可

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(6).下一步是根据自己的需要,安装所需的集群服务

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

这里作者安装的服务

(7).接着根据你上一步选择的服务,会进行相应的角色分配,系统会自动分配一些角色,如果你有其他的需求,自行更改即可

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(8).然后是进行数据库的配置,如果你也是同作者一样安装的全部服务,千万不要忘了创建hive、oozie、hue这三个数据库

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(9)接着是自动运行所有服务,这里需要等待10-15分钟的时间

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(10)最后当上面的所有命令运行完成后,会进入如下的主页面

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

9升级spark1.6到spark2.4.0

(1).cm5.16.2默认安装的spark是1.6.4;如果要升级SPARK2是不用删除spark1.6可以同时安装两个spark(spark1和spark2)**注意spark2.2和saprk2.3是不可以存在两个的**

(2)下载SPARK2.4.0如下图三个包到/opt/cloudera/parcel-repo;SPARK2-2.4.0.cloudera2-1.cdh5.13.3.p0.1041012-el7.parcel.sha1改名为SPARK2-2.4.0.cloudera2-1.cdh5.13.3.p0.1041012-el7.parcel.sha;**注意原来CDH5.16.2的manifest.json文件要改名为manifest_CDH5.16.2.json;因为mainifest.json文件不可以有重名**

下载地址:http://archive.cloudera.com/spark2/parcels/latest/

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(3)下载CSD文件到所有服务器/opt/cloudera/csd目录下

下载地址:http://archive.cloudera.com/spark2/csd/

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(4)分配并激活parcel

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

以上已经激活,第一次进来,如果没有SPARK2先检查新parcel会有SPARK2;再点分配,分配完成就激活;如果分配激活时有问题,报错,/opt/cmd-5.16.2/etc/init.d/cloudera-scm-agent restart重启agent再试

(5)命令重启cm,在cm服务器上/opt/cmd-5.16.2/etc/init.d/cloudera-scm-server restart重启后就可以添加spark2服务;

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0

(5)安装完成后在服务器上运行spark2-shell --master local[2];可以正常动行表示升级spark2完成

centos 7 cloudera-manager5.16.2,CDH5.16.2安装升级spark2.4.0