CDH安装部署文档
部署位置:
zgl-1(192.168.127.121):mysql cm-server cm-agent NN DN RM NM ZK
zgl-2(192.168.127.122):cm-agent DN NM ZK SNN
zgl-3(192.168.127.123):cm-agent DN NM ZK
zgl-1(192.168.127.121)、zgl-2(192.168.127.122)、zgl-3(192.168.127.123)
jdk-8u45-linux-x64.gz mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
mysql-connector-java.jar CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel
CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel.sha cm5.10.0-centos6.tar.gz
manifest.json
三、安装mysql(zgl-1)
#解压安装:tar -zxvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
#重命名:mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql-5.6.23
#创建组和用户:
groupadd -g 101 dba
useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
#检查用户是否创建成功:
id mysqladmin
#显示如下图,表示成功创建用户mysqladmin
#配置/etc/my.cnf
vim /etc/my.cnf
#删除原本文件内容,粘贴如下内容
[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
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 = 1
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 = MIXED
log_bin_trust_function_creators=1
log-error = /usr/local/mysql/data/hostname.err
log-bin=/usr/local/mysql/arch/mysql-bin
#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
#log-slave-updates
#sync_binlog = 1
#for innodb options
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:500M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/arch
innodb_log_files_in_group = 2
innodb_log_file_size = 200M
innodb_buffer_pool_size = 1024M
innodb_additional_mem_pool_size = 50M
innodb_log_buffer_size = 16M
innodb_lock_wait_timeout = 100
#innodb_thread_concurrency = 0
innodb_flush_log_at_trx_commit = 1
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 = 16M
[mysql]
no-auto-rehash
[mysqlhotcopy]
interactive-timeout
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
#开启权限
chown mysqladmin:dba /etc/my.cnf
chmod 640 /etc/my.cnf
chown -R mysqladmin:dba /usr/local/mysql
chmod -R 755 /usr/local/mysql
#重新开启一个zgl-1窗口(zgl-1.1)
#切换用户:
su - mysqladmin
#在zgl-1.1窗口下(新开启的zgl-1窗口),创建目录(此时目录是:/usr/local/mysql)
mkdir arch
#在zgl-1窗口下安装如下:
yum -y install libaio
#在zgl-1.1窗口下:
scripts/mysql_install_db --user=mysqladmin --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
#在zgl-1窗口下,执行以下命令:
cd /usr/local/mysql
cp support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
chkconfig --add mysql
chkconfig --level 345 mysql on
vi /etc/rc.local
#添加以下内容
su - mysqladmin -c "/etc/init.d/mysql start --federated"
#在zgl-1.1窗口下执行以下命令:
cd /usr/local/mysql
rm -rf my.cnf
#在zgl-1窗口下,执行以下命令:
cp /etc/skel/.* /usr/local/mysql
chown mysqladmin:dba .bash*
#在zgl-1.1窗口下:
ll -a
vim .bash_profile
#先删除.bash_profile 的最后两行,然后添加如下内容
# User specific environment and startup programs
MYSQL_BASE=/usr/local/mysql
export MYSQL_BASE
PATH=${MYSQL_BASE}/bin:$PATH
export PATH
unset USERNAME
#stty erase ^H
set umask to 022
umask 022
PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1
#登录mysql,在zgl-1.1窗口下:
su - mysqladmin
mysqld_safe &
mysql -uroot -p
两次回车
use mysql;
update user set password=password('123456') where user='root';
delete from user where user='';
flush privileges;
exit;
#mysql安装完毕
四、关闭三台机器的防火墙、配置network、hosts、ssh(此处省略)
service iptables stop
chkconfig iptables off
五、安装oracle jdk
mkdir -p /usr/java
tar -zxvf jdk-8u45-linux-x64.gz -C /usr/java/
#配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_45
export PATH=.:$JAVA_HOME/bin:$PATH
#在zgl-2、zgl-3节点上分别安装目录:
mkdir -p /usr/java
scp -r jdk1.8.0_45/ @zgl-2:/usr/java/
scp -r jdk1.8.0_45/ @zgl-3:/usr/java/
scp /etc/profile @zgl-2:/etc/
scp /etc/profile @zgl-3:/etc/
source /etc/profile
#测试java是否安装成功
java -version
六、检查pyhton :建议是python2.6.6
python --version
七、安装http和启动http服务(zgl-1)
# pm -qa|grep httpd
# yum install -y httpd
# 启动httpd的服务
service httpd start
#创建parcels文件
cd /var/www/html
mkdir parcels
cd parcels
#将CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel
CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel.sha1
manifest.json 这三个文件下发到parcels目录下
# mv CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel.sha1 CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel.sha
#验证文件下载是否损坏
cat CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel.sha
#如下图所示,表示文件未损坏
#查看算法
ll /usr/bin/sha*
#使用以上图片红色算法
sha1sum CDH-5.10.0-1.cdh5.10.0.p0.41-el6.parcel
#验证,在web浏览器上
http://192.168.127.121/parcels/
八、安装CM
# tar -zxvf cm5.10.0-centos6.tar.gz -C /var/www/html/
# cd /var/www/html/
#在html目录下
mkdir -p cm5/redhat/6/x86_64/
mv cm cm5/redhat/6/x86_64/
#.配置本地的yum源,cdh集群在安装时会就从本地down包,不会从官网了(三台)
vim /etc/yum.repos.d/cloudera-manager.repo
[cloudera-manager]
name = Cloudera Manager, Version 5.10.0
baseurl = http://192.168.127.121/cm5/redhat/6/x86_64/cm/5/
gpgcheck = 0
cd /var/www/html/cm5/redhat/6/x86_64/cm/5.10.0/RPMS/x86_64
yum install cloudera-manager-daemons-5.10.0-1.cm5100.p0.85.el6.x86_64.rpm
yum -y install cloudera-manager-server-5.10.0-1.cm5100.p0.85.el6.x86_64.rpm
#.mysql 创建元数据库和用户(另起一台zgl-1)
su - mysqladmin
mysql -uroot -p
create database cmf DEFAULT CHARACTER SET utf8;
grant all on cmf.* TO 'cmf'@'%' IDENTIFIED BY '123456';
flush privileges;
create database amon DEFAULT CHARACTER SET utf8;
grant all on amon.* TO 'amon'@'%' IDENTIFIED BY '123456';
flush privileges;
#修改server mysql的配置
vim /etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=192.168.127.121:3306
com.cloudera.cmf.db.name=cmf
com.cloudera.cmf.db.user=cmf
com.cloudera.cmf.db.password=123456
com.cloudera.cmf.db.setupType=EXTERNAL
#jdbc驱动包添加
cd /usr/share/java
rz 上传 mysql-connector-java.jar
#启动服务
service cloudera-scm-server start
#监控日志:
cd /var/log/cloudera-scm-server/
tailf cloudera-scm-server.log
#web登陆:
http://192.168.127.121:7180
#接下来就是web界面上的配置
#登录:admin admin
九、按图操作
#按如下图选免费版本
#搜索节点:192.168.127.121/192.168.127.122/192.168.127.123
#搜索后如下图所示
#如下图所示
#如下图所示
#如下图所示,添加parcel的地址
#如下图所示
#按照页面提示配置,完成后如下图
#以上安装静心等待,需要时间
#以下界面显示,继续等待
#环境检查,如下图(自动)
#关闭大页面,三台节点同时处理,如下代码
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag'>> /etc/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'>> /etc/rc.local
#设置swap
echo 'vm.swappiness = 10' >> /etc/sysctl.conf
sysctl -p
十、安装hadoop
#按照如下图所示
在指定服务选择,hdfs、yarn、zookeeper
#直接在界面配置,选定不同的节点安装不同的组件
#接下来是hdfs的配置,都是默认配置即可
#安装好后的界面
#成功界面如下