CDH5.16.1离线安装部署

三种部署方式
Bin 在线部署
Rpm 离线部署 下载相应的rpm包
Tar 包部署

CDH真正离线部署
1:MySQL离线部署
2:CM离线部署 tar
3:Parcel文件离线源部署 hfs yarn hive base zk
准备三台阿里云按量付费机器
准备好软件包
[root@hadoop001 cdh5.16.1]# ll
total 3605076
-rw-r--r-- 1 root root 2127506677 May 23 21:39 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel
-rw-r--r-- 1 root root         41 May 23 21:11 CDH-5.16.1-1.cdh5.16.1.p0.3-el7.parcel.sha1
-rw-r--r-- 1 root root  841524318 May 23 21:32 cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz
-rw-r--r-- 1 root root  173271626 May 23 21:14 jdk-8u45-linux-x64.gz
-rw-r--r-- 1 root root      66538 May 23 21:11 manifest.json
-rw-r--r-- 1 root root  548193637 May 23 21:25 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
-rw-r--r-- 1 root root    1007502 May 23 21:12 mysql-connector-java-5.1.47.jar


将软件包scp到 hadoop002,hadoop003
[root@hadoop001 ~]# scp -r cdh5.16.1/ 47.99.247.221:/root
[root@hadoop001 ~]# scp -r cdh5.16.1/ 47.111.176.131:/root
节点初始化
1:hosts文件
172.16.121.235 hadoop001
172.16.121.236 hadoop002
172.16.121.234 hadoop003
三台机器相同配置

2:防火墙
放开阿里云防火墙,在安全组配置
systemctl stop firewalld
systemctl disable firewall

3:selinux
[root@hadoop001 ~]# vi /etc/selinux/config
SELINUX=disabled
重启 reboot

4:时区和时钟同步
看时区 date
centos7命令
timedatectl list-timezones
timedatectl set-timezone Asia/Shanghai

centos6命令
[root@vultr ~]# tzselect

安装ntp服务
Yum install -y ntp
hadoop001 时间同步的主节点
hadoop002—hadoop003 时间同步从节点

vi /etc/ntp.conf
增加自定义配置
https://www.ntppool.org/zh/zone/asia
#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 192.168.1.0 mask 255.255.255.0 nomodify notrap

systemctl start ntpd
systemctl status ntpd
ntpq -p


which ntpdate
/usr/sbin/ntpdate hadoop001

配置计划任务定时同步,阿里云主机可以不配
部署JDK【三台机器都要部署】
[root@hadoop001 ~]# mkdir /usr/java
[root@hadoop001 cdh5.16.1]# tar -zxvf jdk-8u45-linux-x64.gz -C /usr/java/
注意jdk权限问题
[root@hadoop001 cdh5.16.1]# chown -R root:root /usr/java/jdk1.8.0_45/
配置jdk环境变量
[root@hadoop001 cdh5.16.1]# vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_45
export PATH=$JAVA_HOME/bin:$PATH

[root@hadoop001 cdh5.16.1]# source /etc/profile
离线部署mysql
[root@hadoop001 cdh5.16.1]# tar -zxvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
[root@hadoop001 cdh5.16.1]# cd /usr/local/
[root@hadoop001 local]# chown -R root:root /usr/local/mysql-5.7.11-linux-glibc2.5-x86_64/
[root@hadoop001 local]# mv mysql-5.7.11-linux-glibc2.5-x86_64/ mysql
[root@hadoop001 local]# mkdir mysql/arch mysql/data mysql/tmp

[root@hadoop001 local]# vi /etc/my.cnf
[client]

port = 3306
socket = /usr/local/mysql/data/mysql.sock
default-character-set=utf8mb4

[mysqld]
port = 3306
socket = /usr/local/mysql/data/mysql.sock

skip-slave-start

skip-external-locking
key_buffer_size = 256M
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
query_cache_size= 32M
max_allowed_packet = 16M
myisam_sort_buffer_size=128M
tmp_table_size=32M

table_open_cache = 512
thread_cache_size = 8
wait_timeout = 86400
interactive_timeout = 86400
max_connections = 600

# Try number of CPU's*2 for thread_concurrency
#thread_concurrency = 32

#isolation level and default engine
default-storage-engine = INNODB
transaction-isolation = READ-COMMITTED

server-id = 1739
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/hostname.pid

#open performance schema
log-warnings
sysdate-is-now

binlog_format = ROW
log_bin_trust_function_creators=1
log-error = /usr/local/mysql/data/hostname.err
log-bin = /usr/local/mysql/arch/mysql-bin
expire_logs_days = 7

innodb_write_io_threads=16

relay-log = /usr/local/mysql/relay_log/relay-log
relay-log-index = /usr/local/mysql/relay_log/relay-log.index
relay_log_info_file= /usr/local/mysql/relay_log/relay-log.info

log_slave_updates=1
gtid_mode=OFF
enforce_gtid_consistency=OFF

# slave
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=4
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_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 slave
sync_binlog = 500


#for innodb options
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:1G;ibdata2:1G:autoextend

innodb_log_group_home_dir = /usr/local/mysql/arch
innodb_log_files_in_group = 4
innodb_log_file_size = 1G
innodb_log_buffer_size = 200M

#根据生产需要,调整pool size
innodb_buffer_pool_size = 2G
#innodb_additional_mem_pool_size = 50M #deprecated in 5.6
tmpdir = /usr/local/mysql/tmp

innodb_lock_wait_timeout = 1000
#innodb_thread_concurrency = 0
innodb_flush_log_at_trx_commit = 2

innodb_locks_unsafe_for_binlog=1

#innodb io features: add for mysql5.5.8
performance_schema
innodb_read_io_threads=4
innodb-write-io-threads=4
innodb-io-capacity=200
#purge threads change default(0) to 1 for purge
innodb_purge_threads=1
innodb_use_native_aio=on

#case-sensitive file names and separate tablespace
innodb_file_per_table = 1
lower_case_table_names=1

[mysqldump]
quick
max_allowed_packet = 128M

[mysql]
no-auto-rehash
default-character-set=utf8mb4

[mysqlhotcopy]
interactive-timeout

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_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]# cp /etc/skel/.* /usr/local/mysql

配置环境变量
[root@hadoop001 local]# vi mysql/.bash_profile
# User specific environment and startup programs

export MYSQL_BASE=/usr/local/mysql
export PATH=${MYSQL_BASE}/bin:$PATH


unset USERNAME

#stty erase ^H
set umask to 022
umask 022
PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1

[root@hadoop001 local]# source mysql/.bash_profile

[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
[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]# chkconfig --list

安装libaio及安装mysql的初始db
[root@hadoop001 mysql]# yum -y install libaio
[root@hadoop001 mysql]# sudo su - mysqladmin

hadoop001:mysqladmin:/usr/local/mysql:>bin/mysqld \
> --defaults-file=/etc/my.cnf \
> --user=mysqladmin \
> --basedir=/usr/local/mysql/ \
> --datadir=/usr/local/mysql/data/ \
> --initialize
等待

查看临时密码
hadoop001:mysqladmin:/usr/local/mysql:>cd data
hadoop001:mysqladmin:/usr/local/mysql/data:>cat hostname.err |grep password
2019-06-22T00:08:19.501858Z 1 [Note] A temporary password is generated for root@localhost: U1aM!GoJAqal

hadoop001:mysqladmin:/usr/local/mysql/data:>cd ..

启动
hadoop001:mysqladmin:/usr/local/mysql:>/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &

查看mysql进程
hadoop001:mysqladmin:/usr/local/mysql:>ps -ef|grep mysql

hadoop001:mysqladmin:/usr/local/mysql:>exit

[root@hadoop001 mysql]# ps -ef|grep mysql
mysqlad+  4074     1  0 08:13 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
mysqlad+  4891  4074  0 08:13 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=3306
root      4922  3825  0 08:16 pts/0    00:00:00 grep --color=auto mysql

[root@hadoop001 mysql]# netstat -nlp|grep 4891
tcp6       0      0 :::3306                 :::*                    LISTEN      4891/mysqld
unix  2      [ ACC ]     STREAM     LISTENING     32260    4891/mysqld          /usr/local/mysql/data/mysql.sock

[root@hadoop001 mysql]# su - mysqladmin
hadoop001:mysqladmin:/usr/local/mysql:>service mysql status
MySQL running (4891)[  OK  ]

hadoop001:mysqladmin:/usr/local/mysql:>mysql -uroot -p
Enter password:


重置密码
mysql> alter user root@localhost identified by '123456';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' ;
mysql> flush privileges;

创建db用户
mysql> create database cmf default character set utf8;
mysql> GRANT ALL PRIVILEGES ON cmf.* TO 'cmf'@'%' IDENTIFIED BY '123456' ;

mysql> create database amon default character set utf8;
mysql> GRANT ALL PRIVILEGES ON amon.* TO 'amon'@'%' IDENTIFIED BY '123456' ;
mysql> flush privileges;

部署mysql jdbc jar
[root@hadoop001 cdh5.6.1]# mkdir -p /usr/share/java
[root@hadoop001 cdh5.6.1]# cp mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
离线部署cm
三台机器一起做
[root@hadoop001 cdh5.16.1]# mkdir /opt/cloudera-manager
[root@hadoop002 cdh5.16.1]# mkdir /opt/cloudera-manager
[root@hadoop003 cdh5.6.1]# mkdir /opt/cloudera-manager

[root@hadoop001 cdh5.16.1]# tar -zxvf cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz -C /opt/cloudera-manager/
[root@hadoop002 cdh5.16.1]# tar -zxvf cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz -C /opt/cloudera-manager/
[root@hadoop003 cdh5.16.1]# tar -zxvf cloudera-manager-centos7-cm5.16.1_x86_64.tar.gz -C /opt/cloudera-manager/

agent配置
[root@hadoop001 cdh5.16.1]# cd /opt/cloudera-manager/cm-5.16.1/
有一些资源
[root@hadoop001 cm-5.16.1]# ll
total 28
drwxr-xr-x 7 1106 4001 4096 Nov 21  2018 etc
drwxr-xr-x 5 1106 4001 4096 Nov 21  2018 lib
drwxr-xr-x 3 1106 4001 4096 Nov 21  2018 lib64
drwxr-xr-x 5 1106 4001 4096 Nov 21  2018 log
drwxr-xr-x 3 1106 4001 4096 Nov 21  2018 run
drwxr-xr-x 2 1106 4001 4096 Nov 21  2018 sbin
drwxr-xr-x 3 1106 4001 4096 Nov 21  2018 share

[root@hadoop001 cm-5.16.1]# cd etc/
[root@hadoop001 etc]# ll
total 20
drwxr-xr-x 2 1106 4001 4096 Nov 21  2018 cloudera-scm-agent
drwxr-xr-x 2 1106 4001 4096 Nov 21  2018 cloudera-scm-server
drwxr-xr-x 2 1106 4001 4096 Nov 21  2018 default
drwxr-xr-x 2 1106 4001 4096 Nov 21  2018 init.d
drwxr-xr-x 3 1106 4001 4096 Nov 21  2018 security
[root@hadoop001 etc]# cd cloudera-scm-agent/
[root@hadoop001 cloudera-scm-agent]# ll
total 12
-rw-r--r-- 1 1106 4001 8905 Nov 21  2018 config.ini
[root@hadoop001 cloudera-scm-agent]# vi config.ini
# Hostname of the CM server.
server_host=hadoop001

去修改其它两台机器
[root@hadoop002 cdh5.16.1]# cd /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent
[root@hadoop002 cloudera-scm-agent]# vi config.ini
# Hostname of the CM server.
server_host=hadoop001

[root@hadoop003 cdh5.16.1]# cd /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent
[root@hadoop003 cloudera-scm-agent]# vi config.ini
# Hostname of the CM server.
server_host=hadoop001

去修改hadoop001的server
[root@hadoop001 cloudera-scm-server]# cd /opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-server
[root@hadoop001 cloudera-scm-server]# ll
total 8
-rw------- 1 1106 4001  714 Nov 21  2018 db.properties
-rw-r--r-- 1 1106 4001 2229 Nov 21  2018 log4j.properties

[root@hadoop001 cloudera-scm-server]# vi db.properties
# The database type
# Currently 'mysql', 'postgresql' and 'oracle' are valid databases.
com.cloudera.cmf.db.type=mysql
# The database host
# If a non standard port is needed, use 'hostname:port'
com.cloudera.cmf.db.host=hadoop001
# The database name
com.cloudera.cmf.db.name=cmf
# The database user
com.cloudera.cmf.db.user=cmf
# The database user's password
com.cloudera.cmf.db.password=123456
# The db setup type
# By default, it is set to INIT
# If scm-server uses Embedded DB then it is set to EMBEDDED
# If scm-server uses External DB then it is set to EXTERNAL
com.cloudera.cmf.db.setupType=EXTERNAL

[root@hadoop001 cloudera-scm-server]# useradd --system --home=/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false cloudera-scm
[root@hadoop002 cloudera-scm-server]# useradd --system --home=/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false cloudera-scm
[root@hadoop002 cloudera-scm-server]# useradd --system --home=/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false cloudera-scm

[root@hadoop001 cloudera-scm-server]# chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager/
[root@hadoop002 cloudera-scm-server]# chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager/
[root@hadoop003 cloudera-scm-server]# chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager/

[root@hadoop001 cloudera-scm-server]# cd /root/cdh5.6.1/
[root@hadoop001 cdh5.16.1]# mkdir -p /opt/cloudera/parcel-repo
[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 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
[root@hadoop001 cdh5.16.1]# mv manifest.json /opt/cloudera/parcel-repo/

校验文件是否完整
[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]# chown -R cloudera-scm:cloudera-scm /opt/cloudera

[root@hadoop001 parcel-repo]# mkdir -p /opt/cloudera/parcels
[root@hadoop002 parcel-repo]# mkdir -p /opt/cloudera/parcels
[root@hadoop003 parcel-repo]# mkdir -p /opt/cloudera/parcels


[root@hadoop001 parcel-repo]# chown -R cloudera-scm:cloudera-scm /opt/cloudera
[root@hadoop002 parcel-repo]# chown -R cloudera-scm:cloudera-scm /opt/cloudera
[root@hadoop003 parcel-repo]# chown -R cloudera-scm:cloudera-scm /opt/cloudera

尝试启动server,agent
[root@hadoop001 parcel-repo]# cd /opt/cloudera-manager/cm-5.16.1/etc/
[root@hadoop001 etc]# cd init.d/
[root@hadoop001 init.d]# ./cloudera-scm-server start
[root@hadoop001 init.d]# /opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent start
[root@hadoop002 init.d]# /opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent start
[root@hadoop003 init.d]# /opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent start

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值