CDH6 服务安装全记录,CDH6.0.0到6.3.2均适用,3节点

一、服务器准备

1、服务器配置

准备3台服务器,建议最低配置如下(阿里云大约每台每月六百多):
centos7.4 8c 16G

39.101.192.109 node001
39.101.179.3 node002
39.99.236.205 node003

为服务器开启外网端口访问
7180、8900

2、下载安装包

把下面列出的共12个文件下载到一台文件服务器上

下载cdh文件到/var/www/html/cloudera-repos/目录
(1)https://archive.cloudera.com/cdh6/6.0.0/parcels/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel
(2)https://archive.cloudera.com/cdh6/6.0.0/parcels/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha256
(3)https://archive.cloudera.com/cdh6/6.0.0/parcels/manifest.json

下载repo支持文件到/var/www/html/cloudera-repos/repodata/目录
(4)https://archive.cloudera.com/cdh6/6.3.2/redhat7/yum/repodata/repomd.xml
(5)https://archive.cloudera.com/cdh6/6.3.2/redhat7/yum/repodata/3224703272392229e02b46c2ef95286e92cce148a07c04752bcfe98870bfd675-primary.sqlite.bz2
(6)https://archive.cloudera.com/cdh6/6.3.2/redhat7/yum/repodata/4f1d5a908a6b4fd79988109121695168a65ef0846f178bbf32dc99f92c7cef36-filelists.sqlite.bz2

下载cm文件到/var/www/html/cloudera-repos/RPMS/x86_64/目录
(7)https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.0.0-530873.el7.x86_64.rpm
(8)https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.0.0-530873.el7.x86_64.rpm
(9)https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.0.0-530873.el7.x86_64.rpm
(10)https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-db-2-6.0.0-530873.el7.x86_64.rpm
(11)https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm

下载文件到/var/www/html/cloudera-repos/目录
(12)https://archive.cloudera.com/cm6/6.0.0/allkeys.asc

3、配置文件服务器

启动一个http服务器用于安装rpm安装包,以及方便后面cdh安装

cd /var/www/html/
cp ./cloudera-repos/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha256 ./cloudera-repos/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha
cp ./cloudera-repos/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha256 ./cloudera-repos/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha1
python -m SimpleHTTPServer 8900

为所有需要升级的服务器配置本地repo库

vi /etc/yum.repos.d/cloudera-manager.repo
[cloudera-manager]
name=Cloudera Manager 6.0.0
baseurl=http://node001:8900/cloudera-repos/
gpgcheck=0
enabled=1

测试配置是否生效

yum deplist cloudera-manager-agent

二、环境准备

1、设置服务器超时时间1小时

/etc/profile中添加

export TMOUT=3600 # 超时时间1小时

让配置生效

source /etc/profile

/etc/ssh/sshd_config中添加

ClientAliveInterval 60 # 每60秒检测一次客户端是否存在
ClientAliveCountMax 3 # 检测3次

修改配置后,重启sshd服务

systemctl restart sshd

2、配置3节点免密登录

在每一台服务器中的/etc/hosts添加节点名字

172.26.53.202 node001
172.26.53.203 node002
172.26.53.204 node003

在每一台服务器中生成rsa密钥,一路按回车即可

ssh-keygen -t rsa

在每一台服务器执行如下命令,让3台服务器可互相免密登录

ssh-copy-id -i ~/.ssh/id_rsa.pub root@node001
ssh-copy-id -i ~/.ssh/id_rsa.pub root@node002
ssh-copy-id -i ~/.ssh/id_rsa.pub root@node003

3、 修改transparent_hugepage参数(透明大页面压缩)

echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.d/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local

三、cdh安装

1、每台服务器安装java

yum install oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm

在/etc/profile中追加如下配置:

JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$PATH:$JAVA_HOME/bin:$HOME/bin:$HOME/.local/bin

让配置生效

source /etc/profile

2、安装mysql

下载安装包,安装mysql-server

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 mysql-server

设置mysql大小写不敏感(非常重要
修改/etc/my.conf文件中 [mysqld] 的内容

lower_case_table_names=1

启动mysql服务,并把mysql加入开机启动

systemctl start mysqld
systemctl enable mysqld

登录到mysql

mysql -uroot -p

为root用户授外网访问权限

GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '##你的密码##';
flush privileges;

4、安装

sudo yum clean all
sudo yum upgrade cloudera-manager-daemons cloudera-manager-agent
rpm -qa 'cloudera-manager-*'

5、初始化数据库

mysql -uroot -p
# Cloudera Manager的数据库
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm@123';
# Activity Monitor的数据库
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon@123';
# Reports Manager的数据库
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman@123';
# Hue的数据库
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue@123';
# Metastore的数据库
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore@123';
# Sentry的数据库
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry@123';
# Cloudera Navigator Audit Server的数据库
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav@123';
# Cloudera Navigator Metadata Server的数据库
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms@123';
# Oozie的数据库
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie@123';
# Hive的数据库
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive@123';
flush privileges;

6、使用scm初始化mysql

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

7、主节点启动server

systemctl start cloudera-scm-server
systemctl enable cloudera-scm-server
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
systemctl status cloudera-scm-server

8、子节点启动agent

配置server服务器地址

vim /etc/cloudera-scm-agent/config.ini
server_host=node001

启动agent服务

systemctl start cloudera-scm-agent
systemctl enable cloudera-scm-agent
tail -f /var/log/cloudera-scm-agent/cloudera-scm-agent.log
systemctl status cloudera-scm-agent

9、网页访问cm

http://39.101.192.109:7180/

四、异常解决方案

1、SqlExceptionHelper - Table ‘scm.CM_VERSION’ doesn’t exist

如果为linux系统,mysql修改为大小写不敏感,修改/etc/my.conf文件中 [mysqld] 的内容

lower_case_table_names=1
systemctl restart mysql

删除scm数据库,新建数据库,重新执行scm_prepare_database.sh

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

2、cm-server[38046]: ERROR StatusLogger No log4j2 configuration file found.

看一下/var/log/cloudera-scm-server/cloudera-scm-server.log日志,可能为其他包中报了其他的异常,导致找不到log4j2的配置。例如找不到数据表,或者数据表数据为空等。

3、scm.hosts not exist 或者表无数据

(1)如果为linux系统,mysql修改为大小写不敏感,删除scm数据库后,新建数据库,重新执行scm_prepare_database.sh
(2)主机名冲突: https://blog.csdn.net/NeverGiveup54/article/details/102836562
(3)未设置主机名,在hosts中未设置主机名与ip的映射关系

4、cm安装完成后,无法访问

(1)如果是自建服务器,可以关闭防火墙,或者开放网络端口
(2)如果是从阿里云或腾讯云购买的服务器,通过管理控制台开放网络端口

5、找不到哈希文件

sha1文件重命名为sha,要保证这里的sha的哈希在mainfest.json中一致。
在界面中修改“更多选项”中的列表,添加一个新的,然后再删除,相当于刷新一遍缓存。

6、找不到cloudera-repos/allkeys.asc

未下载这个文件,在网上下载这个文件后放到/var/www/html/cloudera-repos/目录

7、cdh离线安装无法复制文件

sha256文件重命名为sha和sha1,要保证这里的sha的哈希在mainfest.json中一致。

8、主机运行状态不良 / Cluster not found

https://blog.csdn.net/u011031430/article/details/74057601
在cm界面中,退回上一步

rm -f /opt/cloudera-manager/cm/lib/cloudera-scm-agent/cm_guid

或者

rm -f /var/lib/cloudera-scm-agent/cm_guid
systemctl restart cloudera-scm-agent

9、CDH HDFS:NameNode is not formatted.

未使用的集群使用:hadoop namenode -format
已有数据的集群:https://blog.csdn.net/weixin_44202548/article/details/86496440

10、Starting cloudera-scm-server: [FAILED]

systemctl status -l cloudera-scm-server

查看具体的失败原因,如果未找到可以在日志文件中查看原因

vi /var/log/cloudera-scm-server/cloudera-scm-server.log

11、cloudera-scm-agent日志中有错误

rm -f /opt/cloudera-manager/cm-5.11.1/lib/cloudera-scm-agent/cm_guid

或者

rm -f /var/lib/cloudera-scm-agent/cm_guid
systemctl restart cloudera-scm-agent

12、启动cloudera-scm-agent,cloudera-scm-server时,说JDK不支持,要使用oracle jdk

一般在安装前就会报这个错,如果你已经安装了oracle jdk,检查环境变量是否配置JAVA,或者删除系统中的openjdk,重新安装oracle jdk

13、无法发出查询:未能连接到Host Monitor

未初始化scm数据导致的,可能是由于在新建集群后,中断安装导致的
解决办法为:在CM界面删除集群,停止cm服务,并在后台停止服务

systemctl stop cloudera-scm-agent
systemctl stop cloudera-scm-server

重新从 第三章的第6小结开始

14、Hive启动失败,报如下错误

Command failed to run because this role has an invalid configuration. Review and correct its configuration. First error: Enable Stored Notifications in Database is required by Sentry and must be enabled.

需要在Sentry中设置hive_enable_db_notification,这个选项打上勾。

15、Hive启动失败,报如下错误

Command failed to run because server kudu has an invalid configuration. Review and correct its configuration. First error: Sentry authraizion in Kudu required that Hive is configured with Kudu.

重启Hive后,Resume。

16、全部安装好后,impala一直在重启,看日志显示:

Could not connect to meta store using any of the URIs provided. Most recent failure:.......Commection refused
Failed to connect to the MetaStore Server...
Failed to connect to Hive MetaStore. Retrying.

(1)重启Hive、MetaStore,通过命令行连接Hive,看是否正常
(2)检查hive连接的数据库,数据库名可能为hive或者metastore,看里面是否有29张表,表中是否有数据
(3)如果库中没有表或没有数据,则

17、用beeline连接hiveServer2时,报下面的错

FAILED: InvalidConfigurationException hive.server2.authentication can’t be none in non-testing mode
修改hive-site.xml中的testing.mode为true

<property>
  <name>sentry.hive.testing.mode</name>
  <value>true</value>
</property>

18、通过beeline连接hive后切换database,显示如下:

User Hive does not have privileges for SWITCHDATABASE

新建角色,赋权限给hive用户
https://blog.csdn.net/lvtula/article/details/89177670

19、Sentry启动HA的时候,报错,后台提示com.mysql.jdbc.Driver找不到

在HA的节点中,看一下/share/lib/有没有jdbc的jar包。如果没有,下载一个到该目录
https://dev.mysql.com/downloads/connector/j/5.1.html

20、HDFS、YARN webui无法访问

(1)如果域名绑定的是内网的IP,那这个WebUI默认绑定内网IP,可以在HDFS / YARN 配置中搜索“通配符”,把NameNode和DataNode使用通配符的选项勾选
(2)搜索webui,关闭kerberos的配置

你可能感兴趣的:(hadoop)