离线部署主要分为三块
echo '"172.21.230.219 ifeng01" >> /ect/hosts
echo '"172.21.230.220 ifeng02" >> /ect/hosts
echo '"172.21.230.221 ifeng03" >> /ect/hosts
hostname文件也要相应修改
第一台修改为
echo "ifeng01" >> /ect/hostname
以下同理
hostname与hosts的区别
# 关闭
sudo systemctl stop firewalld
# 禁用
sudo systemctl disable firewalld
# 清空规则
sudo iptables -F
sudo vi /etc/selinux/config
SELINUX=disabled
timedatectl --help
# 查看时区
timedatectl list-timezones | grep Shanghai
#设置时区
timedatectl set-timezone Asia/Shanghai
主节点和互联网同步,从节点与主节点同步
# 安装ntp
yum install -y ntp
vi /etc/ntp.conf
# 增添如下两句
# 设置如果网络时间不可用 那么应用本地时间
server 127.127.1.0 iburst local clock
# 设置本服务器能够被哪些其他服务器链接
restrict 172.21.230.0 mask 255.255.255.0 nomodify notrap
主节点服务器启动ntp
systemctl start ntpd
# 查看ntp状态
systemctl stauts ntpd
# 与网络时间进行一个验证
ntpd -q
#slave 都用停用ntp时间
systemctl stop ntpd
systemctl disable ntpd
# 设置与Master同步
nrpdate ifeng01
# 设置每天同步一次
crontab -e
#*****:五个*代表
00 00 * * */usr/sbin/ntpdate ifeng01
每一台都和互联网同步时间
1 & 2 中的互联网时间--------------> 公司时钟服务器
mkdir /usr/java/
root@ifeng01 CDH6.3.1]# tar -xzvf jdk-8u181-linux-x64.tar.gz -C /usr/java
[root@ifeng01 CDH6.3.1]# chown -R root:root /usr/java/jdk1.8.0_181/
echo "export JAVA_HOME=/usr/java/jdk1.8.0_181" >> /etc/profile
echo "export PATH=/usr/java/jdk1.8.0_181/bin:${PATH}" >> /etc/profile
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_181
export PATH=${JAVA_HOME}/bin:${PATH}
source /etc/profile
# 检验是否成功
which java
tar开
tar -xzvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
重命名
mv mysql-5.7.11-linux-glibc2.5-x86_64 mysql
mkdir /usr/local/mysql/arch
mkdir ./mysql/data
mkdir ./mysql/tmp
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 = 12G
#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
# -g:指定组ID为101
groupadd -g 101 dba
#指定用户id 514到 dba组中
#-d 登录时的初始目录
useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量
cp /etc/skel/.* /usr/local/mysql
[root@localhost mysql]# vi .bashrc
# User specific environment and startup programs
export MYSQL_BASE=/usr/local/mysql
export PATH=${MYSQL_BASE}/bin:$PATH
chown mysqladmin:dba /etc/my.cnf
chmod 640 /etc/my.cnf
chown -R mysqladmin:dba /usr/local/mysql
chmod -R 755 /usr/local/mysql
cd /usr/local/mysql
#将服务文件复制到init.d下,重命名为MySQL
cp support-files/mysql.server /etc/rc.d/init.d/mysql
# 赋权限
chmod +x /etc/rc.d/init.d/mysql
# 增加一项新的服务交由chkconfig管理
chkconfig --add mysql
# 设定在345下开启mysql
#暂时不执行
chkconfig --level 345 mysql on
yum -y install libaio
切换到mysqladmin账户
su mysqladmin
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 文件里,更加隐蔽,不熟悉的话可能会无所适从)
cd /usr/local/mysql/data
cat hostname.err | grep password
切换到mysqladmin账号
su - mysqladmin
启动mysql
service mysql start
登录MySQL
mysql -uroot -p
密码为上图红线部分
应用mysql数据库
use mysql
被提示应该重置密码
重置密码
alter user root@localhost identified by 'ifeng001';
赋予用户权限
# grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'ifeng001' ;
刷新刚修改的权限
flush privileges;
service mysql restart
创建CDH元数据库 用户 amon(Activity Monitor(活动监控))的服务的库 用户
cteate database cmf default charcter set utf8;
create database amon default charcter set utf8;
grant all privileges on cmf.* to 'cmf'@'%' identified by '1qaz2wsx!';
grant all privileges on amon.* to 'amon'@'%' identified by '1qaz2wsx!';
flush privileges;
选择第一台部署 amon的进程 那么mysql jdbc jar
jar包目录
mkdir -p /usr/share/java
复制jar包过去并重命名(去掉版本号)
cp mysq1-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
# Master
[root@localhost CDH6.3.1]# tar -xzvf cm6.3.1-redhat7.tar.gz
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
#官方的postgresql 选择不用,采用MySQL
cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm
总结:
# server
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
# agent
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
网络环境放开 用yum安装
# 网络环境放开 用yum安装
yum install cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
yum install cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
网络环境关闭 离线部署
rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
rpm -ivh cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
# cd /etc/cloudera-scm-server/
vi db.properties
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# This file describes the database connection.
#
# 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=10.103.66.115:3306
# 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=1qaz2wsx!
# The db setup type
# After fresh install it is set to INIT
# and will be changed post config.
# 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
~
日志存放地址
var/log/cloudera-scm-server
service cloudera-scm-server start
tail -F cloudera-scm-server.log
service cloudera-server status
打开7180页面后不要动
进行三台的agent的安装
主节点Master也需要安装agent
yum install cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
[root@ifeng01 x86_64]# vi /etc/cloudera-scm-agent/config.ini
[General]
# Hostname of the CM server.
server_host=ifeng01
复制Master的两个rpm包到从节点
[root@ifeng01 x86_64]# scp cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm ifeng02:/root/CDH6.3.1/
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 120.9MB/s 00:00
[root@ifeng01 x86_64]# scp cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm ifeng03:/root/CDH6.3.1/
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 100.3MB/s 00:00
[root@ifeng01 x86_64]# scp cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm ifeng02:/root/CDH6.3.1/
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 100% 1148MB 180.3MB/s 00:06
[root@ifeng01 x86_64]# scp cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm ifeng03:/root/CDH6.3.1/
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
从节点分别安装这两个rpm包
每台分别安装
yum install cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
yum install cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
vi /etc/cloudera-scm-agent/config.ini
[General]
# Hostname of the CM server.
server_host=ifeng01
service cloudera-scm-agent start
检查启动情况
service cloudera-scm-agent status
默认账户密码:
admin
admin
Master:
yum install -y httpd
创建parcel文件夹
mkdir /var/www/html/cdh6_parcel
移动parcel到/var/www/html/cdh6_parcel
root@ifeng01 CDH6.3.1]# mv CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel /var/www/html/cdh6_parcel
#把末尾的1 去掉,1代表不完整的
[root@ifeng01 CDH6.3.1]# mv CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha1 /var/www/html/cdh6_parcel/CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha
service httpd start
/var/log
临时:
sysctl vm.swappiness=10
永久:
echo 'vm.swappiness=10'>> /etc/sysctl.conf
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled