CDH安装

2 篇文章 0 订阅

环境

IP地址主机名
192.168.0.100hadoop-master
192.168.0.101hadoop-slave1
192.168.0.102hadoop-slave2

准备工作

  1. 关闭防火墙firewalld

    # systemctl stop firewalld
    # systemctl disable firewalld
    
    
  2. 关闭selinux

    # vi /etc/selinux/config
    ……
    SELINUX=disabled
    ……
    # setenforce 0 #立即生效
    
    
  3. 设置ntp

    #yum install ntpdate ntp -y
    #ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    #service ntpd restart
    #ntpd
    
  4. 设置hostname

    # hostnamectl set-hostname hadoop-master
    # hostnamectl set-hostname hadoop-slave1
    # hostnamectl set-hostname hadoop-slave2
    
  5. 设置hosts

    cat << EOF >> /etc/hosts
    192.168.0.100 hadoop-master
    192.168.0.101 hadoop-slave1
    192.168.0.102 hadoop-slave2
    EOF
    
  6. 设置免密码登录

    在所有节点生成秘钥
    # ssh-keygen -t rsa
    生成authorized_keys文件
    # cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
    将集群每个节点的公钥id_rsa.pub放入各节点的authorized_keys文件中
    
  7. 配置国内yum源

    # cd /etc/yum.repos.d/
    # wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
  8. 安装必要软件

    # yum update
    # yum install -y unzip zip mod_ssl telnet httpd lrzsz chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap redhat-lsb psmisc libaio*
    
  9. 配置不使用虚拟内存

    # echo 'vm.swappiness=0' >> /etc/sysctl.conf 
    # sysctl -p
    
  10. 禁用透明大页

    # 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.local
    #echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
    
  11. 安装JDK

    tar -zxvf jdk-8u152-linux-x64.tar.gz
    mkdir -p /usr/java
    mv jdk1.8.0_152/ /usr/java/
    # 设置软链接,方便升级替换
    ln -s /usr/java/jdk1.8.0_152/ /usr/java/current
    
    设置变量
    cat << EOF >> /etc/profile
    # JDK
    export JAVA_HOME=/usr/java/current
    export JRE_HOME=/usr/java/current/jre
    export PATH=$PATH:/usr/java/current/bin
    export CLASSPATH=./:/usr/java/current/lib:/usr/java/current/jre/lib
    EOF
    
    # 加载变量
    source /etc/profile
    
  12. 安装mysql

    安装MySQL
    tar -zxvf mysql-5.7.25-el7-x86_64.tar.gz -C /usr/local/
    mv /usr/local/mysql-5.7.25-el7-x86_64/ /usr/local/mysql
    # 添加账号
    groupadd mysql
    useradd -g mysql -s /sbin/nologin mysql
    # 创建"data"目录
    mkdir /data
    
    # 赋权
    chown -R mysql:mysql /usr/local/mysql/
    chown -R mysql:mysql /data/
    初始化MySQL
    cd /usr/local/mysql/
    bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data
    #获取root@localhost账号的初始密码
    
    设置变量
    cat << EOF >> /etc/profile
    # MySQL
    export PATH=$PATH:/usr/local/mysql/bin
    EOF
    
    # 加载变量
    source /etc/profile
    # 软链接
    ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
    ln -s /usr/local/mysql/include/mysql /usr/include/mysql
    #设置开机启动
    cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
    chown mysql:mysql /etc/rc.d/init.d/mysqld
    # 修改默认的"basedir"与"datadir"
    vim /etc/rc.d/init.d/mysqld
    basedir=/usr/local/mysql
    datadir=/data
    # 添加开机启动脚本
    chkconfig --add mysqld
    # 日志路径
    mkdir -p /var/log/mysqld
    touch /var/log/mysqld/mysqld.log
    chown -R mysql:mysql /var/log/mysqld/
    # pid路径
    mkdir -p /var/run/mysqld
    chown -R mysql:mysql /var/run/mysqld/
    
    # socker路径
    mkdir -p /var/lib/mysqld
    chown -R mysql:mysql /var/lib/mysqld/
    ln -s /var/lib/mysqld/mysql.sock /tmp/mysql.sock
    
    设置my.cnf文件
    # 注意"log-error","pid-file"与"socket"的路径
    mkdir -p /usr/local/mysql/etc
    cat << EOF >> /usr/local/mysql/etc/my.cnf
    [mysqld]
    character-set-server=utf8
    max_connections = 3000
    log-error=/var/log/mysqld/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    socket=/var/lib/mysqld/mysql.sock
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    
    [mysql]
    default-character-set=utf8
    EOF
    
    # 软链接
    ln -s /usr/local/mysql/etc/my.cnf /etc/my.cnf
    # 赋权
    chown -R mysql:mysql /usr/local/mysql/etc/
    # 启动服务
    service mysqld start
    # 使用初始化密码登陆
    mysql -uroot -p
    # 修改密码,注意不能使用"$"等特殊符号
    set password=password('cdh12#hadoop');
    flush privileges;
    # 远程登陆权限
    grant all privileges on *.*  to  'root'@'%'  identified by 'cdh12#hadoop'  with grant option;
    flush privileges;
    #创建必要数据库
    create database amon DEFAULT CHARACTER SET utf8;
    create database rman DEFAULT CHARACTER SET utf8;
    create database metastore DEFAULT CHARACTER SET utf8;
    create database sentry DEFAULT CHARACTER SET utf8;
    create database nav DEFAULT CHARACTER SET utf8;
    create database navms DEFAULT CHARACTER SET utf8;
    create database hive DEFAULT CHARACTER SET utf8;
    create database hue DEFAULT CHARACTER SET utf8;
    create database oozie DEFAULT CHARACTER SET utf8;
    create user hive identified by '123qwe!';
    create user hue identified by '123qwe!';
    create user oozie identified by '123qwe!';
    grant all on hive.* to 'hive'@'%' identified by '123qwe!' with grant option;
    grant all on hue.* to 'hue'@'%' identified by '123qwe!' with grant option;
    grant all on oozie.* to 'oozie'@'%' identified by '123qwe!' with grant option;
    FLUSH PRIVILEGES;
    
    

Cloudera Manager安装

  1. 部署CM Server & Agent
```
1、下载解压
# wget http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.15.2_x86_64.tar.gz
# tar -xvzf /opt/cloudera-manager-centos7-cm5.15.2_x86_64.tar.gz -C /opt/
2、配置slave
vi /opt/cm-5.15.2/etc/cloudera-scm-agent/config.ini
server_host=hadoop-master
```
  1. 创建用户

    # useradd --system --home=/home/cloudera-scm --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm 
    
  2. 上传mysql驱动

    # cp mysql-connector-java-5.1.47.jar /opt/cm-5.15.2/share/cmf/lib/
    
  3. 初始化数据库脚本

    # /opt/cm-5.15.2/share/cmf/schema/scm_prepare_database.sh mysql -h hadoop-master -uroot -predhat --scm-host % scm scm 123qwe!
    
  4. 下载parcel

    # cd /opt/cloudera/parcel-repo
    # wget http://archive.cloudera.com/cdh5/parcels/5.15.2/CDH-5.15.2-1.cdh5.15.2.p0.3-el7.parcel.sha1
    # mv CDH-5.15.2-1.cdh5.15.2.p0.3-el7.parcel.sha1 CDH-5.15.2-1.cdh5.15.2.p0.3-el7.parcel.sha
    # wget http://archive.cloudera.com/cdh5/parcels/5.15.2/CDH-5.15.2-1.cdh5.15.2.p0.3-el7.parcel
    
    # cd /opt/cloudera/csd
    # wget http://archive.cloudera.com/spark2/csd/SPARK2_ON_YARN-2.3.0.cloudera4.jar
    
  5. 启动cm

    # /opt/cm-5.15.2/etc/init.d/cloudera-scm-server start
    # tail -f /opt/cm-5.15.2/log/cloudera-scm-server/cloudera-scm-server.log
    
    # /opt/cm-5.15.2/etc/init.d/cloudera-scm-agent start
    # tail -f /opt/cm-5.15.2/log/cloudera-scm-agent/cloudera-scm-agent.log
    

zkUI安装

```
# cd /opt
# unzip zkui-master.zip
# cd zkui-master
# wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
# yum -y install apache-maven
# mvn clean install
# mkdir /opt/zkui
# cp config.cfg target/zkui-2.0-SNAPSHOT-jar-with-dependencies.jar /opt/zkui

# vi /opt/zkui/config.cfg
  serverPort=80
  zkServer=dg001:2181,dg002:2181
  userSet = {"users": [{ "username":"admin" , "password":"dgMysql1!","role": "ADMIN" },{ "username":"appconfig" , "NewPassword":"dgMysql1!","role": "USER" }]}
  
启动  
# cd /opt/zkui && nohup java -jar zkui-2.0-SNAPSHOT-jar-with-dependencies.jar &
```

组件安装(参考下一篇)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值