CDH 安装与部署
基础环境配置
安装环境信息
修改主机名
hostnamectl set-hostname node01
hostnamectl set-hostname node02
hostnamectl set-hostname node03
复制代码
修改主机名映射
10.0.0.7 node01
10.0.0.14 node02
10.0.0.22 node03
复制代码
关闭防火墙和 Selinux
#关闭SELinux
setenforce 0
grep 'SELINUX=enforcing' /etc/selinux/config && sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#关闭firewall
systemctl stop firewalld.service
systemctl disable firewalld.service
复制代码
系统初始化参数调整 (设置 swap 和透明大页面)
sysctl vm.swappiness=1
echo 'vm.swappiness=1' >> /etc/sysctl.conf
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
#设置集群的文件打开数
vim /etc/security/limits.d/20-nproc.conf
* soft nproc 409600
root soft nproc unlimited
vim /etc/security/limits.conf
* hard nofile 655350
* soft nofile 655350
复制代码
配置 ssh 免密登录
集群之间通过内网端口互相访问,配置ssh免密登录,注意开放外网端口需要配置iptables防火墙
#生成密码对 -所有节点
ssh-keygen -t rsa
#在每台节点分别执行以下命令
ssh-copy-id root@10.0.0.10
ssh-copy-id root@10.0.0.14
ssh-copy-id root@10.0.0.22
复制代码
三台节点配置时钟同步 & 安装相关依赖包
# 安装
yum -y install gcc python-devel cyrus-sasl* chrony iotop yum-utils yum-plugin-downloadonly psmisc ntp ntpdate createrepo wget git rsync mod_ssl cyrus-sasl-plain cyrus-sasl-devel cyrus-sasl-gssapi libxslt krb5-devel cyrus-sasl-gssapi cyrus-sasl-devel libxml2-devel libxslt-devel openldap-devel python-devel python-simplejson sqlite-devel
# 时钟同步
systemctl start ntpd
systemctl enable ntpd
复制代码
安装 http 服务
安装 httpd 服务
1、安装 nginx
#安装httpd服务:
yum -y install nginx
复制代码
2、添加配置
#修改/etc/nginx/conf.d/clouera.conf
server
{
listen 8000;
server_name _;
root /var/www/html;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8;
}
复制代码
3、启动 nginx
#启动httpd服务:
systemctl enable nginx
systemctl start nginx
复制代码
配置 Web 服务器
1、解压压缩包
#上传本地cdh6.2.1.tar.gz软件包到服务器/usr/local/src/目录并解压
scp cdh6.2.1.tar.gz root@10.0.0.7:/usr/local/src
tar zxvf /usr/local/src/cdh6.2.1.tar.gz
复制代码
2、配置 rpm 包
mv /usr/local/src/html/* /var/www/html/
复制代码
3、验证浏览器是否可以正常访问
配置 mysql
安装 Mysql
1、查询默认安装包卸载
rpm -qa |grep mariadb
yum -y remove mariadb-libs
复制代码
2、安装 mysql
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm && \
rpm -ivh mysql57-community-release-el7-11.noarch.rpm && \
yum install -y mysql-community-server mysql-community-devel
复制代码
3、启动 mysql
systemctl enable mysqld
systemctl start mysqld
复制代码
4、初始化 mysql 账号密码
grep 'temporary password' /var/log/mysqld.log
mysql_secure_installation
复制代码
5、创建对应的表和库
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8;
CREATE USER 'hive'@'%' IDENTIFIED BY 'xxxxx';
GRANT ALL PRIVILEGES ON metastore. * TO 'hive'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE cm DEFAULT CHARACTER SET utf8;
CREATE USER 'cm'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON cm. * TO 'cm'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE am DEFAULT CHARACTER SET utf8;
CREATE USER 'am'@'%' IDENTIFIED BY 'xxxxxxx';
GRANT ALL PRIVILEGES ON am. * TO 'am'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE rm DEFAULT CHARACTER SET utf8;
CREATE USER 'rm'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON rm. * TO 'rm'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8;
CREATE USER 'hue'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON hue. * TO 'hue'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8;
CREATE USER 'oozie'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON oozie. * TO 'oozie'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8;
CREATE USER 'sentry'@'%' IDENTIFIED BY 'xxxxxxx';
GRANT ALL PRIVILEGES ON sentry. * TO 'sentry'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE nav_ms DEFAULT CHARACTER SET utf8;
CREATE USER 'nav_ms'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON nav_ms. * TO 'nav_ms'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE nav_as DEFAULT CHARACTER SET utf8;
CREATE USER 'nav_as'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON nav_as. * TO 'nav_as'@'%';
FLUSH PRIVILEGES;
复制代码
6、安装 mysql 驱动
# 创建目录:
mkdir -p /usr/share/java/
# 上传本地jar包到服务器的指定目录中:
scp mysql-connector-java-5.1.47.jar root@10.0.0.7:/usr/share/java/
#进入目录:
cd /usr/share/java
# 修改权限:
chmod 777 mysql-connector-java-5.1.47.jar
# 创建软连接:
ln -s mysql-connector-java-5.1.47.jar mysql-connector-java.jar
复制代码
Cloudera Manager 安装
配置本地 yum 源
1、下载 CM6.2 的安装包
地址为: https://archive.cloudera.com/cm6/6.2.1/redhat7/yum/RPMS/x86_64
复制代码
2、下载 CDH6.2 的安装包
地址为: https://archive.cloudera.com/cdh6/6.2.1/parcels
复制代码
3、执行 createrepo 命令生成 rpm 元数据
4、制作 Cloudera Manager 的 yum 源
cat >> /etc/yum.repos.d/cm.repo <<EOF
[cmrepo]
name = cm_repo
baseurl = http://10.0.0.7:8000/cm6.2.1
enable = true
gpgcheck = false
EOF
复制代码
5、更新 yun 源
配置 JDK
1、安装 jdk
yum -y install oracle-j2sdk1.8-1.8.0+update181-1.x86_64
复制代码
2、配置 jdk 环境变量
cat >> /etc/profile <<EOF
#JAVA_HOME
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export PATH=$PATH:$JAVA_HOME/bin
EOF
# 激活
source /etc/profile
复制代码
3、查看 jdk 版本
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
复制代码
安装 Cloudera Manager Server
1、初始化系统磁盘
# 创建pv卷
pvcreate /dev/vdb
# 创建vg卷组
vgcreate apps-vg /dev/vdb
# 创建lv卷组
lvcreate -L 2T -n apps-lv apps-vg
# 格式化lv
mkfs.ext4 /dev/apps-vg/apps-lv
# 创建目录
mkdir /apps
# 挂载
mount /dev/apps-vg/apps-lv /apps
# 查看磁盘uuid
blkid
/dev/manager/apps-vg-apps-lv: UUID="0d567c75-6fbc-41e0-98ef-df78bcd74433" TYPE="ext4"
# 配置开机启动
cat >> /etc/fstab <<EOF
UUID=0d567c75-6fbc-41e0-98ef-df78bcd74433 /data ext4 defaults 0 0
EOF
复制代码
2、通过 yum 源安装 Cloudera Manger Server
# 先创建软连接
mkdir -pv /apps/cloudera
ln -s /apps/clouera /opt/clouera
复制代码
2、初始化数据库,在 master 节点上执行如下命令:
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h db_host db_name db_user db_password
复制代码
3、启动 Cloudera Manager Server
systemctl start cloudera-scm-server
systemctl status cloudera-scm-server -l
# 观察日志是否启动成功
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
复制代码
4、检查端口是否监听,开放外网端口号为 7180
访问 CM, 登录地址 http://localhost:7180 默认账号密码为: admin/admin
CDH 安装
集群安装向导
1、admin/admin 登录 cm
2、同意 license 协议,点击继续
3、选择 60 天试用,点击继续
4、点击继续
5、点击继续,输入集群名称,可以默认试用"Cluster 1"
6、输入主机 IP 或者名称,点击搜索找到主机后点击继续
7、选择自定义存储库,输入 cm 的 http 地址 http://10.0.0.14:8000/cm6.2.1
8、使用 Parcel 建议,点击“更多选项”,点击“-”删除远程 Parcel 存储库 URL 其它所有地址,输入http://10.0.0.14:8000/cdh6.2.1,点击“保存更改”
9、点击继续,进入下一步安装 jdk
10、点击继续,进入下一步配置 ssh 账号密码,选择所有主机接受相同私钥
# 查看主节点私钥信息,复制粘贴
cat ~/.ssh/id_rsa
复制代码
11.点击继续,进入下一步,安装 Cloudera Manager 相关到各个节点
评论