节点 | MySQL部署组件 | Parcel文件离线源 | CM服务进程 | 大数据组件 |
---|---|---|---|---|
hadoop001 | MySQL | Parcel | Activity Monitor | |
hadoop002 | Alert Publisher Event Server | |||
hadoop003 | Host Monitor Service Server |
注意:下载完成后要重命名去掉版本号
mv mysql-connector-java-5.1.47.jar mysql-connector-java.jar
链接:https://pan.baidu.com/s/1fgCiCvsakUqMwi8MjMl4Zw 提取码:vs2w
CentOS7.2操作系统,2核8G最低配置,实例选择就近的,比如:在上海地区的话就选华东2上海区域,这样网络不会有延迟,并且要在同一个分区,这样才能保证在同一个网段内互通
Window: C:\windows\system32\drivers\etc\hosts
公网地址
47.110.15.86 hadoop001
47.110.10.192 hadoop002
47.110.14.197 hadoop003
内网地址
echo "172.16.189.132 hadoop001" >>/etc/hosts
echo "172.16.189.133 hadoop002" >>/etc/hosts
echo "172.16.189.131 hadoop003" >>/etc/hosts
配置完成后可通过ping进行测试
//关闭防火墙命令: CentOS7 都是system开头的
systemctl stop firewalld //关闭防火墙
systemctl disable firewalld //禁用防火墙
iptables -L //查看
iptables -F //清空
云主机:防火墙关闭的,不过web界面上需要设置端口
添加规则:7180/7180
授权对象:如果没有限制就用0.0.0.0/0
公司内部服务器: 防火墙关闭,等部署好之后,通过CDHweb界面提供的端口,我们将防火墙开启,设置这些端口通过(文档)
vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
设置后需要重启才能⽣生效
阿里云上的主机是时钟同步的,可以不用配置,这一步可跳过
6.1.时区
[root@hadoop001 ~]# date
Sat May 11 10:07:53 CST 2019
[root@hadoop001 ~]# timedatectl
Local time: Sat 2019-05-11 10:10:31 CST
Universal time: Sat 2019-05-11 02:10:31 UTC
RTC time: Sat 2019-05-11 10:10:29
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a
#查看命令帮助
[root@hadoop001 ~]# timedatectl --help
timedatectl [OPTIONS...] COMMAND ...
Query or change system time and date settings.
-h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode
Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Control whether NTP is enabled
#查看哪些时区
[root@hadoop001 ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
#所有节点设置亚洲上海海时区
[root@hadoop001 ~]# timedatectl set-timezone Asia/Shanghai
[root@hadoop002 ~]# timedatectl set-timezone Asia/Shanghai
[root@hadoop003 ~]# timedatectl set-timezone Asia/Shanghai
6.2.时间
#所有节点安装ntp
[root@hadoop001 ~]# yum install -y ntp
#选取hadoop001为ntp的主节点
[root@hadoop001 ~]# vi /etc/ntp.conf
#time
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
#当外部时间不不可⽤用时,可使⽤用本地硬件时间
server 127.127.1.0 iburst local clock
#允许哪些⽹网段的机器器来同步时间
restrict 172.19.7.0 mask 255.255.255.0 nomodify notrap
#开启ntpd及查看状态
[root@hadoop001 ~]# systemctl start ntpd
[root@hadoop001 ~]# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: d
isabled)
Active: active (running) since Sat 2019-05-11 10:15:00 CST; 11min ago
Main PID: 18518 (ntpd)
CGroup: /system.slice/ntpd.service
??18518 /usr/sbin/ntpd -u ntp:ntp -g
May 11 10:15:00 hadoop001 systemd[1]: Starting Network Time Service...
May 11 10:15:00 hadoop001 ntpd[18518]: proto: precision = 0.088 usec
May 11 10:15:00 hadoop001 ntpd[18518]: 0.0.0.0 c01d 0d kern kernel time sync enabl
ed
May 11 10:15:00 hadoop001 systemd[1]: Started Network Time Service.
#验证
[root@hadoop001 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(0) .LOCL. 10 l 726 64 0 0.000 0.000 0.000
#其他从节点停⽌止禁⽤用ntpd服务
[root@hadoop002 ~]# systemctl stop ntpd
[root@hadoop002 ~]# systemctl disable ntpd
Removed symlink /etc/systemd/system/multi-user.target.wants/ntpd.service.
[root@hadoop002 ~]# /usr/sbin/ntpdate hadoop001
11 May 10:29:22 ntpdate[9370]: adjust time server 172.19.7.96 offset 0.000867 sec
#每天凌晨同步hadoop001节点时间
[root@hadoop002 ~]# crontab -e
00 00 * * * /usr/sbin/ntpdate hadoop001
[root@hadoop003 ~]# systemctl stop ntpd
[root@hadoop004 ~]# systemctl disable ntpd
Removed symlink /etc/systemd/system/multi-user.target.wants/ntpd.service.
[root@hadoop005 ~]# /usr/sbin/ntpdate hadoop001
11 May 10:29:22 ntpdate[9370]: adjust time server 172.19.7.96 offset 0.000867 sec
#每天凌晨同步hadoop001节点时间
[root@hadoop003 ~]# crontab -e
00 00 * * * /usr/sbin/ntpdate hadoop001
//安装路径:usr/java 有些默认都是通过这个路径去读的
mkdir /usr/java
tar -xzvf jdk-8u45-linux-x64.tar.gz -C /usr/java/
#切记必须修正所属⽤用户及⽤用户组
chown -R root:root /usr/java/jdk1.8.0_45
echo "export JAVA_HOME=/usr/java/jdk1.8.0_45" >> /etc/profile
echo "export PATH=\${JAVA_HOME}/bin:\${PATH}" >> /etc/profile #$前面要\ 转义
source /etc/profile
which java
见CDH5.16:MySQL安装
// 以下方法可以看下创建语句
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> show create database mysql;
+----------+------------------------------------------------------------------+
| Database | Create Database |
+----------+------------------------------------------------------------------+
| mysql | CREATE DATABASE `mysql` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
/这里要注意set 的是utf8
create database cmf DEFAULT CHARACTER SET utf8;
create database amon DEFAULT CHARACTER SET utf8;
grant all on cmf.* TO 'cmf'@'%' IDENTIFIED BY 'Ruozedata123456!';
grant all on amon.* TO 'amon'@'%' IDENTIFIED BY 'Ruozedata123456!';
flush privileges;
mkdir -p /usr/share/java/
cp mysql-connector-java.jar /usr/share/java/
// 这里拷贝的时候记得去版本号,要不然读不出来 cmf、amon都要部署在hadoop001节点上 那么此节点就要部署jdbc jar包
1.1.所有节点创建目录及解压
mkdir /opt/cloudera-manager
tar -zxvf cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz -C /opt/cloudera-manager/
1.2.所有节点修改agent的配置,指向server的节点hadoop001
sed -i "s/server_host=localhost/server_host=hadoop001/g" /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent/config.ini
1.3.主节点修改server的配置:
vi /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=hadoop001
com.cloudera.cmf.db.name=cmf
com.cloudera.cmf.db.user=cmf
com.cloudera.cmf.db.password=Ruozedata123456!
com.cloudera.cmf.db.setupType=EXTERNAL
1.4.所有节点创建用户
useradd --system --home=/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
1.5.修改用户及用户组
chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager
2.1.部署离线parcel源
$ mkdir -p /opt/cloudera/parcel-repo
$ ll
total 3081664
-rw-r--r-- 1 root root 2127506677 May 9 18:04 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel
-rw-r--r-- 1 root root 41 May 9 18:03 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1
-rw-r--r-- 1 root root 841524318 May 9 18:03 cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz
-rw-r--r-- 1 root root 185515842 Aug 10 2017 jdk-8u144-linux-x64.tar.gz
-rw-r--r-- 1 root root 66538 May 9 18:03 manifest.json
-rw-r--r-- 1 root root 989495 May 25 2017 mysql-connector-java.jar
$ cp CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel /opt/cloudera/parcel-repo/
#切记cp时,重命名去掉1,不然在部署过程CM认为如上文件下载未完整,会持续下载
$ cp CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha
$ cp manifest.json /opt/cloudera/parcel-repo/
// 校验
[root@hadoop001 parcel-repo]# cat CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha
703728dfa7690861ecd3a9bcd412b04ac8de7148
[root@hadoop001 parcel-repo]# ll /usr/bin/*sha*
-rwxr-xr-x 1 root root 37456 Nov 6 2016 /usr/bin/sha1sum
-rwxr-xr-x 1 root root 41600 Nov 6 2016 /usr/bin/sha224sum
-rwxr-xr-x 1 root root 41600 Nov 6 2016 /usr/bin/sha256sum
-rwxr-xr-x 1 root root 41592 Nov 6 2016 /usr/bin/sha384sum
-rwxr-xr-x 1 root root 41592 Nov 6 2016 /usr/bin/sha512sum
-rwxr-xr-x 1 root root 15824 Apr 13 2017 /usr/bin/unshare
[root@hadoop001 parcel-repo]# /usr/bin/sha1sum CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel
703728dfa7690861ecd3a9bcd412b04ac8de7148 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel
[root@hadoop001 parcel-repo]#
2.2.目录修改用户及用户组
$ chown -R cloudera-scm:cloudera-scm /opt/cloudera/
mkdir -p /opt/cloudera/parcels
chown -R cloudera-scm:cloudera-scm /opt/cloudera/
4.1.启动server
/opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-server start
4.2.阿⾥里里云web界面,设置该hadoop001节点防火墙放开7180端⼝口
4.3.等待1min,看日志出现7180,打开 http://hadoop001:7180 账号密码:admin/admin
4.4.假如打不不开,去看server的log,根据错误仔细排查错误
/opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent start
http://hadoop01:7180
账号密码:admin/admin
假如本地parcel离线源配置正确,则"下载"阶段瞬间完成,其余阶段视节点数与内部⽹网络情况决定。
我在做这步的时候省时间,做的是临时生效的
做完之后,上一步要BACK一下,再回来
13.1.建议将/proc/sys/vm/swappiness设置为最⼤大值10。
swappiness值控制操作系统尝试交换内存的积极;
swappiness=0:表示最⼤大限度使⽤用物理理内存,之后才是swap空间;
swappiness=100:表示积极使⽤用swap分区,并且把内存上的数据及时搬迁到swap空间;
如果是混合服务器器,不不建议完全禁⽤用swap,可以尝试降低swappiness。
临时调整:
sysctl vm.swappiness=10
永久调整:
cat << EOF >> /etc/sysctl.conf
# Adjust swappiness value
vm.swappiness=10
EOF
13.2.已启⽤用透明⼤大⻚页⾯面压缩,可能会导致重⼤大性能问题,建议禁⽤用此设置。
临时调整:
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
永久调整:
cat << EOF >> /etc/rc.d/rc.local
# Disable transparent_hugepage
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
EOF
# centos7.x系统,需要为"/etc/rc.d/rc.local"⽂文件赋予执⾏行行权限
chmod +x /etc/rc.d/rc.local