Hadoop生态圈-通过CDH5.15.1部署spark1.6与spark2.3.0的版本兼容运行
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031121234783-60933084.png)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@node101 ~]# yum -y install wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile 10gen | 2.5 kB 00:00:00 base | 3.6 kB 00:00:00 centosplus | 3.4 kB 00:00:00 epel | 3.2 kB 00:00:00 extras | 3.4 kB 00:00:00 mysql-connectors-community | 2.5 kB 00:00:00 mysql-tools-community | 2.5 kB 00:00:00 mysql56-community | 2.5 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/3): epel/x86_64/updateinfo | 933 kB 00:00:00 (2/3): epel/x86_64/primary | 3.6 MB 00:00:01 (3/3): updates/7/x86_64/primary_db | 6.0 MB 00:00:01 epel 12756/12756 Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-15.el7_4.1 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================================================================================== Installing: wget x86_64 1.14-15.el7_4.1 base 547 k Transaction Summary =================================================================================================================================================================================================================== Install 1 Package Total download size: 547 k Installed size: 2.0 M Downloading packages: wget-1.14-15.el7_4.1.x86_64.rpm | 547 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-15.el7_4.1.x86_64 1/1 Verifying : wget-1.14-15.el7_4.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-15.el7_4.1 Complete! [root@node101 ~]#
[root@node101 ~]# mkdir /opt/cloudera/csd && cd /opt/cloudera/csd [root@node101 csd]# [root@node101 csd]# wget http://archive.cloudera.com/spark2/csd/SPARK2_ON_YARN-2.3.0.cloudera4.jar --2018-10-31 00:17:57-- http://archive.cloudera.com/spark2/csd/SPARK2_ON_YARN-2.3.0.cloudera4.jar Connecting to 10.9.137.250:3888... connected. Proxy request sent, awaiting response... 200 OK Length: 19037 (19K) [application/java-archive] Saving to: ‘SPARK2_ON_YARN-2.3.0.cloudera4.jar’ 100%[=========================================================================================================================================================================>] 19,037 --.-K/s in 0.002s 2018-10-31 00:17:57 (10.4 MB/s) - ‘SPARK2_ON_YARN-2.3.0.cloudera4.jar’ saved [19037/19037] [root@node101 csd]# [root@node101 csd]# ll total 20 -rw-r--r--. 1 root root 19037 Oct 5 05:45 SPARK2_ON_YARN-2.3.0.cloudera4.jar [root@node101 csd]#
[root@node101 csd]# ll total 20 -rw-r--r--. 1 root root 19037 Oct 5 05:45 SPARK2_ON_YARN-2.3.0.cloudera4.jar [root@node101 csd]# [root@node101 csd]# [root@node101 csd]# id cloudera-scm uid=997(cloudera-scm) gid=995(cloudera-scm) groups=995(cloudera-scm) [root@node101 csd]# [root@node101 csd]# [root@node101 csd]# chown cloudera-scm:cloudera-scm SPARK2_ON_YARN-2.3.0.cloudera4.jar [root@node101 csd]# [root@node101 csd]# ll total 20 -rw-r--r--. 1 cloudera-scm cloudera-scm 19037 Oct 5 05:45 SPARK2_ON_YARN-2.3.0.cloudera4.jar [root@node101 csd]#
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031122911489-458865269.png)
[root@node101 ~]# cd /opt/cloudera/parcel-repo/ [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2070564 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json [root@node101 parcel-repo]# [root@node101 parcel-repo]# mv manifest.json manifest.json.`date +%F` [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2070564 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 [root@node101 parcel-repo]#
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@node101 ~]# hostname node101.yinzhengjie.org.cn [root@node101 ~]# [root@node101 ~]# cd /opt/cloudera/parcel-repo/ [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2070564 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 [root@node101 parcel-repo]# [root@node101 parcel-repo]# wget http://archive.cloudera.com/spark2/parcels/2.3.0.cloudera4/SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel --2018-10-31 00:36:28-- http://archive.cloudera.com/spark2/parcels/2.3.0.cloudera4/SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel Connecting to 10.9.137.250:3888... connected. Proxy request sent, awaiting response... 200 OK Length: 191904064 (183M) [binary/octet-stream] Saving to: ‘SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel’ 100%[=========================================================================================================================================================================>] 191,904,064 255KB/s in 22m 2s 2018-10-31 00:58:31 (142 KB/s) - ‘SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel’ saved [191904064/191904064] [root@node101 parcel-repo]# ll total 2257972 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel [root@node101 parcel-repo]#
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@node101 parcel-repo]# ll total 2257972 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel [root@node101 parcel-repo]# [root@node101 parcel-repo]# wget http://archive.cloudera.com/spark2/parcels/2.3.0.cloudera4/SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1 --2018-10-31 01:42:02-- http://archive.cloudera.com/spark2/parcels/2.3.0.cloudera4/SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1 Connecting to 10.9.137.250:3888... connected. Proxy request sent, awaiting response... 200 OK Length: 41 [binary/octet-stream] Saving to: ‘SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1’ 100%[=========================================================================================================================================================================>] 41 --.-K/s in 0s 2018-10-31 01:42:02 (3.01 MB/s) - ‘SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1’ saved [41/41] [root@node101 parcel-repo]# ll total 2257976 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel -rw-r--r--. 1 root root 41 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1 [root@node101 parcel-repo]#
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@node101 parcel-repo]# hostname node101.yinzhengjie.org.cn [root@node101 parcel-repo]# [root@node101 parcel-repo]# pwd /opt/cloudera/parcel-repo [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2257976 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel -rw-r--r--. 1 root root 41 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1 [root@node101 parcel-repo]# [root@node101 parcel-repo]# [root@node101 parcel-repo]# mv SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha1 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2257976 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel -rw-r--r--. 1 root root 41 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha [root@node101 parcel-repo]#
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@node101 parcel-repo]# hostname node101.yinzhengjie.org.cn [root@node101 parcel-repo]# [root@node101 parcel-repo]# pwd /opt/cloudera/parcel-repo [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2257976 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel -rw-r--r--. 1 root root 41 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha [root@node101 parcel-repo]# [root@node101 parcel-repo]# wget http://archive.cloudera.com/spark2/parcels/2.1.0.cloudera1/manifest.json --2018-10-31 01:45:24-- http://archive.cloudera.com/spark2/parcels/2.1.0.cloudera1/manifest.json Connecting to 10.9.137.250:3888... connected. Proxy request sent, awaiting response... 200 OK Length: 4677 (4.6K) [application/json] Saving to: ‘manifest.json’ 100%[=========================================================================================================================================================================>] 4,677 --.-K/s in 0s 2018-10-31 01:45:25 (229 MB/s) - ‘manifest.json’ saved [4677/4677] [root@node101 parcel-repo]# [root@node101 parcel-repo]# ll total 2257984 -rwxr-xr-x. 1 root root 2120090032 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel -rwxr-xr-x. 1 root root 41 Oct 26 07:19 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha -rw-r-----. 1 root root 81046 Oct 26 08:38 CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.torrent -rw-r--r--. 1 root root 4677 Feb 5 2018 manifest.json -rwxr-xr-x. 1 root root 73767 Oct 26 07:19 manifest.json.2018-10-31 -rw-r--r--. 1 root root 191904064 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel -rw-r--r--. 1 root root 41 Oct 5 05:45 SPARK2-2.3.0.cloudera4-1.cdh5.13.3.p0.611179-el7.parcel.sha [root@node101 parcel-repo]#
4>.重启Cloudera manager的服务端(我是离线方式部署的CDH)
[root@node101 ~]# hostname node101.yinzhengjie.org.cn [root@node101 ~]# [root@node101 ~]# cd /opt/cloudera-manager/cm-5.15.1/etc/init.d/ [root@node101 init.d]# [root@node101 init.d]# ll total 32 -rwxr-xr-x. 1 1106 4001 8871 Jul 31 06:28 cloudera-scm-agent -rwxr-xr-x. 1 1106 4001 8417 Jul 31 06:28 cloudera-scm-server -rwxr-xr-x. 1 1106 4001 4444 Jul 31 06:28 cloudera-scm-server-db [root@node101 init.d]# [root@node101 init.d]# ./cloudera-scm-server restart Stopping cloudera-scm-server: [ OK ] Starting cloudera-scm-server: [ OK ] [root@node101 init.d]#
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031140528193-1237428477.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031140620827-1548050682.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031140729316-1811722769.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031140805444-2109939970.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031140851563-1758999973.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031142517681-1386570359.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031142555195-1188831860.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031142912814-1248914074.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031143004833-341321782.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031143118155-1727044799.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031143200889-2072434390.png)
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031143326786-1191450757.png)
13>.在部署有gateway主机上运行spark2.3.0版本环境
![](https://img2018.cnblogs.com/blog/795254/201810/795254-20181031141213617-487279888.png)
解决方案:
很简单,我们在部署spark和spark2时,如果选择的时on yarn模式的话,人家已经指名道姓的让你安装YARN服务,因此我们只需要把yarn服务安装好再来安装spark2.3.0版本即可。
2>. 执行内存小雨分配最大内存。
启动spark2时报错如下:
Required executor memory (1024+384 MB) is above the max threshold (1024 MB) of this cluster! Please check the values of 'yarn.scheduler.maximum-allocation-mb' and/or 'yarn.nodemanager.resource.memory-mb'.
解决方案:
按照上图的报错信息提示,执行的内存超过来你分配的最大内存,因此按照提示去yarn服务的配置文件修改最大容器内存(yarn.scheduler.maximum-allocation-mb)和容器内存(yarn.nodemanager.resource.memory-mb)的值即可。我的建议是不要把操作系统的所有内存都分配出去,需要给操作系统预留点内存,推荐遵循二八法则(20%的内存分配给操作系统,80%的内存分配给服务)。