服务器的运行内存还是不要太小,很多服务例如Impala、Spark特别吃内存。如果上线生产环境,推荐128G保底。
主机 | IP | 内存 | 硬盘 |
---|---|---|---|
master | 192.168.0.31 | 16G | 500G |
tools | 192.168.0.32 | 16G | 500G |
gateway | 192.168.0.33 | 16G | 500G |
worker | 192.168.0.34 | 16G | 500G |
主机角色划分
安装例如HDFS的NameNode、Hbase的Master server、YARN的ResourceManager等比较重要的组件。
安装例如CM、Hue、Sqoop等工具辅助类组件。
安装例如HDFS的JournalNode、Hbase的HBase REST Server等集群间通讯类组件。
安装例如HDFS的DataNode、Hbase的RegionServer、Kudu的tablet等用来存储数据的工作组件。
mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
mysql-connector-java-5.1.47.tar.gz
cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm
cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm
cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm
cloudera-manager-server-db-2-6.3.0-1281944.el7.x86_64.rpm
enterprise-debuginfo-6.3.0-1281944.el7.x86_64.rpm
oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
allkeys.asc
CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel
manifest.json
将这些安装包上传到tools主机上
[root@localhost ~]# tree -C cloudera/
cloudera/
├── cloudera-manager
│ ├── allkeys.asc
│ ├── cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm
│ ├── cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm
│ ├── cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm
│ ├── cloudera-manager-server-db-2-6.3.0-1281944.el7.x86_64.rpm
│ ├── enterprise-debuginfo-6.3.0-1281944.el7.x86_64.rpm
│ └── oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
├── mysql
│ └── mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
├── mysql-jdbc
│ └── mysql-connector-java-5.1.47.tar.gz
└── parcel
├── CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel
└── manifest.json
4 directories, 11 files
先安装一些基本工具
yum install -y vim wget ntp net-tools
给四台主机分别设置主机名
hostnamectl set-hostname master.cdh
hostnamectl set-hostname tools.cdh
hostnamectl set-hostname gateway.cdh
hostnamectl set-hostname worker.cdh
每台主机修改/etc/hosts文件,追加
192.168.0.31 master.cdh
192.168.0.32 tools.cdh
192.168.0.33 gateway.cdh
192.168.0.34 worker.cdh
修改每台主机的/etc/sysconfig/network文件,分别追加
HOSTNAME=master.cdh
HOSTNAME=tools.cdh
HOSTNAME=gateway.cdh
HOSTNAME=worker.cdh
使用uname -a && hostname命令查看主机名
每台主机关闭防火墙
systemctl stop firewalld \
&& systemctl disable firewalld \
&& systemctl status firewalld
每台主机关闭Selinux
setenforce 0 #临时关闭
vim /etc/selinux/config #永久关闭
# SELINUX=enforcing 改成 SELINUX=permissive
getenforce #查看状态为Permissive
关闭chrony
服务,该服务会影响到NTP服务的开机启动
systemctl stop chronyd && systemctl disable chronyd
设置NTP服务
vim /etc/ntp.conf
# 将时钟服务器更改为如下4个
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
启动时间同步服务器
systemctl start ntpd \
&& systemctl enable ntpd \
&& ntpdate -u 0.cn.pool.ntp.org \
&& hwclock --systohc \
&& date
在tools主机上操作
yum -y install httpd createrepo \
&& systemctl start httpd \
&& systemctl enable httpd \
&& cd /root/cloudera/cloudera-manager/ \
&& createrepo . \
&& mv /root/cloudera/cloudera-manager/ /var/www/html/
访问:http://192.168.0.32/cloudera-manager/
cd /var/www/html/cloudera-manager/;rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
卸载自带的mariadb
yum -y remove mariadb-libs
解压下载的MySQL包
cd /root/cloudera/mysql/;tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
安装MySQL
yum install -y libaio \
&& rpm -ivh mysql-community-common-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-libs-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm \
&& rpm -ivh mysql-community-libs-compat-5.7.27-1.el7.x86_64.rpm
配置my.cnf
echo character-set-server=utf8 >> /etc/my.cnf
数据库授权
(
cat <<EOF
set password for root@localhost = password('123456Aa.');
grant all privileges on *.* to 'root'@'%' identified by '123456Aa.';
flush privileges;
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;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '123456Aa.';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '123456Aa.';
SHOW DATABASES;
EOF
) >> /root/c.sql
启动MySQL
systemctl enable mysqld && systemctl start mysqld && grep password /var/log/mysqld.log | sed 's/.*\(............\)$/\1/'
执行脚本
[root@tools ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.27
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> source /root/c.sql
Query OK, 0 rows affected, 1 warning (0.00 sec)
配置mysql jdbc驱动
mkdir -p /usr/share/java/ \
&& cd /root/cloudera/mysql-jdbc/;tar -zxvf mysql-connector-java-5.1.47.tar.gz \
&& cp /root/cloudera/mysql-jdbc/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar /usr/share/java/mysql-connector-java.jar
tools主机配置本地yum源
(
cat <<EOF
[cloudera-manager]
name=Cloudera Manager 6.3.0
baseurl=http://192.168.0.32/cloudera-manager/
gpgcheck=0
enabled=1
EOF
) >> /etc/yum.repos.d/cloudera-manager.repo \
&& yum clean all \
&& yum makecache
安装Cloudera Manager
yum install -y cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
mv /root/cloudera/parcel/* /opt/cloudera/parcel-repo
cd /opt/cloudera/parcel-repo/
sha1sum CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel | awk '{ print $1 }' > CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha
chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/*
执行scm_prepare_database.sh脚本
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm 123456Aa.
systemctl start cloudera-scm-server \
&& sleep 2 \
&& tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log | grep "INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server"
出现INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server
则启动成功
访问http://192.168.0.32:7180
账号密码为admin/admin
欢迎界面,下一步
用户许可,同意,下一步
选择试用版60天到期,不用白不用,下一步
欢迎界面,下一步
设置集群名称,下一步
选择网络中的主机,下一步
输入本地yum源地址,下一步
同意jdk使用许可,下一步
输入其他主机密码,下一步
每台主机安装agent,安装完毕,下一步
安装Parcels包,安装完毕,下一步
主机健康检查,下一步,报错解决方法 https://blog.csdn.net/qq_39680564/article/details/100013275
选择安装的服务,下一步
自行分配角色至主机,下一步
测试数据库链接,下一步
配置实例的安装位置,数据目录尽量安装在大的分区下
安装服务,下一步
安装完成
hive设置:https://blog.csdn.net/qq_39680564/article/details/101015864
Spark设置:https://blog.csdn.net/qq_39680564/article/details/101209640
root权限:https://blog.csdn.net/qq_39680564/article/details/101216414