版本:jdk-8u45-linux-x64.rpm
mysql环境:
rpm包:
jdbc链接包:Java-5.1.40.tar.gz
CDH安装相关的包:
cloudera manager包:
CDH包:
集群规划
IP地址 主机名说明
192.168.50.123Hadoop1主节点master,datanode
192.168.50.124hadoop2datanode
192.168.50.125hadoop3 datanode
开始安装前配置
1.安装jdk(每个机器都要装)
安装前要先卸载掉原有的jdk版本,避免造成冲突
2.修改三个机器上面的hosts
192.168.50.123 hadoop1
192.168.50.124 hadoop2
192.168.50.125 hadoop3
3.同步时间
ntpdate -s pool.ntp.org
4.关闭防火墙和selinux
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config #重启机器
systemctl stop firewalld
systemctl disable firewalld
5.配置ssh无密码登陆
[root@localhost ~]# ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
62:b0:4c:aa:e5:37:92:89:4d:db:c3:38:e2:f1:2a:d6 root@admin-node
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| o |
| + o |
| + o o S |
| B B . . |
|+.@ * |
|oooE o |
|oo.. |
+-----------------+
ssh-copy-id hadoop1
ssh-copy-id hadoop2
ssh-copy-id hadoop3
6.安装mysql
[root@hadoop1]#tar -xvf MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar
[root@hadoop1]#rpm -ivh MySQL-*.rpm
修改配置文件路径:cp /usr/share/mysql/my-default.cnf /etc/my.cnf
#配置mysql
[root@hadoop1]#vim /etc/my.cnf
[mysqld]
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
#初始化数据库
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql >>/dev/null
#启动mysql
service mysqld start
chkconfig mysqld on
- 查看mysql root初始化密码
[root@hadoop1]# cat /root/.mysql_secret
# The random password set for the root user at Fri Sep 16 11:13:25 2016 (local time): 9mp7uYFmgt6drdq3
- 登录进行去更改密码
[root@hadoop1]# mysql -u root -p
mysql> SET PASSWORD=PASSWORD('123456');
- 允许mysql远程访问
mysql> grant all on *.* to root@"%" Identified by "www.123";
Query OK, 1 row affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
创建cdh所需要的库
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
7.第三方依赖包安装(所有节点都安装)
1 yum install chkconfig Python bind-utils psmisc libxslt zlib sqlite fuse fuse-libs RedHat-lsb cyrus-sasl-plain cyrus-sasl-gssapi
注意这个地方依赖包不安装完下面启动集群的时候会死活启动不了的,这是血的教训啊!
在hadoop1上准备mysql的jar包
[root@hadoop1]# mkdir -p /usr/share/java
修改jar包的名字,并拷贝到/usr/share/java/目录
[root@hadoop1]# cp mysql-connector-java-5.1.40-bin.jar /usr/share/java/mysql-connector-java.jar
8.安装Cloudera-Manager
解压cm包到指定目录,所有服务器都要做
[root@hadoop1 ~]#mkdir /opt/cloudera-manager
[root@hadoop1 ~]# tar -axvf cloudera-manager-centos7-cm5.8.3_x86_64.tar.gz -C /opt/cloudera-manager
创建cloudera-scm用户(所有节点)
[root@hadoop1 ~]# useradd -r -d /opt/cloudera-manager/cm-5.8.3/run/cloudera-scm-server -M -c "Cloudera SCM User" cloudera-scm
在hadoop2和hadoop3配置agent
vim /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-agent/config.ini
将server_host改为CMS所在的主机名即hadoop1
主节点中创建parcel-repo仓库