Cloudera Manager CDH4的安装

时间:2021-06-22 04:39:19

Cloudera-managercdh4安装有在线安装和离线安装,本文以离线安装的方式进行讲解。

一、操作系统及软件的要求

1CDH4很多相关依赖包都是64位,所以操作系统要求是64

2、测试环境操作系统是Rhel6.2-x86-64

3Cloudera Manager 4.5.2

4JDK 1.6.0.31

5CDH4.1.2

二、关闭系统防火墙

1、关闭selinuxsetenforce 0或修改/etc/sysconfig/selinux/SELINUX=disabled

2sudo service iptables stop

 3sudo chkconfig iptables off

4sudo chkconfig iptableslist

5、启动httpd服务

6、关闭防火墙:service iptables stop

7、在/etc/hosts配置相关的主机IP地址与域名的映射

 

三、安装文件及相关依赖库的数据准备

1、下载CM地址:http://archive.cloudera.com/cm4/redhat/6/x86_64/cm/

2、下载CDH4地址:http://archive.cloudera.com/cdh4/redhat/6/x86_64/cdh/

3、将下载好的rpm包放到/var/www/html/repo/目录下

4、将系统的镜像挂载(或拷贝)到/media/rhel/目录下

5、在/etc/yum.repos.d/目录下创建相关的repo文件

A、本地镜像的repo文件(rhel-local.repo 

[rhel-local]

name= rhel-local

baseurl=file:///media/rhel

enabled=1

gpgcheck = 0

Bcmcdh4所依赖的rpm包所对应的repo文件(cm-cdh4.repo

[cm-cdh4]

name = cm-cdh4

baseurl = http://192.168.1.101/repo

gpgcheck = 0

enabled=1

 

四、安装本地源

1yum install createrepo

执行以上命令报错

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51:

NOKEY Public key for python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm is not  installed

    解决办法:将/etc/yum.repos.d/下的所有repo文件里gpgcheck属性设置

       gpgcheck = 0

2、修改repo目录的权限:chmod -R ugo+rX /var/www/html/repo

3、进到/var/www/html/repo/目录下执行

      createrepo .

      该命令的作用是将该目录下的所有安装包与yum的元数据同步(我个人理解)

 4、注意问题

    在测试环境的6台机器是由一个路由器和一个交换机来搭建,其本身可以设置代理来上网,但不能用ping命令,我测试了一上yum不能访问外网,所以选择用本地yum来安装。由于这6台机器可以通过设置代理来访问互联网,当选用本地yum来安装后就必须不要设置代理,否则会访问不到http://192.168.1.101/repo地址。既然用的是http协议,那么就必须启动httpd服务。这里有两个源,一个是cloudera-managercdh4RPM包以及相关的依赖包。安装这些包时有一些rpm包依赖系统的类库,所以必须还要将系统的镜像交给yum

五、开始安装Cloudera-manager

1、安装jdk sudo yum install jdk

2、安装cm的内置数据数据

sudo yum install cloudera-manager-server-db

3、安装cm服务

 sudo yum install cloudera-manager-daemons

sudo yum install cloudera-manager-server

4、初始化数据库

     sudo service cloudera-scm-server-db initdbCM4.5.2好像没有这个命令)

5、启动CM内嵌数据库 sudo service cloudera-scm-server-db start

CM4.5.2版本第一次执行该命令时,会先初始化数据库,即创建相关的数据库表以及初始化相关配置

执行启动内嵌数据库时会报如下错误信息

 [root@master lib]# service cloudera-scm-server-db start

hostname: 主机名搜索失败

属于此数据库系统的文件宿主为用户 "cloudera-scm".

此用户也必须为服务器进程的宿主.

数据库簇将带有 locale en_US.UTF8初始化.

缺省的文本搜索配置将会被设置到"english"

修复已存在目录 /var/lib/cloudera-scm-server-db/data的权限 ... initdb: 无法改变

目录 "/var/lib/cloudera-scm-server-db/data"的权限: 权限不够

Could not initialize database server.This usually means that your PostgreSQL installation failed or isn't working properly. PostgreSQL is installed using the set of repositories found on this machine. Please ensure that PostgreSQL can be installed. Please also uninstall any other instances of PostgreSQL and then try again., giving up

执行以下两个两个命令解决以上的问题

su -s /bin/bash cloudera-scm -c "touch /var/log/cloudera-scm-server/db.log; 

/usr/share/cmf/bin/initialize_embedded_db.sh /var/lib/cloudera-scm-server-

db/data /var/log/cloudera-scm-server/db.log"

su -s /bin/bash cloudera-scm -c "pg_ctl start -w -D /var/lib/cloudera-scm-

server-db/data -l /var/log/cloudera-scm-server/db.log"

 

6、启动CM服务

sudo service cloudera-scm-server start 

六、在CM上安装CDH4

由于已经安装完了,现在没机器了,所以也不能截图了,在此做一些安装提示吧

1、  CDH4选择列表下有一个自定义路径输入:http://192.168.1.101/repo

2、  impala选列表下选择无,此服务相当于hive,目前用的不多,此服务暂时不要安装

3、  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 这一栏为空

4、  cloudera-manager那栏选自定义路径输入:http://192.168.1.101/repo

5、  安装过程中遇到错误根据错误提示完之后配置服务

Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装
Cloudera Manager CDH4的安装

6、  遇到以上错误可能原因有二

(1)       选安装的时候没有输入自己的本地yum路径:http://192.168.1.101/repoclouder manager在默认不输入时选用官方网的安装包路径,由于本地yum外网不通,所以报此错

(2)       本地yum没配置对,需要检查安装cloudera-manager的机器的/etc/yum.repos.d/目录下的yum配置

(3)       检查安装包是否有冲突,比如同一服务有两个版本存在

7、  安装安成之后给主机分配角色、服务

Cloudera Manager CDH4的安装

Cloudera Manager CDH4的安装

Cloudera Manager CDH4的安装

七、经验总结

1、由于几台机器时间不同步导致Hbase启不来的情况

修改linux操作系统的时间

    step1: date -s 12/03/2013

    step2:date -s 13:59:00

    step3: clock -w //将操作系统的时间与cmos的时间同步

2、Hive报错

由于metastore server还没启来,所以会报如下错误

hive> show tables;      

 FAILED: Error in metadata: MetaException(message:Could not connect to meta store using any of the URIs provided)  

 FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask 

 Solution:hive --service metastore & 

 

hive有两个服务

  (1)启动hive的metadatastore服务:nohup hive --service metastore &

   (2)启动hive的基础服务:nohup hive --service hiveserver2 &

3、设置10.71.197.201机器可以远程客户端访问mysql

  grant all privileges on *.* to 'root'@'10.71.197.201' identified by '123456' with grant option;

4、当有新安装包放到/var/www/html/repo目录下是需要执行

      命令: createrepo .

5、当删除CM后重新安装时,先清理一下

  rpm aq | grep cloudera #找到对应的cloudera安装包

  rpm ev cloudera-scm安装包 #卸载

rm -rf /usr/share/cmf  /var/lib/cloudera* /var/cache/yum/cloudera*

yum install createrepo

createrepo .

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Public key for python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm is not installed

 

[root@master lib]# service cloudera-scm-server-db initdb

[root@master lib]# service cloudera-scm-server-db start

 

hostname: 主机名搜索失败

属于此数据库系统的文件宿主为用户 "cloudera-scm".

此用户也必须为服务器进程的宿主.

数据库簇将带有 locale en_US.UTF8 初始化.

缺省的文本搜索配置将会被设置到"english"

 

修复已存在目录 /var/lib/cloudera-scm-server-db/data的权限 ... initdb: 无法改变目录 "/var/lib/cloudera-scm-server-db/data"的权限: 权限不够

Could not initialize database server.

  This usually means that your PostgreSQL installation failed or isn't working properly.

  PostgreSQL is installed using the set of repositories found on this machine. Please

  ensure that PostgreSQL can be installed. Please also uninstall any other instances of

  PostgreSQL and then try again., giving up

 

 

 

启动cm失败,71807182端口出不来的原因

[root@master ~]# service cloudera-scm-server-db restart

pg_ctl:没有服务器进程正在运行

DB initialization done.

等待服务器进程启动 ...............................................................无法启动服务器进程

cat cloudera-scm-server.log

cache.spi.UpdateTimestampsCache]; using defaults.

2013-12-07 04:49:26,045  INFO [main:internal.StandardQueryCache@83] HHH000248: Starting query cache at region: org.hibernate.cache.internal.StandardQueryCache

2013-12-07 04:49:26,046  WARN [main:ehcache.AbstractEhcacheRegionFactory@180] HHH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.internal.StandardQueryCache]; using defaults.

2013-12-07 04:49:26,134  INFO [main:enterprise.CommonMain@191] Statistics not enabled, JMX will not be registered

2013-12-07 04:49:43,412  WARN [Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@7c9b87f6:resourcepool.BasicResourcePool@1841] com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@69b0de2e -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 

org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:136)

        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)

        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)

        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)

        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)

        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:30)

        at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)

        at org.postgresql.Driver.makeConnection(Driver.java:393)

        at org.postgresql.Driver.connect(Driver.java:267)

[root@master cloudera-scm-server]# cat db.log 

postgres cannot access the server configuration file "/var/lib/cloudera-scm-server-db/data/postgresql.conf": Permission denied

postgres cannot access the server configuration file "/var/lib/cloudera-scm-server-db/data/postgresql.conf": Permission denied

postgres cannot access the server configuration file "/var/lib/cloudera-scm-server-db/data/postgresql.conf": Permission denied

postgres 无法处理服务器的配置文件 "/var/lib/cloudera-scm-server-db/data/postgresql.conf": 权限不够

postgres 无法处理服务器的配置文件 "/var/lib/cloudera-scm-server-db/data/postgresql.conf": 权限不够

[Postgres]postgresql.conf : Permission denied处理一法


 

使用yum安装完postgresql,没有使用默认的DATA地址,自己配置了DATA地址以后,使用root权限启动service

service postgresql start,报出了"FAILED"

不解,检查Log文件 /var/lib/pgsql/pgstartup.log.发现如下记录

postmaster cannot access the server configuration file"/var/lib/pgsql/data/postgresql.conf": Permission denied于是检查postgres用户的文件权限,没有明显的问题,可读可写(忘了好像是700),于是上网一查,基本怀疑问题在SELinux

先检查SELinux状态

# sestatusSELinux status:                 enabled

SELinuxfs mount:                /selinux

Current mode:                   enforcing

Mode from config file:          enforcing

Policy version:                 21

Policy from config file:        targeted

 

果然是运行状态,并且还是在"enforcing"模式,检查SELinuxLog(大部分情况在/var/log/audit/,有时也会被配置到/var/log/messages)

 

# grep postgres /var/log/audit/audit.log | grep denied | tail -1

type=AVC msg=audit(1234567890.334:432): avc:  denied  { read } for

pid=1234 comm="postmaster" name="pgsql" dev=newpgdisk ino=403123 

scontext=user_u:system_r:postgresql_t:s0

tcontext=system_u:object_r:var_lib_t:s0 tclass=lnk_file

有一条拒绝记录!就这玩意干的。

这里说个最简单干脆的方法,停用SELinux.

 

编辑/etc/selinux/config:

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of these two values:

# targeted - Only targeted network daemons are protected.

# strict - Full SELinux protection.

SELINUXTYPE=targeted

SELINUX=enforcing 改成 SELINUX=permissive或者SELINUX=disabled,重启系统

再次启动postgresql,问题解决

可参考:http://blog.endpoint.com/2009/09/permission-denied-for-postgresqlconf.html

http://www.crypt.gen.nz/selinux/disable_selinux.html

http://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html