CDH部署文档——离线部署

1 离线部署规划

离线部署主要分为三块

  • MySQL的离线部署
  • CM离线部署
  • Parcel的离线部署

2 服务器规划

在这里插入图片描述

3 离线部署安装包说明

MySql离线部署

  • mysql-5.7.11-linux-glibc2.5-x86_64.tat.gz
  • mysql-connector-java-5.1.47.jar

CM

  • cm-6.3.1-radhat7.tar.gz

Parcel文件

  • CDH-6.3.1-1.cdh6.3.1.p0.1470567-e17.parcel
  • CDH-6.3.1-1.cdh6.3.1.p0.1470567-e17.parcel.shal
  • maifest.json

JDK & jar

  • jdk-8u45-linux-x64.gz
  • mysql-connector-ajva-5.1.47.jar

4 节点初始化

4.1 host文件的修改

echo '"172.21.230.219 ifeng01" >> /ect/hosts
echo '"172.21.230.220 ifeng02" >> /ect/hosts
echo '"172.21.230.221 ifeng03" >> /ect/hosts

4.2 关闭防火墙和清空规则

# 关闭
sudo systemctl stop firewalld
# 禁用
sudo systemctl disable firewalld
# 清空规则
sudo iptables -F

4.3 关闭seLinux

sudo vi /etc/selinux/config

在这里插入图片描述
改为

SELINUX=disabled

4.4 统一时区

timedatectl --help

# 查看时区
timedatectl list-timezones | grep Shanghai

#设置时区
timedatectl set-timezone Asia/Shanghai

在这里插入图片描述

4.5 时间同步

4.5.1 主从(优先)

主节点和互联网同步,从节点与主节点同步

# 安装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

4.5.2 主主主

每一台都和互联网同步时间

4.5.3 公司内部时钟服务器 / Maven仓库中心

1 & 2 中的互联网时间--------------> 公司时钟服务器

5 基础软件安装

5.1 JDK安装

5.1.1 创建JDK的目录

mkdir /usr/java/

5.1.2 tar开jdk.gz

tar -xzvf jdk-8u45-linux-x64.ga -C /usr/java/

5.1.3 修正用户和用户组

chown -R root:roor /usr/java/kdl1.8.0_45

5.1.4 配置环境变量

  • JAVA_HOME
ehco "export JAVA_HOME=/usr/java/jdk1.8.0_45" >> /etc/profile
  • PATH
echo "export PATH=/usr/java/jdk1.8.0_45/bin:${PATH}" >> /etc/profile
source /etc/profile

# 检验是否成功
which java

5.2 离线部署MySQL

5.2.1 tar开gz

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

5.2.2 创建my.cnf文件

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

5.2.3 创建用户组以及用户

# -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

5.2.4 配置环境变量

[[email protected] mysql]# vi .bashrc
# User specific environment and startup programs
export MYSQL_BASE=/usr/local/mysql
export PATH=${MYSQL_BASE}/bin:$PATH

5.2.5 赋予权限

chown mysqladmin:dba /etc/my.cnf
chmod 640 /etc/my.cnf
chown -R mysqladmin:dba /usr/local/mysql
chmod -R 755 /usr/local/mysql

5.2.6 配置开机自启动

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

5.2.7 安装libaio包 & 初始化DB

yum -y install libaio
bin/mysqld \
--defaults-file=/etc/my.cnf \
--user=mysqladmin \
--basedir=/usr/local/mysql/ \
--datadir=/usr/local/mysql/data/ \
--initialize


#在初始化时如果加上 –initial-insecure,则会创建空密码的 [email protected] 账号,否则会创建带密码的 [email protected] 账号,密码直接写在 log-error 日志文件中
#(在5.6版本中是放在 ~/.mysql_secret 文件里,更加隐蔽,不熟悉的话可能会无所适从)

5.2.8 查看密码 & 启动

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 [email protected] identified by 'ifeng001';

赋予用户权限

# grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'ifeng001' ;

刷新刚修改的权限

flush privileges;

5.2.9 重启MySQL

service mysql restart

5.3 元数据库

5.3.1 创建数据库 & 用户

创建CDH元数据库 用户 amon的服务的库 用户

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;

5.3.2 jar包

选择第一台部署 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

5.4 CM部署

发布了163 篇原创文章 · 获赞 623 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/weixin_39381833/article/details/105180010