版本;
Linux: CentOS6.6
临时节点规划:
一、五台虚拟机的搭建
参考:https://blog.csdn.net/qq_36269293/article/details/79854531
主要是第一台linux的搭建,克隆之后:
修改主机名:
修改IP地址:
验证是否能够联网等问题
二、集群环境的搭建
五台机器搭建完成之后,现在搭建集群,搭建之前要安装一些组件:
1. 安装组件
yum –y install httpd
yum –y install ntp
yum -y install yum-utils
yum -y install wget
yum -y install createrepo
yum -y install openssl
yum -y install ruby*
yum -y install redhat-lsb*
yum -y install snappy*
2.重启组件
设置开机自启动:
chkconfig ntpd on
chkconfig httpd on
重启组件
service ntpd restart
service httpd restart
查看时间是否一致
date
不一致的话重启即可:
reboot
3.安装JDK,配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/apps/java/jdk1.8.0_60
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$PATH
刷新:
source /etc/profile
验证:
java -version
4.修改selinx和禁用THP
vi /etc/selinux/config
修改成: SELINUX=disabled
vi /etc/rc.d/rc.local
添加:
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
重启:
reboot
验证:
cat /sys/kernel/mm/transparent_hugepage/defrag
cat /sys/kernel/mm/transparent_hugepage/enabled
5.安装Mysql
解压
tar -xvf MySQL-5.6.26-1.linux_glibc2.5.x86_64.rpm-bundle.tar -C /usr/local/apps/mysql/
查看系统自带mysql
rpm -qa | grep mysql
删除系统自带mysql
rpm -e mysql-libs-5.1.73-3.el6_5.x86_64 --nodeps
安装服务端
rpm -ivh MySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm
安装客户端
rpm -ivh MySQL-client-5.6.26-1.linux_glibc2.5.x86_64.rpm
启动mysql
service mysql start
查看临时密码
cat /root/.mysql_secret
修改密码
/usr/bin/mysql_secure_installation
6.登录Mysql,创建数据库以及用户
mysql -uroot -pgygh123
创建数据库
create database gygh character set utf8;
create database ambari character set utf8;
create database hive character set utf8;
create database oozie character set utf8;
创建用户
CREATE USER "gygh"@"%"IDENTIFIED BY "gygh123";
CREATE USER "ambari"@"%"IDENTIFIED BY "ambari123";
CREATE USER "hive"@"%"IDENTIFIED BY "hive123";
CREATE USER "oozie"@"%"IDENTIFIED BY "oozie123";
赋权限
grant all privileges on *.* to 'gygh'@'%' identified by 'gygh123' with grant option;
grant all privileges on *.* to 'ambari'@'%' identified by 'ambari123' with grant option;
grant all privileges on *.* to 'hive'@'%' identified by 'hive123' with grant option;
grant all privileges on *.* to 'oozie'@'%' identified by 'oozie123' with grant option;
刷新
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
7.安装Ambari
创建文件夹
mkdir -p /var/www/html/ambari
mkdir -p /var/www/html/hdp
mkdir -p /var/www/html/hdp/HDP-UTILS-1.1.0.21
解压Ambari到文件夹
cd /usr/local/apps/bakDIR
tar -zvxf ambari-2.4.1.0-centos6.tar.gz -C /var/www/html/ambari/
tar -zvxf HDP-2.5.0.0-centos6-rpm.tar.gz -C /var/www/html/hdp/
tar -zvxf HDP-UTILS-1.1.0.21-centos6.tar.gz -C /var/www/html/hdp/HDP-UTILS-1.1.0.21
清空yum
yum clean all
配置yum源
cd /etc/yum.repos.d/
wget –nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.1.0/ambari.repo -O/etc/yum.repos.d/ambari.repo
wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.0.0/hdp.repo -O /etc/yum.repos.d/hdp.repo
vi ambari.repo
#VERSION_NUMBER=2.4.1.0-22
[Updates-ambari-2.4.1.0]
name=ambari-2.4.1.0 - Updates
baseurl=http://node06/ambari/AMBARI-2.4.1.0/centos6/
gpgcheck=1
gpgkey=http://node06/ambari/AMBARI-2.4.1.0/centos6/2.4.1.0-22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
vi hdp.repo
#VERSION_NUMBER=2.5.0.0-1245
[HDP-2.5.0.0]
name=HDP Version - HDP-2.5.0.0
baseurl=http://node06/hdp/HDP/centos6/
gpgcheck=1
gpgkey=http://node06/hdp/HDP/centos6/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.21]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.21
baseurl=http://node06/hdp/HDP-UTILS-1.1.0.21/
gpgcheck=1
gpgkey=http://node06/hdp/HDP-UTILS-1.1.0.21/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
createrepo
createrepo /var/www/html/hdp/HDP/centos6/
createrepo /var/www/html/hdp/HDP-UTILS-1.1.0.21/
createrepo /var/www/html/ambari/AMBARI-2.4.1.0/centos6/
yum makecache
yum repolist
浏览器端:http://node06/ambari/ (windows端配置ip地址映射的前提下,没有配置需要把node06换成ip地址)
http://node06/hdp/
查看是否有文件存在
安装ambari:
yum -y install ambari-server
ambari-server setup(根据提示一步步安装)
echo $JAVA_HOME
创建 /usr/share/java
将 mysql-connector-java-5.1.17.jar 复制到该文件夹下
创建软链接 ln -s mysql-connector-java-5.1.17.jar mysql-connector-java.jar
备注:如果启动出现缺失驱动问题,可以执行以下操作:
yum install mysql-connector-java 或者将驱动包放在/usr/share/java 下加载驱动进 ambari 的设置中
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java-5.1.17.jar 登录mysql:
执行以下操作:
use ambari
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
安装完成之后启动:
ambari-server start
在浏览器端访问:http://node06:8080/
剩下的就是安装各种组件了。
******************************************************************************************************************************
node01
node02
node03
node04
node05
node06
python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=node01
python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=node02
python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=node03
python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=node04
python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=node05
hive启动命令;
beeline> !connect jdbc:hive2://node04:10000
/usr/hdp/2.5.0.0-1245/hive/bin/beeline -u jdbc:hive2://node06:10000 -n root