本文共 18158 字,大约阅读时间需要 60 分钟。
linux版本:CentOS 7.2
节点 | MySQL组件 | Parcel⽂件离线源 | CM服务进程 | ⼤数据组件 |
---|---|---|---|---|
hadoop001 | MySQL | Parcel | Alert Publisher Event Server | NN RM DN NM ZK |
hadoop002 | Alert Publisher Event Server | DN NM ZK | ||
hadoop003 | Host Monitor Service Monitor | DN NM ZK |
CM
Parcel
JDK
下载jdk-8u202-linux-x64.tar.gzMySQL
下载mysql-5.7.26-el7-x86_64.tar.gzMySQL JDBC jar
下载完成后要重命名去掉版本号mv mysql-connector-java-5.1.47.jar mysql-connector-java.jar
(最低配置 2core 8G),选择按量付费CentOS7.2
路径: C:\Windows\System32\drivers\etc\hosts
39.97.188.249 hadoop001 hadoop00139.97.225.112 hadoop002 hadoop00239.97.224.68 hadoop003 hadoop003
注意:IP是你虚拟机公网IP
echo '172.17.144.104 hadoop001' >> /etc/hostsecho '172.17.144.103 hadoop002' >> /etc/hostsecho '172.17.144.105 hadoop003' >> /etc/hosts#检查cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6172.17.144.104 hadoop001172.17.144.103 hadoop002172.17.144.105 hadoop003
注意:IP为内网IP
我们使用的云主机,无论阿里云还是腾讯云的防火墙都是关闭的,所以我们不需要关闭服务器的防火墙。但是,我们需要检查下是否自动开启了web访问端口,如果没有,则自己添加
进入之后点击配置规则
注意:
1.点击蓝色感叹号会有规则说明2.授权对象如果在公司内需要设置网段,就按照上图,将ip网段规定好。不限制的话就直接0.0.0.0/0
最好在内部服务器部署时就将防火墙关闭,如果不行就暂时关闭,等部署成功再开启
systemctl stop firewalld
systemctl disable firewalld
iptables -F
阿里云服务器已经将selinux关闭了,所以不用配置
自己的服务器很可能会开启selinux,这样就需要关闭了
将SELINUX=disabled设置进去,之后重启才会生效
vim /etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of three two values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection.SELINUXTYPE=targeted
阿里云已经将节点时区和时间做了同步
我们实操下公司环境的时区时间同步
[root@hadoop001 ~]# timedatectl Local time: Tue 2019-05-28 15:37:53 CST Universal time: Tue 2019-05-28 07:37:53 UTC RTC time: Tue 2019-05-28 15:37:53 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yesNTP synchronized: yes RTC in local TZ: yes DST active: n/a#查看命令帮助,学习⾄关重要,⽆需百度,太low[root@hadoop001 ~]# timedatectl --helptimedatectl [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 modeCommands:status Show current time settingsset-time TIME Set system timeset-timezone ZONE Set system time zonelist-timezones Show known time zonesset-local-rtc BOOL Control whether RTC is in local timeset-ntp BOOL Control whether NTP is enabled#查看哪些时区[root@hadoop001 ~]# timedatectl list-timezonesAfrica/AbidjanAfrica/AccraAfrica/Addis_AbabaAfrica/AlgiersAfrica/AsmaraAfrica/Bamako#所有节点设置亚洲上海时区[root@hadoop001 ~]# timedatectl set-timezone Asia/Shanghai[root@hadoop002 ~]# timedatectl set-timezone Asia/Shanghai[root@hadoop003 ~]# timedatectl set-timezone Asia/Shanghai
#所有节点安装ntp[root@hadoop001 ~]# yum install -y ntp#选取hadoop001为ntp的主节点[root@hadoop001 ~]# vi /etc/ntp.conf#timeserver 0.asia.pool.ntp.orgserver 1.asia.pool.ntp.orgserver 2.asia.pool.ntp.orgserver 3.asia.pool.ntp.org#当外部时间不可用时,可使用本地硬件时间server 127.127.1.0 iburst local clock#允许哪些网段的机器来同步时间 修改成自己的内网网段restrict 172.17.144.0 mask 255.255.255.0 nomodify notrap#开启ntpd及查看状态[root@hadoop001 ~]# systemctl start ntpd[root@hadoop001 ~]# systemctl status ntpd● ntpd.service - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)Active: active (running) since Sat 2019-05-11 10:15:00 CST; 11min agoMain PID: 18518 (ntpd)CGroup: /system.slice/ntpd.service!"18518 /usr/sbin/ntpd -u ntp:ntp -gMay 11 10:15:00 hadoop001 systemd[1]: Starting Network Time Service...May 11 10:15:00 hadoop001 ntpd[18518]: proto: precision = 0.088 usecMay 11 10:15:00 hadoop001 ntpd[18518]: 0.0.0.0 c01d 0d kern kernel time sync enabledMay 11 10:15:00 hadoop001 systemd[1]: Started Network Time Service.#验证[root@hadoop001 ~]# ntpq -premote 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 ntpdRemoved symlink /etc/systemd/system/multi-user.target.wants/ntpd.service.[root@hadoop002 ~]# /usr/sbin/ntpdate hadoop00111 May 10:29:22 ntpdate[9370]: adjust time server 172.19.7.96 offset 0.000867 sec#每天凌晨同步hadoop001节点时间[root@hadoop002 ~]# crontab -e00 00 * * * /usr/sbin/ntpdate hadoop001[root@hadoop003 ~]# systemctl stop ntpd[root@hadoop004 ~]# systemctl disable ntpdRemoved symlink /etc/systemd/system/multi-user.target.wants/ntpd.service.[root@hadoop005 ~]# /usr/sbin/ntpdate hadoop00111 May 10:29:22 ntpdate[9370]: adjust time server 172.19.7.96 offset 0.000867 sec#每天凌晨同步hadoop001节点时间[root@hadoop003 ~]# crontab -e00 00 * * * /usr/sbin/ntpdate hadoop001
mkdir /usr/javatar -xzvf jdk-8u45-linux-x64.tar.gz -C /usr/java/#切记必须修正所属⽤户及⽤户组chown -R root:root /usr/java/jdk1.8.0_45[root@hadoop001 cdh5.16.1]# vim /etc/profileexport JAVA_HOME=/usr/java/jdk1.8.0_45export PATH=${JAVA_HOME}/bin:${PATH}source /etc/profilewhich java
如果节点过多,那么就只做一台镜像模板,将基础工作完成之后,分发克隆。。(最好请运维小哥哥做~)
(按照生产标准)
#解压[root@hadoop001 cdh5.16.1]# tar xzvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz -C /usr/local/#切换目录[root@hadoop001 cdh5.16.1]# cd /usr/local/#修改mysql名称[root@hadoop001 local]# mv mysql-5.7.11-linux-glibc2.5-x86_64/ mysql#创建文件夹[root@hadoop001 local]# mkdir mysql/arch mysql/data mysql/tmp
rm /etc/my.cnf
vim /etc/my.cnf
[client]port = 3306socket = /usr/local/mysql/data/mysql.sockdefault-character-set=utf8mb4[mysqld]port = 3306socket = /usr/local/mysql/data/mysql.sockskip-slave-startskip-external-lockingkey_buffer_size = 256Msort_buffer_size = 2Mread_buffer_size = 2Mread_rnd_buffer_size = 4Mquery_cache_size= 32Mmax_allowed_packet = 16Mmyisam_sort_buffer_size=128Mtmp_table_size=32Mtable_open_cache = 512thread_cache_size = 8wait_timeout = 86400interactive_timeout = 86400max_connections = 600# Try number of CPU's*2 for thread_concurrency#thread_concurrency = 32 #isolation level and default engine default-storage-engine = INNODBtransaction-isolation = READ-COMMITTEDserver-id = 1739basedir = /usr/local/mysqldatadir = /usr/local/mysql/datapid-file = /usr/local/mysql/data/hostname.pid#open performance schemalog-warningssysdate-is-nowbinlog_format = ROWlog_bin_trust_function_creators=1log-error = /usr/local/mysql/data/hostname.errlog-bin = /usr/local/mysql/arch/mysql-binexpire_logs_days = 7innodb_write_io_threads=16relay-log = /usr/local/mysql/relay_log/relay-logrelay-log-index = /usr/local/mysql/relay_log/relay-log.indexrelay_log_info_file= /usr/local/mysql/relay_log/relay-log.infolog_slave_updates=1gtid_mode=OFFenforce_gtid_consistency=OFF# slaveslave-parallel-type=LOGICAL_CLOCKslave-parallel-workers=4master_info_repository=TABLErelay_log_info_repository=TABLErelay_log_recovery=ON#other logs#general_log =1#general_log_file = /usr/local/mysql/data/general_log.err#slow_query_log=1#slow_query_log_file=/usr/local/mysql/data/slow_log.err#for replication slavesync_binlog = 500#for innodb options innodb_data_home_dir = /usr/local/mysql/data/innodb_data_file_path = ibdata1:1G;ibdata2:1G:autoextendinnodb_log_group_home_dir = /usr/local/mysql/archinnodb_log_files_in_group = 4innodb_log_file_size = 1Ginnodb_log_buffer_size = 200M#根据生产需要,调整pool size innodb_buffer_pool_size = 2G#innodb_additional_mem_pool_size = 50M #deprecated in 5.6tmpdir = /usr/local/mysql/tmpinnodb_lock_wait_timeout = 1000#innodb_thread_concurrency = 0innodb_flush_log_at_trx_commit = 2innodb_locks_unsafe_for_binlog=1#innodb io features: add for mysql5.5.8performance_schemainnodb_read_io_threads=4innodb-write-io-threads=4innodb-io-capacity=200#purge threads change default(0) to 1 for purgeinnodb_purge_threads=1innodb_use_native_aio=on#case-sensitive file names and separate tablespaceinnodb_file_per_table = 1lower_case_table_names=1[mysqldump]quickmax_allowed_packet = 128M[mysql]no-auto-rehashdefault-character-set=utf8mb4[mysqlhotcopy]interactive-timeout[myisamchk]key_buffer_size = 256Msort_buffer_size = 256Mread_buffer = 2Mwrite_buffer = 2M
[root@hadoop001 local]# groupadd -g 101 dba[root@hadoop001 local]# useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
[root@hadoop001 local]# id mysqladminuid=514(mysqladmin) gid=101(dba) groups=101(dba),0(root)## 一般不需要设置mysqladmin的密码,直接从root或者LDAP用户sudo切换
copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量
cp /etc/skel/.* /usr/local/mysql
[root@hadoop001 local]# vi mysql/.bash_profile
# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsexport MYSQL_BASE=/usr/local/mysqlexport PATH=${MYSQL_BASE}/bin:$PATHunset USERNAME#stty erase ^Hset umask to 022umask 022PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1
[root@hadoop001 local]# chown mysqladmin:dba /etc/my.cnf [root@hadoop001 local]# chmod 640 /etc/my.cnf [root@hadoop001 local]# chown -R mysqladmin:dba /usr/local/mysql[root@hadoop001 local]# chmod -R 755 /usr/local/mysql
[root@hadoop001 local]# cd /usr/local/mysql#将服务文件拷贝到init.d下,并重命名为mysql[root@hadoop001 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql #赋予可执行权限[root@hadoop001 mysql]# chmod +x /etc/rc.d/init.d/mysql#删除服务[root@hadoop001 mysql]# chkconfig --del mysql#添加服务[root@hadoop001 mysql]# chkconfig --add mysql[root@hadoop001 mysql]# chkconfig --level 345 mysql on
[root@hadoop001 mysql]# yum -y install libaio
[root@hadoop001 mysql]# su - mysqladminLast login: Tue May 28 17:04:49 CST 2019 on pts/0hadoop001:mysqladmin:/usr/local/mysql:>bin/mysqld \> --defaults-file=/etc/my.cnf \> --user=mysqladmin \> --basedir=/usr/local/mysql/ \> --datadir=/usr/local/mysql/data/ \> --initialize
在初始化时如果加上 –initial-insecure,则会创建空密码的 root@localhost 账号,否则会创建带密码的 root@localhost 账号,密码直接写在 log-error 日志文件中(在5.6版本中是放在 ~/.mysql_secret 文件里,更加隐蔽,不熟悉的话可能会无所适从)
#查看密码hadoop001:mysqladmin:/usr/local/mysql/data:>cat hostname.err |grep password2019-05-28T09:28:40.447701Z 1 [Note] A temporary password is generated for root@localhost: J=
hadoop001:mysqladmin:/usr/local/mysql:>/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &[1] 21740hadoop001:mysqladmin:/usr/local/mysql:>2019-05-28T09:38:16.127060Z mysqld_safe Logging to '/usr/local/mysql/data/hostname.err'.2019-05-28T09:38:16.196799Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data#按两次回车##退出mysqladmin用户##查看mysql进程号[root@hadoop001 mysql]#ps -ef|grep mysqlmysqlad+ 21740 1 0 17:38 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnfmysqlad+ 22557 21740 0 17:38 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/hostname.err --pid-file=/usr/local/mysql/data/hostname.pid --socket=/usr/local/mysql/data/mysql.sock --port=3306root 22609 9194 0 17:39 pts/0 00:00:00 grep --color=auto mysql##通过mysql进程号查看mysql端口号[root@hadoop001 mysql]# netstat -nlp|grep 22557#切换成mysqladmin[root@hadoop001 mysql]# su - mysqladminLast login: Tue May 28 17:24:45 CST 2019 on pts/0hadoop001:mysqladmin:/usr/local/mysql:>##查看mysql是否运行hadoop001:mysqladmin:/usr/local/mysql:>service mysql statusMySQL running (22557)[ OK ]
#初始密码hadoop001:mysqladmin:/usr/local/mysql:>mysql -uroot -p'J=alter user root@localhost identified by 'ruozedata123';mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'ruozedata123' ;#刷权限mysql> flush privileges;
mysql> CREATE DATABASE `cmf` DEFAULT CHARACTER SET utf8;
mysql> GRANT ALL PRIVILEGES ON cmf.* TO 'cmf'@'%' IDENTIFIED BY 'ruozedata123' ;
mysql> create database amon default character set utf8;
mysql> GRANT ALL PRIVILEGES ON amon.* TO 'amon'@'%' IDENTIFIED BY 'ruozedata123' ;
--刷权限mysql> flush privileges;
[root@hadoop001 cdh5.16.1]# mkdir -p /usr/share/java[root@hadoop001 cdh5.16.1]# ls -lhtotal 3.5G-rw-r--r-- 1 root root 2.0G May 15 10:01 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel-rw-r--r-- 1 root root 41 May 14 20:17 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1-rw-r--r-- 1 root root 803M May 15 09:38 cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz-rw-r--r-- 1 root root 166M May 14 20:21 jdk-8u45-linux-x64.gz-rw-r--r-- 1 root root 65K May 14 20:17 manifest.json-rw-r--r-- 1 root root 523M May 15 09:28 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz-rw-r--r-- 1 root root 984K May 15 09:10 mysql-connector-java-5.1.47.jar#mysql的jar包一定要去掉版本号~,有坑[root@hadoop001 cdh5.16.1]# cp mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
mkdir /opt/cloudera-managertar -zxvf cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz -C /opt/cloudera-manager/sed -i "s/server_host=localhost/server_host=hadoop001/g" /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent/config.ini
所有节点修改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
vi /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysqlcom.cloudera.cmf.db.host=hadoop001com.cloudera.cmf.db.name=cmfcom.cloudera.cmf.db.user=cmfcom.cloudera.cmf.db.password=ruozedata123com.cloudera.cmf.db.setupType=EXTERNAL
#创建cloudera-scmuseradd --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#修改cloudera-manager的权限chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager
chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager
mkdir -p /opt/cloudera/parcel-repo
[root@hadoop001 opt]# cd ~/cdh5.16.1/[root@hadoop001 cdh5.16.1]# ls -lhtotal 3.5G-rw-r--r-- 1 root root 2.0G May 15 10:01 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel-rw-r--r-- 1 root root 41 May 14 20:17 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1-rw-r--r-- 1 root root 803M May 15 09:38 cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz-rw-r--r-- 1 root root 166M May 14 20:21 jdk-8u45-linux-x64.gz-rw-r--r-- 1 root root 65K May 14 20:17 manifest.json-rw-r--r-- 1 root root 523M May 15 09:28 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz-rw-r--r-- 1 root root 984K May 15 09:10 mysql-connector-java-5.1.47.jar
[root@hadoop001 cdh5.16.1]# mv 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#切记mv时,重命名去掉1,不然在部署过程CM认为如上⽂件下载未完整,会持续下载
[root@hadoop001 cdh5.16.1]# mv CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel /opt/cloudera/parcel-repo/
[root@hadoop001 cdh5.16.1]# mv manifest.json /opt/cloudera/parcel-repo/
如果你是通过网络下载的parcel包,我们就需要对CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel 进行校验,防止文件损坏!!!
[root@hadoop001 parcel-repo]# cat CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha703728dfa7690861ecd3a9bcd412b04ac8de7148#计算下载文件的值,进行对比[root@hadoop001 parcel-repo]# sha1sum CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel703728dfa7690861ecd3a9bcd412b04ac8de7148 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel#相同,可以正常使用
chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/
mkdir -p /opt/cloudera/parcelschown -R cloudera-scm:cloudera-scm /opt/cloudera/
4.1 启动server/opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-server start4.2 阿⾥云web界⾯,设置该hadoop001节点防⽕墙放开7180端⼝4.3 等待1min,打开 http://hadoop001:7180 账号密码:admin/admin4.4 假如打不开,去看server的log,根据错误仔细排查错误 log路径在/opt/cloudera-manager/cm-5.16.1/log/cloudera-scm-server
/opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent start
账号密码:admin/admin
假如本地parcel离线源配置正确,则"下载"阶段瞬间完成,其余阶段视节点数与内部⽹络情况决定。
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 valuevm.swappiness=10EOF13.2.已启⽤透明⼤⻚⾯压缩,可能会导致重⼤性能问题,建议禁⽤此设置。临时调整:echo never > /sys/kernel/mm/transparent_hugepage/defragecho never > /sys/kernel/mm/transparent_hugepage/enabled永久调整:cat << EOF >> /etc/rc.d/rc.local# Disable transparent_hugepageecho never > /sys/kernel/mm/transparent_hugepage/defragecho never > /sys/kernel/mm/transparent_hugepage/enabledEOF# centos7.x系统,需要为"/etc/rc.d/rc.local"⽂件赋予执⾏权限chmod +x /etc/rc.d/rc.local
连接测试失败的可能原因:
(1)mysql JDBC jar包没有放到/usr/share/java或jar包没有去掉版本号(2)建数据库cmf 和amon的时候,没有将权限设置成%(3)设置完权限之后,没有flush privileges;报错信息
ERROR 226616765@scm-web-17:com.cloudera.server.web.common.JsonResponse:JsonResponse created with throwable: com.cloudera.server.web.cmf.MessageException:A package was not selected.原因:测试连接时,等待时间过长,我就点了返回键重新加载,然后出现packet找不到的异常。解决:返回到选择大数据组件的页面后,重新进行操作,就可以测试成功了。
转载于:https://blog.51cto.com/14309075/2401752