公司有几台闲置机器,之前同事安装了cdh5.12.1,使用rpm安装,安装容易后期维护个人感觉很麻烦啊!特别是各种路径非常难找!后面同事又安装了kerberos,总之非常乱,而且从那以后,这4台机器就没人开始用过集群……只有我偶尔牵挂下……
为了让团队以及自己能多学点东西吧,花点时间研究下,卸载之!这里参考,感谢:
https://blog.csdn.net/wulantian/article/details/42706777
https://blog.csdn.net/u011031430/article/details/72867745
以下亲测过,放心参考~
环境:系统:CentOS Linux release 7.3.1611 (Core)
JAVA:java version "1.8.0_144"
简要说明:
server是服务端,提供包括CDH-ui组件等。
agent真正安装应用程序的节点。
Management是元数据管理。
DataBase是元数据的对应的数据库。
1.免密 登陆:
ssh-keygen -t rsa
主节点执行:
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
生成无密码密钥对
拷贝公钥到其他节点,执行
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
测试: 主节点 ssh 其他节点……
2.关闭防火墙:
临时关闭:
service iptables stop
重启后生效:
chkconfig iptables off
3.关闭 SELINUX
临时关闭:
setenforce 0
修改配置文件/etc/selinux/config(重启生效):
将 SELINUX=enforcing 改为 SELINUX=disabled
查看 SELINUX 状态:
1、 /usr/sbin/sestatus –v
SELinux status: enabled(enabled:开启; disabled:关闭)
2、使用命令: getenforce
4.安装JDK
5.设置 NTP
所有节点安装 NTP:
yum install ntp
配置开机启动:
chkconfig ntpd on
检查是否设置成功:
chkconfig --list ntpd (2-5 为 on 状态则成功)
设置同步:
ntpdate -u ntp.sjtu.edu.cn(时钟服务器根据实际环境设置、 本文采用 210.72.145.44-国家授时
中心服务器 IP 地址)
6.下载第三方依赖
yum install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse fuse-libs redhat-lsb -y
安装Cloudera Manager Server 和Agent:
1.下载地址:http://archive.cloudera.com/cm5/cm/5/
本次下载:cloudera-manager-centos7-cm5.15.1_x86_64.tar.gz,
其中el等信息为red heat linux简称,5、6、7分别代表相应版本。
2.parcels下载:http://archive.cloudera.com/cdh5/parcels/
parcels包裹,比rpm包或者yum安装更容易管理,同时维护升级方便。
3.初始化数据库
下载mysql驱动包,并复制到/opt/cm-5.15.1/share/cmf/lib下:
cp /usr/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar ./mysql-connector-java.jar
执行:
cd /opt/cm-5.15.1/share/cmf/schema/ #不进入目录发现报错了,没验证,撇了一眼,最好进入目录
/opt/cm-5.15.1/share/cmf/schema/scm_prepare_database.sh mysql -hlocalhost -uroot -proot --scm-host localhost scm scm scm
4.agent配置:
修改/opt/cm-5.15.1/etc/cloudera-scm-agent/config.ini中的server_host为主节点的主机名。
然后分发agent到其他各个节点
scp -r /opt/cm-5.15.1/ root@dc3:/opt/
5.创建用户 cloudera-scm(所有节点)
cloudera-scm 用户说明, 摘自官网:
Cloudera Manager Server and managed services are configured to use the user account
cloudera-scm by default, creating a user with this name is the simplest approach. This created
user, is used automatically after installation is complete.
执行:
useradd --system --home=/opt/cm-5.15.1/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
6.修改CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha1为CDH-5.15.1-1.cdh5.15.1.p0.4-el7.parcel.sha,否则cdh会重新下载
7.启动cloudera-manager-server以及agent
在master节点启动服务端:
/opt/cm-5.15.1/etc/init.d/cloudera-scm-server start
在所有节点启动Agent:
/opt/cm-5.15.1/etc/init.d/cloudera-scm-agent start
日志:
tail -f /opt/cm-5.15.1/log/cloudera-scm-server
出现最终启动失败,并且http://192.168.9.167:7180/cmf/login 无法打开,报错是bean什么创建失败,后面有1048>1024什么都错误,那是数据库配置存在问题:
解决办法:
附带安装,已经安装的,不必再安装,直接看配置数据库:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum update
sudo yum install mysql-server
sudo systemctl start mysqld
8.配置数据库
sudo systemctl stop mysqld
var/lib/mysql/目录下将已经存在都数据文件备份/var/lib/mysql/ib_logfile0 and /var/lib/mysql/ib_logfile1
设置隔离级别(必须):READ-COMMITTED
设置最大连接数max_connections
附带一个推荐都配置(见文章末尾部分),直接将/etc/my.cnf文件内容替换。
9.验证安装:
打开:http://192.168.9.167:7180
用户密码:admin admin
不用安装:本地已经有1.8点jdk了。
使用离线parcels分发节点安装:
失败,失败原因:并没有使用离线下载都来安装,而是采用yum来安装。
这里我电脑之前源配置有问题,我直接/etl/yum.repo.d目录下对应删除,并执行:
yum clean all
yum clean metadata
yum update
并且安装相应依赖,以及配置:
yum -y install psmisc MySQL-python at bc bind-libs bind-utils cups-client cups-libs cyrus-sasl-gssapi cyrus-sasl-plain ed fuse fuse-libs httpd httpd-tools keyutils-libs-devel krb5-devel libcom_err-devel libselinux-devel libsepol-devel libverto-devel mailcap noarch mailx mod_ssl openssl-devel pcre-devel postgresql-libs python-psycopg2 redhat-lsb-core redhat-lsb-submod-security x86_64 spax time zlib-devel
chmod +x /etc/rc.d/rc.local
echo "echo 0 > /proc/sys/vm/swappiness" >>/etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >>/etc/rc.d/rc.local
echo 0 > /proc/sys/vm/swappiness
echo never > /sys/kernel/mm/transparent_hugepage/defrag
yum -y install rpcbind
systemctl start rpcbind
echo "systemctl start rpcbind" >> /etc/rc.d/rc.local
配置数据库连接:
使用mysql需要自己创建数据库,脚本如下(其他有需要都数据库同理创建):
##hive
create database hive DEFAULT CHARACTER SET utf8;
grant all on hive.* TO 'hive'@'%' IDENTIFIED BY 'hive';
##oozie
create database oozie DEFAULT CHARACTER SET utf8;
grant all on oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie';
#hue
create database hue DEFAULT CHARACTER SET utf8;
grant all on hue.* TO 'hue'@'%' IDENTIFIED BY 'hue';
这里链接地址,我使用dc1,以及ip地址均报错,使用localhost通过,并且后续都正常,并且我数据库都开启了远程访问,不知道是不是cdh默认后期强制让这些节点都数据库安装在同一台机器,还是我哪里配置有问题,就没有继续研究了。
附MySQL配置文件
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
transaction-isolation = READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
symbolic-links = 0
key_buffer_size = 32M
max_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 550
#expire_logs_days = 10
#max_binlog_size = 100M
#log_bin should be on a disk with enough free space.
#Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your
#system and chown the specified folder to the mysql user.
log_bin=/var/lib/mysql/mysql_binary_log
#In later versions of MySQL, if you enable the binary log and do not set
#a server_id, MySQL will not start. The server_id must be unique within
#the replicating group.
server_id=1
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 4G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_ALL_TABLES
进度非常缓慢,而且看安装信息,明明是离线安装的,为何成了yum下载安装?
解决办法:这点刚开始我也卡了很久,而且也等了很久,百思不得其解啊!
后面总结了多个人多博客,回到上面,把依赖安装上。
同时,在每个准备做agent都节点上都启动
/opt/cm-5.15.1/etc/init.d/cloudera-scm-agent start
参考:https://segmentfault.com/q/1010000015638069