ambariHDP部署总结

来源:互联网 发布:大数据市场规模2016 编辑:程序博客网 时间:2024/06/04 19:25

 

1.环境要求

1.1系统要求:

支持64为操作系统,版本如下:

Red Hat Enterprise Linux (RHEL) v7.x

Red Hat Enterprise Linux (RHEL) v6.x

CentOS v7.x

CentOS v6.x

Debian v7.x

Oracle Linux v7.x

Oracle Linux v6.x

SUSE Linux Enterprise Server (SLES) v11 SP4(HDP 2.2 and later)

SUSE Linux Enterprise Server (SLES) v11 SP3

SUSE Linux Enterprise Server (SLES) v11 SP1(HDP 2.2 and HDP 2.1)

Ubuntu Precise v12.04

Ubuntu Trusty v14.04

本文使用CentOS release 6.4 (Final)进行安装。

1.2 硬件要求

安装ambari至少需要1G内存

1.3 文件描述符

检查文件描述符的最大值

ulimit -Sn

ulimit -Hn

如果文件描述符的最大值小于10000,则设置为10000

ulimit -n 10000

1.4 修改/etc/hosts

1、修改管理节点,添加集群节点的ip与hostname映射

比如添加映射 :

192.168.6.1  data1  

192.168.6.2  data2

2、复制hosts到所有节点:

for i in `cat /etc/hosts | awk '{print $1}'`; do scp-r /etc/hosts root@$i:/etc/; done

1.5 ssh免密码登录

1、生成ssh安全密钥:

ssh-keygen -t rsa

2、复制id_rsa.pub到每个集群节点:

for i in `cat /etc/hosts | awk'{print $1}'`; do ssh-copy-id .ssh/id_rsa.pub root@$i;done

1.6 设置ntp时间同步

【ntp怎么安装怎么配置,随便百度下即可】

vim /etc/ntp.conf

复制ntp.conf 到所有节点:

for i in `cat /etc/hosts |awk '{print $1}'`; do scp -r /etc/ntp.conf root@$i:/etc/; done

重启ntp服务

/etc/init.d/ntpd  restart

设置开机自启动

chkconfig  ntpd on


1.7  关闭防火墙

/etc/init.d/iptables stop

chkconfig iptables off

1.8 设置selinux

vim /etc/selinux/config:

    SELINUX=disabled  

2  制作离线安装源

2.1 挂载本地镜像文件

1、  挂载ah_toolbars下的CentOS-6.4-x86_64-bin-DVD1.iso

ah_toolbars里面已经放好了所需要的文件和包,在最后一节里列了】

mkdir   /mnt/redhat

cd   /opt/ah_toolbars/

mount -t iso9660 -o loopCentOS-6.4-x86_64-bin-DVD1.iso /mnt/redhat/

2、将local.repo复制到/etc/yum.repos.d/下

断绝联网安装:

mkdir  /etc/yum.repos.d/bak

mv  /etc/yum.repos.d/CentOS-*  /etc/yum.repos.d/bak/

yum  groupinstall "Development tools"  -y

yum install readline-devel pcre-devel openssl-develgcc -y

2.2 搭建局域网安装源

mkdir /var/www/html/repo

mount -t iso9660 -o loopCentOS-6.4-x86_64-bin-DVD1.iso /var/www/html/repo

将lan.repo复制到/etc/yum.repos.d/下

修改对应的ip和端口:

     Baseurl=http://192.168.6.1:8800/repo

2.3搭建内网web服务器

1、安装nginx

解压

tar -zxvf  ah_toolbars/openresty-1.9.7.4.tar.gz

安装

cd  openresty-1.9.7.4

./configure  --prefix=/opt/openresty

make && makeinstall

ln  -s /opt/openresty/nginx/sbin/nginx /usr/sbin/

测试是否安装成功

nginx  -t

如果看到一下信息,则安装成功“

nginx: the configuration file /opt/openresty/nginx/conf/nginx.confsyntax is ok

nginx: configuration file /opt/openresty/nginx/conf/nginx.conf testis successful

修改nginx配置

mkdir  $nginx/{avaliable,enable}_conf

cp  /opt/toorbars/cst.conf  $nginx/available_conf

vim cst.conf  ##cst.conf 你自己起的名

server {

    listen8800;  # 监听端口

   server_name 192.168.6.1; #虚拟主机名

   access_log logs/file-resource.log;

 

    location /{

        root/var/www/html/;  # 发布目录

        indexindex.html;

        #开启目录浏览功能

       autoindex on;

        #显示出文件的大概大小,单位是kB或者MB或者GB

       autoindex_exact_size off;

        #显示的文件时间为文件的服务器时间

       autoindex_localtime on;

    }

}

ln  -s $nginx/available_conf/cst.conf  /opt/toorbars/enable_conf/

vim $nginx/cong/nginx.conf

#user  nobody;

worker_processes  8; # 系统线程数

#error_log logs/error.log;

#error_log logs/error.log  notice;

#error_log logs/error.log  info;

#pid        logs/nginx.pid;

events {

    use  epoll;

   worker_connections  1024;

}

http {

   include       mime.types;

   default_type application/octet-stream;

   #access_log  logs/access.log  main;

   sendfile        on;

   #keepalive_timeout  0;

   keepalive_timeout  65;

    #gzip  on;

    include  ../enable_conf/cstor.conf;

}

注:查看linux系统线程数:

grep 'processor' /proc/cpuinfo | wc -l

启动nginx

nginx

如果改动了配置文件,可以平滑重启nginx

nginx -s  reload

 

2、改用httpd

安装nginx感觉好麻烦,改用httpd

yum install httpd

service httpd start

chkconfig httpd on

3 离线安装ambari

3.1添加离线安装源

cd /var/www/html/

解压  tar -zxvf  /opt/ah_toolbars/ambari-2.2.1.1-centos6.tar.gz-C /var/www/html/

mkdir /var/www/html/hdp

tar -zxvf /opt/ah_toolbars/HDP-2.4.0.0-centos6-rpm.tar.gz  -C /var/www/html/hdp/

tar -zxvf  /opt/ah_toolbars/HDP-UTILS-1.1.0.20-centos6.tar.gz  -C /var/www/html/hdp/

添加ambari和hdp的repo文件到安装源

cp  /opt/ah_toolbars/ambari.repo /etc/yum.repos.d/

修改ambari.repo的ip地址和端口为实际ip和端口:

     Baseurl对应的ip就是你在上面搭建内网服务器的ip

检测repo list

yum repolist

安装ambariserver

yum  install  ambari-server -y

设置ambari  server

ambari-server  setup

按照提示,一步一步操作;

安装mysql

修改mysql密码:

mysql>set password=password('123456');

myql -uroot  -p123456

CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari';

GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';

CREATE USER 'ambari'@'datacube152' IDENTIFIED BY'ambari';

GRANT ALL PRIVILEGES ON *.* TO'ambari'@'datacube152';

CREATE USER 'ambari'@'ambari' IDENTIFIED BY 'ambari';

GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'ambari';

FLUSH PRIVILEGES;

CREATE DATABASE ambari;

USE ambari;

SOURCE /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;

启动ambari  server

ambari-server start

在浏览器登录ambari:

http://192.168.6.152:8080/

默认用户名/密码: admin/admin

看到下面页面,即说明安装成功:


3.2 离线安装HDP

安装hdp集群:

按照提示下一步下一步即可。


4.文件包列表 ah_toolbars

CentOS 6.4 系统镜像 (CentOS-6.4-x86_64-bin-DVD1.iso);

local.repo;

lan.repo;

ambari离线安装包(ambari-2.2.1.1-centos6.tar.gz);

ambari.repo;

HDP离线安装文件(HDP-2.4.0.0-centos6-rpm.tar.gz,  HDP-UTILS-1.1.0.20-centos6.tar.gz);

hdp.repo;

nginx安装包(openresty-1.9.7.4.tar.gz);