主机名 | IP | 系统版本 | 部署服务 |
---|---|---|---|
hadoop32 | 192.168.0.32 | CentOS6.5_64 | CM Server、Agent、MySQL |
hadoop33 | 192.168.0.33 | CentOS6.5_64 | CM Agent |
hadoop34 | 192.168.0.34 | CentOS6.5_64 | CM Agent |
包名 | 下载地址 |
---|---|
mysql-5.7.27-1.el6.x86_64.rpm-bundle.tar | https://dev.mysql.com/downloads/mysql/ |
mysql-connector-java-5.1.47.jar | https://dev.mysql.com/downloads/connector/j/ |
jdk-8u221-linux-x64.tar.gz | https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html |
CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel | http://archive.cloudera.com/cdh5/parcels/5.16.2.8 |
CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel.sha1 | http://archive.cloudera.com/cdh5/parcels/5.16.2.8 |
cloudera-manager-el6-cm5.16.2_x86_64.tar.gz | http://archive.cloudera.com/cm5/cm/5/ |
manifest.json | http://archive.cloudera.com/cdh5/parcels/5.16.2.8 |
vi /etc/hosts
192.168.0.32 hadoop32
192.168.0.33 hadoop33
192.168.0.34 hadoop34
ssh-keygen -t rsa
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
ssh-copy-id -i haddop32
ssh-copy-id -i haddop33
ssh-copy-id -i haddop34
1、更换时区
cp /etc/localtime /etc/localtime.bak
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2、同步最新时间
ntpdate asia.pool.ntp.org
3、定时同步
crontab -e
* * * * * ntpdate asia.pool.ntp.org
4、安装 ntp
yum install -y ntp
5、开启 ntp
service ntpd start
6、配置 ntp 开机启动
chkconfig ntpd on
7、检查 ntp 开机启动是否成功
chkconfig --list ntpd
2-5 为 on 表示成功
1、关闭防火墙
service iptables stop
2、验证
service iptables status
3、关闭防火墙的自动运行
chkconfig iptables off
4、验证
chkconfig --list | grep iptables
vi /etc/selinux/config
SELINUX=disabled
查看linux内核参数:vm.swappiness,vm.swappiness值的范围为0~100,作用是控制应用数据在物理内存和虚拟内存之间的交换,值越低,交换的越少。默认值为60。
查看 cat /proc/sys/vm/swappiness
配置 echo "10" > /proc/sys/vm/swappiness
查看THG
cat /sys/kernel/mm/transparent_hugepage/defrag
关闭THG
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
修改文件最大打开数,最大只能写100w,超过了会导致开不了机
vi /etc/security/limits.conf
# End of file
* soft nofile 1000000
* hard nofile 1000000
vi /etc/security/limits.d/90-nproc.conf
把 1024 改为 102400
* soft nproc 102400
root soft nproc unlimited
yum -y install lrzsz
yum -y install httpd
yum -y install mod_ssl
Cloudera建议将交换空间设置为0,过多的交换空间会引起GC耗时的激增,所以还是关闭的为好。
执行命令 (所有节点)
echo "vm.swappiness = 0" >> /etc/sysctl.conf
查找自带的jdk
rpm -qa | grep java
卸载所有的java包
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
rpm -e --nodeps tzdata-java-2013g-1.el6.noarch
cd /home/zhaomin/soft/
tar -zxvf jdk-8u221-linux-x64.tar.gz
mv jdk1.8.0_221 /opt/tools/java
mkdir /usr/java
ln -s /opt/tools/java /usr/java/default
这里需要建立java软连接到 /usr/java/default
,因为CDH默认会找这个路径
vi /etc/profile
export JAVA_HOME=/opt/tools/java
export PATH=.:$PATH:$JAVA_HOME/bin
source /etc/profile
java -version
查找已有MySQL
rpm -qa | grep mysql
卸载rpm包,例如我这里的 mysql-libs-5.1.71-1.el6.x86_64
已安装,卸载掉
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
tar -xvf mysql-5.7.27-1.el6.x86_64.rpm-bundle.tar
mkdir mysql
mv ./mysql-* mysql/
cd mysql/
rpm -qa | grep mysql
rpm -ivh mysql-community-common-5.7.27-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.27-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.27-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.27-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.27-1.el6.x86_64.rpm
service mysqld start
mysql 默认密码在 /var/log/mysqld.log
中
直接找到 temporary password
2019-09-16T10:21:56.003616Z 1 [Note] A temporary password is generated for root@localhost: a5yoyBJ(uq&<
mysql -uroot -p
Enter password: 此处输入刚才日志文件中的随机密码
修改密码:
SET PASSWORD = PASSWORD('xxxxxx');
此处的密码需要一定的复杂度,否则不能通过,因为mysql5.7的密码校验插件比较复杂,当然也可以卸掉该插件
vi /etc/my.cnf
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8
# Disabling symbolic-links is recommended to prevent assorted security risks
lower_case_table_names=1
bulk_insert_buffer_size=64M
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode='NO_ENGINE_SUBSTITUTION'
service mysqld restart
grant all privileges on *.* to 'root'@'%' identified by 'root';
flush privileges;
(如果报错不能创建数据库就执行下面的语句
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
)
-- hive数据库
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
-- 集群监控数据库
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
-- hue数据库
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
-- oozie数据库
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
tar -zxvf cloudera-manager-el6-cm5.16.2_x86_64.tar.gz
解压之后有两个文件夹 cloudera
cm-5.16.2
把这个两个文件夹放到一个文件夹里面 /opt下的 只能在opt下,因为cm默认路径是opt
mv cloudera /opt/
mv cm-5.16.2 /opt/
useradd --system --home=/opt/cm-5.16.2/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
cp /home/zhaomin/soft/mysql/mysql-connector-java-5.1.47.jar /opt/cm-5.11.0/share/cmf/lib/
vi /opt/cm-5.16.2/etc/cloudera-scm-agent/config.ini
修改下面的 server_host 改为管理节点的主机名
server_host=hadoop32
vi /opt/cm-5.16.2/share/cmf/bin/cmf-server
CMF_OPTS="$CMF_OPTS -Duser.timezone=GMT+08"
/opt/cm-5.16.2/share/cmf/schema/scm_prepare_database.sh mysql cm -h hadoop32 -uroot -proot --scm-host hadoop32 scm scm scm
或者 ( cm-5.11.0/share/cmf/schema/scm_prepare_database.sh mysql cm root root
)
格局是: scm_prepare_database.sh 数据库类型 数据库 服务器 用户名 暗码 --scm-host Cloudera_Manager_Server主机名
scp -rq /opt/cm-5.16.2 hadoop33:/opt/
scp -rq /opt/cm-5.16.2 hadoop34:/opt/
useradd --system --home=/opt/cm-5.16.2/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
/opt/cm-5.16.2/etc/init.d/cloudera-scm-server start
设置成开机启动:
cp /opt/cm-5.16.2/etc/init.d/cloudera-scm-server /etc/init.d/cloudera-scm-server
chkconfig cloudera-scm-server on
/opt/cm-5.16.2/etc/init.d/cloudera-scm-agent start
设置成开机启动:
cp /opt/cm-5.16.2/etc/init.d/cloudera-scm-agent /etc/init.d/cloudera-scm-agent
chkconfig cloudera-scm-agent on
CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel
CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel.sha
manifest.json
这点必须注意,否则,系统会重新下载 CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel
文件
[root@hadoop32 /]# cd /home/zhaomin/soft/
[root@hadoop32 soft]# ll
总用量 2830416
-rwxr-xr-x. 1 root root 1865909080 9月 16 21:50 CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel
-rw-r--r--. 1 root root 41 9月 16 21:50 CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel.sha
-rwxr-xr-x. 1 root root 837234643 9月 16 16:43 cloudera-manager-el6-cm5.16.2_x86_64.tar.gz
-rw-r--r--. 1 root root 14540 11月 5 2012 epel-release-6-8.noarch.rpm
-rw-r--r--. 1 root root 195094741 9月 16 16:35 jdk-8u221-linux-x64.tar.gz
-rw-r--r--. 1 root root 66804 9月 17 09:23 manifest.json
drwxr-xr-x. 2 root root 4096 9月 16 18:39 mysql
mv /home/zhaomin/soft/CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel.sha1 /home/zhaomin/soft/CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel.sha
mkdir /opt/cloudera/parcel-repo/
mv /home/zhaomin/soft/CDH-5.16.2-1.cdh5.16.2.p0.8-el6.parcel* /opt/cloudera/parcel-repo/
mv /home/zhaomin/soft/manifest.json /opt/cloudera/parcel-repo/
浏览器打开CM。
http://hadoop32:7180/cmf/login
默认账号密码:admin/admin
如果配置成功,那么下载部分应该是秒级100%的。
这里检测有点问题,说我时区不一致。但是我看是没有问题的。
注意Hive Metastore Server
、Oozie Server
、Service Monitor
、Hue Server
安装节点都要选择MySQL那台机器。
开始安装各个服务,安装Hive的时候可能会报错,因为我们使用了MySql作为hive的元数据存储,hive默认并没有带mysql的驱动,拷贝一个就行了:
这时hive通过了oozie会出现错误,错误原理与hive雷同,通过观察日志我们发现oozie会去一个默认路径下copy mysql的驱动,所以cp一个驱动过去即可,记得驱动的名称改成日志中需要的格式,否则依旧审核不通过,这点很重要。
cp /home/zhaomin/soft/mysql/mysql-connector-java-5.1.47.jar /opt/cloudera/parcels/CDH-5.16.2-1.cdh5.16.2.p0.8/lib/hive/lib/
cp /home/zhaomin/soft/mysql/mysql-connector-java-5.1.47.jar /var/lib/oozie/
sudo -u hdfs hadoop jar /opt/cloudera/parcels/CDH/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar pi 10 100