一、服务器准备
1、服务器配置
准备3台服务器,建议最低配置如下(阿里云大约每台每月六百多):
centos7.4 8c 16G
39.101.192.109 node001
39.101.179.3 node002
39.99.236.205 node003
为服务器开启外网端口访问
7180、8900
2、下载安装包
到CDH官方下载地址下载文件,可以到上一级目录选择版本https://archive.cloudera.com/cdh6/6.0.0/parcels/
下载cdh文件到/var/www/html/cloudera-repos/目录
https://archive.cloudera.com/cdh6/6.0.0/parcels/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel
https://archive.cloudera.com/cdh6/6.0.0/parcels/CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.parcel.sha256
https://archive.cloudera.com/cdh6/6.0.0/parcels/manifest.json
下载repo支持文件到/var/www/html/cloudera-repos/repodata/目录
https://archive.cloudera.com/cdh6/6.3.2/redhat7/yum/repodata/repomd.xml
https://archive.cloudera.com/cdh6/6.3.2/redhat7/yum/repodata/3224703272392229e02b46c2ef95286e92cce148a07c04752bcfe98870bfd675-primary.sqlite.bz2
https://archive.cloudera.com/cdh6/6.3.2/redhat7/yum/repodata/4f1d5a908a6b4fd79988109121695168a65ef0846f178bbf32dc99f92c7cef36-filelists.sqlite.bz2
到CM官方下载地址下载文件,可以到上一级目录选择版本https://archive.cloudera.com/cm6/6.0.0/
下载cm文件到/var/www/html/cloudera-repos/RPMS/x86_64/目录
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.0.0-530873.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.0.0-530873.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.0.0-530873.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-db-2-6.0.0-530873.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
下载文件到/var/www/html/cloudera-repos/目录
https://archive.cloudera.com/cm6/6.0.0/allkeys.asc
3、配置文件服务器
启动一个http服务器用于安装rpm安装包,以及方便后面cdh安装
cd /var/www/html/
python -m SimpleHTTPServer 8900
为所有需要升级的服务器配置本地repo库
vi /etc/yum.repos.d/cloudera-manager.repo
[cloudera-manager]
name=Cloudera Manager 6.0.0
baseurl=http://node001:8900/cloudera-repos/
gpgcheck=0
enabled=1
测试配置是否生效
yum deplist cloudera-manager-agent
二、环境准备
1、设置服务器超时时间1小时
/etc/profile中添加
export TMOUT=3600 # 超时时间1小时
让配置生效
source /etc/profile
/etc/ssh/sshd_config中添加
ClientAliveInterval 60 # 每60秒检测一次客户端是否存在
ClientAliveCountMax 3 # 检测3次
修改配置后,重启sshd服务
systemctl restart sshd
2、配置3节点免密登录
在每一台服务器中的/etc/hosts添加节点名字
172.26.53.202 node001
172.26.53.203 node002
172.26.53.204 node003
在每一台服务器中生成rsa密钥,一路按回车即可
ssh-keygen -t rsa
在每一台服务器执行如下命令,让3台服务器可互相免密登录
ssh-copy-id -i ~/.ssh/id_rsa.pub root@node001
ssh-copy-id -i ~/.ssh/id_rsa.pub root@node002
ssh-copy-id -i ~/.ssh/id_rsa.pub root@node003
3、 修改transparent_hugepage参数(透明大页面压缩)
# 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.d/rc.local
# echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local
三、cdh安装
1、每台服务器安装java
yum install oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
在/etc/profile中追加如下配置:
JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$PATH:$JAVA_HOME/bin:$HOME/bin:$HOME/.local/bin
让配置生效
source /etc/profile
2、安装mysql
下载安装包,安装mysql-server
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
设置mysql大小写不敏感(非常重要)
修改/etc/my.conf文件中 [mysqld] 的内容
lower_case_table_names=1
启动mysql服务,并把mysql加入开机启动
systemctl start mysqld
systemctl enable mysqld
登录到mysql
mysql -uroot -p
为root用户授外网访问权限
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '##你的密码##';
flush privileges;
4、安装
sudo yum clean all
sudo yum upgrade cloudera-manager-daemons cloudera-manager-agent
rpm -qa 'cloudera-manager-*'
5、初始化数据库
mysql -uroot -p
# Cloudera Manager的数据库
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm@123';
# Activity Monitor的数据库
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon@123';
# Reports Manager的数据库
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman@123';
# Hue的数据库
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue@123';
# Metastore的数据库
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore@123';
# Sentry的数据库
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry@123';
# Cloudera Navigator Audit Server的数据库
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav@123';
# Cloudera Navigator Metadata Server的数据库
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms@123';
# Oozie的数据库
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie@123';
# Hive的数据库
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive@123';
flush privileges;
6、使用scm初始化mysql
sh /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
7、主节点启动server
systemctl start cloudera-scm-server
systemctl enable cloudera-scm-server
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
systemctl status cloudera-scm-server
8、子节点启动agent
配置server服务器地址
vim /etc/cloudera-scm-agent/config.ini
server_host=node001
启动agent服务
systemctl start cloudera-scm-agent
systemctl enable cloudera-scm-agent
tail -f /var/log/cloudera-scm-agent/cloudera-scm-agent.log
systemctl status cloudera-scm-agent
9、网页访问cm
http://39.101.192.109:7180/
转载:https://blog.csdn.net/leexiangg/article/details/105492460