Centos7搭建CDH6.0.1(单机版)

Centos7搭建CDH6.0.1(单机版)

一、前言。

学习大数据组件,最好的方式是直接参照官网。不过官网的教程也让我吃了一坑,在此记录一下。因在个人笔记本资源有限,在此安装为单机版安装

官网参考地址:https://docs.cloudera.com/documentation/enterprise/6/6.0/topics/install_cm_cdh.html

二、搭建。

1.1配置主机名

hostnamectl set-hostname cdh

1.2配置hosts文件

vi /etc/hosts之后进行编辑,加入本机的ip映射关系(非单机时,有多个ip时,均加进来)

192.168.159.133 cdh

1.3关闭selinux

setenforce 0

1.4关闭防火墙

systemctl stop firewalld.service

systemctl disable firewalld.service

1.5配置免密登录

ssh-keygen (后面一路回车就行)

ssh-copy-id cdh(cdh为主机名,非单机时有多个ip时,则执行多次进行免密配置)

1.6配置时间同步(时间服务器使用已有的,在此不介绍时间服务器的搭建1)yum install nt2)vi /etc/ntp.conf加入以下内容server 0.pool.ntp.org

3)sudo systemctl start ntpd
4)sudo systemctl enable ntpd
5)ntpdate -u 0.pool.ntp.org
6)hwclock --systohc

**1.7安装JDK
**1)下载jdk
2)将jdk放至/usr/java/目录下(一定要放至此目录下,否则Clouder-Manager启动会失败!!!)
3)解压并配置JAVA_HOME与PATH环境变量
4)导入TLS

**1.8安装Mysql(采用docker安装)
**1)安装docker
 yum install docker
system enable docker
vi /etc/docker/daemons.json并加入加速镜像地址 {``"registry-mirrors": ["http://hub-mirror.c.163.com"]``} system start docker

2)安装mysql
docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -d --restart=always -p 3306:3306 mysql:5.6
3)建库

CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm@123';  
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman@123';  
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue@123';  
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore@123';  
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry@123';  
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav@123';  
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms@123';  
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8\_general\_ci;  
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie@123';  

如果1290错误 就执行 flush privileges;

2.0安装Cloudera Manager
下载地址: https://archive.cloudera.com/cm6/6.0.1/redhat7/yum/RPMS/x86_64/
下载:
  1.cloudera-manager-daemons-6.0.1-610811.el7.x86_64.rpm
  2.cloudera-manager-server-6.0.1-610811.el7.x86_64.rpm
  3.cloudera-manager-agent-6.0.1-610811.el7.x86_64.rpm
执行rpm安装: rpm -ivh cloudera-*

2.1兼容问题

升级python

一、安装过程
#rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps

#whereis python |xargs rm -frv

  1. 先安装相应的依赖
    yum -y install gcc openssl-devel bzip2-devel
    如果没安装好这些依赖的,后面还要重新走编译流程,别问我为什么知道 。
  2. 下载软件包
    cd /opt
    wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
  3. 解压安装包
    tar xvzf Python-2.7.15.tgz
  4. 安装
    cd Python-2.7.15
    ./configure --enable-optimizations
    make && make altinstall
    在检测脚本中加上enable-optimizations优化,主要是在这个版本上能启用PGO优化,让Python在运行时能变得更快,详细参考[2]。make 加altinstall参数,避免覆盖原来安装在/usr/bin/python 的版本。
  5. 查看安装是否成功
    /usr/local/bin/python2.7 -V
    –>
    Python 2.7.15
  6. 建立软连接,使系统默认python指向2.7版本
    mv /usr/bin/python /usr/bin/python2.6.6
    ln -s /usr/local/bin/python2.7 /usr/bin/python
  7. 解决yum不支持python2.7的问题
    sed -i ‘s/python/python2.6.6/’ /usr/bin/yum
    或者直接用vi编辑/usr/bin/yum把头部的python换成2.6.6。ps:编辑前记得备份。
    如果报错ImportError: No module named site 配置环境变量
    export PYTHONPATH=’/usr/local/lib/python2.7:/usr/local/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/site-packages’
    export PYTHONHOME=’/usr/local/lib/python2.7’

**2.2设置数据库
**格式为:/opt/cloudera/cm/schema/scm_prepare_database.sh [options] -h
执行时:/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h cdh scm root root

导入STL:JAVA_HOME=/usr/java/${jdk名称} /opt/cloudera/cm-agent/bin/certmanager setup --configure-services

单机版时执行:
  systemctl start cloudera-scm-server
  查看日志:tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
  显示如下表示服务已经正常起来:INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
  vi /etc/cloudera-scm-agent/config.ini,修改server_host=cdh
  启动cloudera-scm-agent服务:systemctl start cloudera-scm-agent
  查看cloudera-scm-agent状态:systemctl status cloudera-scm-agent
  查看cloudera-scm-agent日志:tail -f /var/log/cloudera-scm-agent/cloudera-scm-agent.log

多机版时:
  在server端执行cloudera-scm-server与cloudera-scm-agent操作
  在agent端只执行cloudera-scm-agent操作

2.1配置CDH
Cloudera Manager Server启动起来以后就可以登录Web界面进行CDH的安装配置工作了。
在浏览器中输入 http://192.168.1.101:7180,默认用户名与密码均为:admin
**
2.2之后按自己的安装需要去安装大数据组件即可,就不一一介绍了。**

你可能感兴趣的:(CDH,大数据,安装教程,大数据)