更多分类文章:
Python | Linux | 大数据 | 数据库 | Git | Nodejs | Golang | 电脑技巧 | 计算机技术
大数据:
- CDH详细安装步骤
- CDH集群完全卸载过程
- CDH6集群详细部署过程
- CDH6彻底删除清空
- kafka基本使用及命令
- sparkstreaming+kafka实时计算例子(一)结果写回kafka
- sparkstreaming+kafka实时计算例子(二)结果写回redis
版本信息
cm-6.3
cdh-6.3
mysql-5.7
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/
https://archive.cloudera.com/cm6/6.3.0/
https://archive.cloudera.com/cdh6/6.3.0/parcels/
每个节点都需要安装数据库
(去官网下,然后将rpm传到linux)
https://dev.mysql.com/downloads
或https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
然后解压到指定目录:
tar zxf mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.27-linux-glibc2.12-x86_64 mysql
sudo mv mysql /usr/local/;
sudo chown -R mysql:mysql ./
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
sudo vi /etc/init.d/mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.、
[client]
port = 3306
default-character-set=utf8
[mysqld]
# 一般配置选项
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
character-set-server=utf8
default_storage_engine = InnoDB
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
cd /usr/local/mysql/bin/
sudo ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
sudo systemctl start mysql
./mysql -uroot -p
粘贴密码
set password=password('ruanke123');
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'ruanke123';
flush privileges;
sudo vi /etc/profile
source /etc/profile
服务名 | 数据库名 | 用户名 |
---|---|---|
Cloudera Manager Server | scm | scm |
Activity Monitor | amon | amon |
Reports Manager | rman | rman |
Hue | hue | hue |
Hive Metastore Server | metastore | hive |
Sentry Server | sentry | sentry |
Cloudera Navigator Audit Server | nav | nav |
Cloudera Navigator Metadata Server | navms | navms |
Oozie | oozie | oozie |
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scmuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amonuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rmanuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE
utf8_general_ci;
GRANT ALL ON hue.* TO 'hueuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'metastoreuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentryuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE
utf8_general_ci;
GRANT ALL ON hive.* TO 'hiveuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'navuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navmsuser'@'%' IDENTIFIED BY 'ruanke123';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozieuser'@'%' IDENTIFIED BY 'ruanke123';
flush privileges;
或者
创建用户:
create user 'scmuser'@'%' identified by 'ruanke123';
create user 'hivedbuser'@'%' identified by 'ruanke123';
create user 'amondbuser'@'%' identified by 'ruanke123';
为用户授权
grant all on scm.* to 'scmuser'@'%' identified by 'ruanke123';
grant all on hivedb.* to 'hivedbuser'@'%' identified by 'ruanke123';
grant all on amondb.* to 'amondbuser'@'%' identified by 'ruanke123';
flush privileges;
创建数据库:
create database scm DEFAULT CHARACTER SET utf8;
create database hivedb DEFAULT CHARACTER SET utf8;
create database amondb DEFAULT CHARACTER SET utf8;
sudo systemctl stop mysqld
sudo rm -rf /usr/local/mysql/data
cd /usr/local/mysql/bin/
sudo ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql -
datadir=/usr/local/mysql/data
sudo systemctl start mysql
./mysql -uroot -p
set password=password('ruanke123');
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'ruanke123';
flush privileges;
sudo hostnamectl set-hostname cdh-node-1
为剩余两台:
sudo hostnamectl set-hostname cdh-node-2
sudo hostnamectl set-hostname cdh-node-3
sudo yum install oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
sudo vi /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
source /etc/profile
(1)使用 查询是否安装NTP,若未安装则用安装NTP
rpm -qa | grep ntp
(2)开启服务
sudo systemctl start ntpd
(3)主节点192.168.0.230保存不变,其他节点修改:执行
sudo vim /etc/ntp.conf
在其后面加入:
server 127.127.1.0
fudge 127.127.1.0 stratum 10
(4)全部执行
sudo systemctl restart ntpd
(5)使用ntpq -p 验证
sudo vi /etc/hosts
172.18.245.103 cdh-node-1
172.18.245.104 cdh-node-2
172.18.245.105 cdh-node-3
sudo groupadd hadoop //新建hadoop组
sudo useradd -g hadoop -p hadoop hadoop//新建hadoop用户
sudo passwd hadoop //修改hadoop密码为ruanke123
sudo vi /etc/sudoers
hadoop ALL=(ALL) NOPASSWD: ALL
sudo vi /etc/httpd/conf/httpd.conf
修改端口
Listen 12580
推荐使用此种方法:
sudo mkdir /var/www/html/cm63
sudo cp ./* /var/www/html/cm63/
sudo mkdir /var/www/html/cdh63
cd /var/www/html/
sudo chmod -R oug+rx /var/www/html/cm63/
cd /var/www/html/cm63
sudo createrepo .
sudo chmod -R oug+rx /var/www/html/cdh63/
cd /var/www/html/cdh63/
sudo createrepo .
创建新的cloudera-manager.repo和cdh.repo源配置文件
sudo touch cloudera-manager.repo
sudo vi cloudera-manager.repo
sudo touch cdh.repo
另一种创建方法:
(1)CM本地仓库
sudo mkdir -p /repos/cm/
cd /repos/cm/
sudo mkdir cm6.3
sudo ln -s cm6.3/ latest
把cloudera-manager的安装包上传到latest目录中
进入安装包目录
sudo cp ./* /repos/cm/latestsudo yum install createrepo
cd /repos/cm
createrepo .
(2) 搭建cdh仓库
sudo mkdir -p /repos/parcels/cdhcd /repos/parcels/cdh
sudo mkdir cdh6.3
sudo ln -s cdh6.3/ latest
sudo cp ./* /repos/parcels/cdh/latest
(3) 在Apache服务器上添加安装包的软连接
cd /var/www/html/sudo ln -s /repos repos
(4) 配置yum
在每个机器上,进入到/etc/yum.repos.d下,新增myrepo.repo,如下
sudo vi myrepo.repo
[myrepo] name=myrepo baseurl=http://172.18.245.103:12580/repos/cm/ enabled=1 gpgcheck=0
其他服务器上:
sudo vi /etc/yum.repos.d/myrepo.repo
复制以上内容
sudo yum install cloudera-manager-server.x86_64
cd /etc/cloudera-scm-server
sudo 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=172.18.245.103:3306
# The database name
com.cloudera.cmf.db.name=scm
# The database user
com.cloudera.cmf.db.user=scmuser
# The database user's password
com.cloudera.cmf.db.password=ruanke123
# 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=INIT
每个节点都要有:官网下载 wget http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar
sudo mkdir -p /usr/share/java/
sudo cp mysql-connector-java-5.1.47.jar /usr/share/java/
sudo mv mysql-connector-java-5.1.47.jar mysql-connector-java.jar
每台机器都有要mysql驱动
sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scmuser ruanke123
sudo systemctl start cloudera-scm-server.service
sudo systemctl status cloudera-scm-server.service
sudo systemctl stop cloudera-scm-server.service
sudo tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
http://172.18.245.103:7180
账户/密码:admin/admin
点击
账户:hadoop
密码:ruanke123
在三台上创建hadoop用户并设同一密码ruanke123
排除错误,直到完成
对网络和主机进行检查
点击检查显示结果,排除然后继续
解决:
(node1-node3都要执行)
sudo sh -c "echo never > /sys/kernel/mm/transparent_hugepage/defrag"
sudo sh -c "echo never > /sys/kernel/mm/transparent_hugepage/enabled"
sudo vi /etc/rc.local
最后面加入
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
查看cat /sys/kernel/mm/transparent_hugepage/defrag
是否选中[never]
top查看内存,若buff/cache过大,使用以下方法清理:
sudo sh -c "echo 1 > /proc/sys/vm/drop_caches"
sudo sh -c "echo 2 > /proc/sys/vm/drop_caches"
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
配置几个变红的参数
java-heap:512兆字节
kafka-broker:cdh-node-1:9092;cdh-node-2:9092;cdh-node-3:9092
kafka-Miror..:cdh-node-2:9092
ScmActive: Unable to retrieve non-local non-loopback IP address. Seeing address: localhost/127.0.0.1.
解决:修改这几台hostname
当启动成功时最后会出现并停止刷屏:
2019-09-06 11:17:42,464 INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
(1)无法复制安装文件
解决:未下载allkeys.asc文件在cm文件夹
cd /var/www/html/cm63
sudo wget https://archive.cloudera.com/cm6/6.3.0/allkeys.asc
sudo createrepo .
(2)安装失败
查看日志
sudo tail -f /var/log/cloudera-scm-agent/cloudera-scm-agent.log
修改hostname后,“重试”ok。
(1)副本不足的块
解决:
1)HDFS-->配置:
hdfs复制因子改为2
dfs.replication这个参数其实只在文件被写入dfs时起作用,虽然更改了配置文件,但是不会改变之前写入的文件的备份数。
所以我们还需要步骤2
2)在NameNode所在执行以下命令:
sudo -u hdfs hadoop fs -setrep 2 /
(改变整个hdfs目录下文件的副本个数, 2为所设置的副本个数,-R选项可以对一个目录下的所有目录与文件递归执行操作)
(3)只重启HDFS,其余需要启动的会自动重启无需再干预
注:
CDH环境下Hadoop平台最高权限用户是hdfs,属于supergroup组。默认HDFS会开启权限认证,所以操作时,需要将root用户切换到hdfs用户,否则会报错。
先在Linux添加supergroup组,把root用户添加到supergroup里,再同步权限到HDFS。
sudo groupadd supergroup
sudo usermod -a -G supergroup root
su - hdfs -s /bin/bash -c "hdfs dfsadmin -refreshUserToGroupsMappings"
(2)
原文链接:CDH6集群详细部署过程