前言
闲暇之时,羚羊给大家分享一下羚羊在Centos7 下安装Cloudera Manager 6.3.0和cloudera cdh 6.3.2的过程和安装过程中遇到的坑。至于为什么要选择CDH,Cloudera Manager和cdh是什么,之间又是什么关系,在这里羚羊就不做介绍了。
为什么选择CDH6.3.2这个版本,给大家看个Cloudera公司今年初发布的消息:
上面大概是说6.3.3版本以上,需要许可证,有帐号才能下载安装包,意思就是收费。所以羚羊就安装了6.3.2。至于为什么用的是Cloudera Manager 6.3.0,其实没什么问题。Cloudera Manager和CHD之间的版本兼容方面,官方是这么说:
对于Cloudera Manager和CDH,Cloudera公司使用主版本和次版本来管理:主版本+次版本+维护版本,像Cloudera Manager 6.3.0,它的主版本是6,次版本是3,维护版本是0。然后版本兼容规则是这样:Cloudera Manager <主要> + <次要>版本必须始终等于或大于CDH <主要> + <次要>版本。较旧版本的Cloudera Manager可能识别不出CDH的高版本安装包来,就是不兼容。当然,最好也不要使用高版本的Cloudera Manager去安装低版本的CDH。更多信息大家多花时间去看看官网就获取更多的消息了。下面羚羊开始记录羚羊的安装过程。
安装
Cloudera Manager 6.3.0安装
由于在线安装下载比较慢,羚羊都先下载到本地后离线安装啦。
IP
|
HostName
|
OS
|
安装用户
|
备注
|
10.111.15.162
|
cdh6-master
|
CentOS 7.5
|
hadoop |
|
10.111.15.163
|
cdh6-slave1
|
CentOS 7.5
|
hadoop | |
10.111.15.164
|
cdh6-slave2
|
CentOS 7.5
|
hadoop | |
10.111.15.166
|
cdh6-slave3
|
CentOS 7.5
|
hadoop | |
10.111.15.167
|
mysql数据库
|
CentOS 7.5 | hadoop | 也可以跟CM master同一台机器 |
hosts配置
在hosts文件末尾加配置:sudo vim /etc/hosts
JDK安装
cd /usr/java tar -xvf jdk-8u251-linux-x64.tar.gz vim ~/.bash_profile
加入内容:
export JAVA_HOME=/usr/java/jdk1.8.0_251 export PATH=$JAVA_HOME/bin:$PATH export JRE_HOME=$JAVA_HOME/jre
source ~/.bash_profile
验证是否安装成功:java -version
注意:一定要64位,如果系统是64位,不然启动hdfs的时候会提示:libhadoop.so.1.0.0 无法加载的问题,原因是libhadoop依赖 64位的libjvm.so
关闭selinux
sudo vim /etc/selinux/config
SELINUX=disabled
安装依赖
sudo yum install -y bind-utils psmisc libxslt cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs httpd mod_ssl openssl-devel python-psycopg2 MySQL-python /lib/lsb/init-functions libpq.so.5
wget http://www.percona.com/redir/downloads/Percona-XtraDB-Cluster/5.5.37-25.10/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm sudo rpm -ivh Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
sudo yum install python27
SSH免登录配置
cd /home/hadoop/.ssh ssh-copy-id -p 41122 -i ./id_rsa.pub hadoop@cdh6-master ssh-copy-id -p 41122 -i ./id_rsa.pub hadoop@cdh6-slave1 ssh-copy-id -p 41122 -i ./id_rsa.pub hadoop@cdh6-slave2 ssh-copy-id -p 41122 -i ./id_rsa.pub hadoop@cdh6-slave3
NTP安装
sudo yum -y install ntp sudo /etc/ntp.conf
## 加入时间服务器:
PS: 或在https://www.pool.ntp.org/zone/asia找最适合的时间服务器
sudo service ntpd restart
安装 6.3.0yum源
所有节点上执行:
sudo curl -o /etc/yum.repos.d/cloudera-manager.repo https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/cloudera-manager.repo rpm --import https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPM-GPG-KEY-cloudera
各节点安装mysql驱动
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz # 解压 tar -zxf mysql-connector-java-5.1.46.tar.gz # 放到指定目录 (一定要改名为mysql-connector-java.jar)sudo cp mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar
master节点安装cloudera-manager server
sudo yum localinstall ./cloudera-manager-daemons-6.3.0-2117683.el7.x86_64.rpm ./cloudera-manager-server-6.3.0-2117683.el7.x86_64.rpm cloudera-manager-server -y
cd /opt/cloudera/cm
可以看到安装目录下很多文件:
rpm -qa|grep cloudera-manager
连接数据库配置
sudo vim /etc/cloudera-scm-server/db.properties
创建数据库
各角色如:scm、amon、rman、hue、metastore、sentry、nav、navms、oozie,需要用到数据。需要先创建好
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
数据库跟master不在同一台机器上,需要授权访问
grant all privileges on *.* to 'hadoop'@'101.111.14.123' identified by 'xxxxxx' with grant option;
grant all privileges on *.* to 'scm'@'master.cdh6' identified by 'xxxxxx' with grant option;
flush privileges;
master节点上执行脚本
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h 10.111.15.167 --scm-host cdh6-master scm scm
PS:开启gtid模式,可能会报错:Error Code: 1786 Statement violates GTID consistency: CREATE TABLE ... SELECT
启动
sudo systemctl start cloudera-scm-server
查看启动日志
sudo tail -100f /var/log/cloudera-scm-server/cloudera-scm-server.log
各从节点安装Agent
sudo yum localinstall ./cloudera-manager-agent-6.3.0-2117683.el7.x86_64.rpm ./cloudera-manager-daemons-6.3.0-2117683.el7.x86_64.rpm cloudera-manager-agent -y
修改所有子节点的CM主机地址
sudo vim /etc/cloudera-scm-agent/config.ini # 将server_host修改为CM-Server所在的主机名 server_host=cdh6-master
启动
sudo systemctl start cloudera-scm-agent
查看日志
sudo tail -100f /var/log/cloudera-scm-agent/cloudera-scm-agent.log
登录(admin/admin)
CDH 6.3.2安装
下载CDH6安装包
下载地址:https://archive.cloudera.com/cdh6/6.3.2/parcels/
只下载红圈文件即可,其中7代表centos7
#全部下载 nohup sudo wget --recursive --no-parent --no-host-directories https://archive.cloudera.com/cdh6/6.3.2/parcels/ -P /var/www/html/cloudera-repos & nohup sudo wget --recursive --no-parent --no-host-directories https://archive.cloudera.com/gplextras6/6.3.2/parcels/ -P /var/www/html/cloudera-repos &
安装Apache HTTP Server
sudo yum install httpd
启动
systemctl start httpd
界面向导安装
上图是启动服务后的界面效果,配置方面还需要调整和优化。羚羊运气不太好,所以安装过程遇到很多问题,下面羚羊就分享比较有代表性的问题
问题
一、安装CDH时出现:com.cloudera.server.web.cmf.csrf.CsrfRefererInterceptor: Rejecting request originating from [url] refering [url]
二、安装agent出现问题:
三、测试hue数据库连接异常:
对应异常日志:
解决:
下载或从别的机器copy libmysqlclient.so.18包
sudo ln -s /usr/lib64/mysql/libmysqlclient.so.18.0.0 /usr/lib64/mysql/libmysqlclient.so.18
sudo vim /etc/ld.so.conf
#加libmysqlclient.so.18所在的目录
/usr/lib64/mysql
四、角色启动目录权限问题
五、web界面经常报"查询 Service Monitor 时发生内部错误
六、hive初始化数据:schematool -initSchema -dbType mysql失败,无法启动hive
Metastore connection URL: jdbc:derby:;databaseName=metastore_db;create=true Metastore Connection Driver : org.apache.derby.jdbc.EmbeddedDriver Metastore connection User: APP Starting metastore schema initialization to 2.1.0 Initialization script hive-schema-2.1.1.mysql.sql Error: Syntax error: Encountered “” at line 1, column 64. (state=42X01,code=30000) org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !! Underlying cause: java.io.IOException : Schema script failed, errorcode 2 Use --verbose for detailed stacktrace. *** schemaTool failed ***
解决:在hive-size.xml加如下内容
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://msyql_ip:3306/hive?useUnicode=true&characterEncoding=UTF-8</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>user</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>passwd</value> </property> <property>
【版权声明】
本文版权归作者(深圳伊人网网络有限公司)和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文链接,否则保留追究法律责任的权利。如您有任何商业合作或者授权方面的协商,请给我留言:siqing0822@163.com