最近新购了一台工作站,急切的想试一下手,就搭建个CDH集群吧,练练手,顺便了解一下最新版的CDH长成什么样子了……
工作站的配置:Thinkpad P50,Intel(R)Xeon E3 1505M [email protected] 2.81GHz ;内存48G;显卡4G……
http://archive.cloudera.com/cm5/installer/latest/cloudera-manager-installer.bin
http://archive.cloudera.com/cm5/installer/5.9.0/cloudera-manager-installer.bin(我选择下载的版本)
对应我的平台的RPMS包下载地址如下:
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.9.0/RPMS/x86_64/
Master :IP 192.168.1.100 网关 192.168.1.254
Worker1:IP 192.168.1.101 网关 192.168.1.254
Worker2:IP 192.168.1.102 网关 192.168.1.254
Worker3:IP 192.168.1.103 网关 192.168.1.254
Worker4:IP 192.168.1.104 网关 192.168.1.254
修改系统的网络配置文件
vim /etc/sysconfig/network
例如:修改HOSTNAME=Master
各个节点的主机名配置如下
192.168.1.100 主机名: Master
192.168.1.101 主机名: Worker1
192.168.1.102 主机名: Worker2
192.168.1.103 主机名: Worker3
192.168.1.104 主机名: Worker4
(注:此处集群的各个节点的主机名字就是用安装系统时的设置的主机名,所以我就不用修改了)
绑定IP地址与HostName
vim /etc/hosts
192.168.1.100 Master
192.168.1.101 Worker1
192.168.1.102 Worker2
192.168.1.103 Worker3
192.168.1.104 Worker4
service iptables status
chkconfig iptables off //永远关闭-重启后生效
service iptables off //临时关闭-不用重启
系统重启后,查看防火墙状态如下
使用getenforce查看是否关闭:
显示的是在强制执行,接下来我们需要关掉它
修改/etc/selinux/config 文件,将SELINUX=enforcing改为SELINUX=disabled,修改完成后重启机器生效。
(将SELINUX=enforcing改为disabled)
reboot -h now
重启之后,查看是否生效
已经生效,注意每个节点都要关闭SElinux哟
vim /etc/ssh/sshd_config
去掉注释,放开这几个配置项
重启sshd服务
service sshd restart
ssh-keygen -t rsa
Master:
Worker1:
Worker2:
Worker3:
Worker4:
cp id_rsa.pub authorized_keys_Master
cp id_rsa.pub authorized_keys_Worker1
cp id_rsa.pub authorized_keys_Worker2
cp id_rsa.pub authorized_keys_Worker3
cp id_rsa.pub authorized_keys_Worker4
scp authorized_keys_Worker1 hjr@Master:/home/hjr/.ssh
scp authorized_keys_Worker2 hjr@Master:/home/hjr/.ssh
scp authorized_keys_Worker3 hjr@Master:/home/hjr/.ssh
scp authorized_keys_Worker4 hjr@Master:/home/hjr/.ssh
最后在Master的.ssh目录下面查看以下:
cat authorized_keys_Master >> authorized_keys
cat authorized_keys_Worker1 >> authorized_keys
cat authorized_keys_Worker2 >> authorized_keys
cat authorized_keys_Worker3 >> authorized_keys
cat authorized_keys_Worker4 >> authorized_keys
查看一下authorized_keys文件内容:
scp authorized_keys hjr@Worker1:/home/hjr/.ssh
scp authorized_keys hjr@Worker2:/home/hjr/.ssh
scp authorized_keys hjr@Worker3:/home/hjr/.ssh
scp authorized_keys hjr@Worker4:/home/hjr/.ssh
设置.ssh目录权限 : chmod 700 -R .ssh
(这样Master和各个Worker之间就能够相互通信了—Master可以通过ssh连接到Worker1,Worker2,Worker3,Worker4; Worker1,Worker2,Worker3,Worker4可以通过ssh连接到Master)
rpm -ivh MySQL-server-5.6.34-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.34-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-client-5.6.34-1.linux_glibc2.5.x86_64.rpm
修改配置文件位置
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
/usr/bin/mysql_install_db
service mysql start
cat /root/.mysql_secret #查看root账号密码
mysql -uroot -pawSDoqAX24LERoPA
SET PASSWORD = PASSWORD('124077'); #设置密码为124077
use mysql;
select host,user,password from user;
update user set password=password('124077') where user='root';
update user set host='%' where user='root' and host='localhost';
flush privileges;
exit
chkconfig mysql on
chkconfig --list | grep mysql
/var/lib/mysql/ #数据库目录
/usr/share/mysql #配置文件目录
/usr/bin #相关命令目录
/etc/init.d/mysql #启动脚本
配置/etc/my.cnf文件,修改数据存放路径、mysql.sock路径以及默认编码utf-8.
查看字符集
show variables like '%collation%';
show variables like '%char%';
java –version
rpm –qa | grep java
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
rpm -e --nodeps tzdata-java-2013g-1.el6.noarch
Master节点操作如下:
rpm -ivh oracle-j2sdk1.7-1.7.0+update67-1.x86_64.rpm
rpm -ivh cloudera-manager-daemons-5.9.0-1.cm590.p0.249.el6.x86_64.rpm
rpm -ivh cloudera-manager-server-5.9.0-1.cm590.p0.249.el6.x86_64.rpm
rpm -ivh cloudera-manager-server-db-2-5.9.0-1.cm590.p0.249.el6.x86_64.rpm
rpm -ivh cloudera-manager-daemons-5.9.0-1.cm590.p0.249.el6.x86_64.rpm
rpm -ivh cloudera-manager-agent-5.9.0-1.cm590.p0.249.el6.x86_64.rpm
这边会有几个依赖找不到,需要联网,通过yum下载安装:
warning: cloudera-manager-agent-5.9.0-1.cm590.p0.249.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID e8f86acd: NOKEY
error: Failed dependencies:
mod_ssl is needed by cloudera-manager-agent-5.9.0-1.cm590.p0.249.el6.x86_64
openssl-devel is needed by cloudera-manager-agent-5.9.0-1.cm590.p0.249.el6.x86_64
python-psycopg2 is needed by cloudera-manager-agent-5.9.0-1.cm590.p0.249.el6.x86_64
MySQL-python is needed by cloudera-manager-agent-5.9.0-1.cm590.p0.249.el6.x86_64
依次安装如下:
yum install MySQL-python
yum install python-psycopg2
yum install openssl-devel
yum install mod_ssl
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
这里需要网络哟
浏览器运行192.168.1.100:7180打开CM的web界面如下,默认的用户名和密码都是admin
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
集群正常运行界面
几个主要服务如下: