千家信息网

Amabari怎样搭建Hadoop集群

发表于:2024-11-19 作者:千家信息网编辑
千家信息网最后更新 2024年11月19日,这篇文章给大家分享的是有关Amabari怎样搭建Hadoop集群的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。一、系统环境1.系统版本[root@manager ~]# c
千家信息网最后更新 2024年11月19日Amabari怎样搭建Hadoop集群

这篇文章给大家分享的是有关Amabari怎样搭建Hadoop集群的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

一、系统环境

1.系统版本

[root@manager ~]# cat /etc/centos-releaseCentOS Linux release 7.4.1708 (Core)

2.主机规划

主机名IP地址角色
manager192.168.10.131
ambari-server
vm1
192.168.10.128agent
vm2192.168.10.129agent
vm3192.168.10.130agent

3.软件版本

ambari-2.4.3.0-centos7.tar.gzHDP-2.5.3.0-centos7-rpm.tar.gzHDP-UTILS-1.1.0.21-centos7.tar.gz

二、环境准备(所有节点上都要配置)

1.修改主机名

2.防火墙和selinux

[root@manager ~]# systemctl status firewalld● firewalld.service - firewalld - dynamic firewall daemon   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)   Active: inactive (dead)     Docs: man:firewalld(1)[root@manager ~]# getenforce Disabled[root@manager ~]#

3.配置hosts文件

[root@manager ~]# cat /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.10.128 vm1192.168.10.129 vm2192.168.10.130 vm3192.168.10.131 manager

4.配置SSH免密码登陆

5.关闭linux的THP服务

#在GRUB_CMDLINE_LINUX这一行后面添加transparent_hugepage=never,如下[root@manager ~]# cat /etc/default/grub GRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"GRUB_DISABLE_RECOVERY="true"#执行以下命令[root@manager ~]# grub2-mkconfig -o /boot/grub2/grub.cfg[root@manager ~]# systemctl disable tuned#重启后显示如下[root@manager ~]# cat /sys/kernel/mm/transparent_hugepage/enabledalways madvise [never][root@manager ~]# grep AnonHugePages /proc/meminfo  AnonHugePages:         0 kB[root@manager ~]#

6.配置UMASK

[root@manager ~]# umask 0022[root@manager ~]# umask0022

7.配置时间同步NTP

[root@manager ~]# yum -y install ntp[root@manager ~]# systemctl start ntpd[root@manager ~]# systemctl enable ntpd

8.安装JDK并配置JAVA_HOME环境变量

三、安装Ambari集群(只在manager上配置)

1.安装HTTP服务

[root@manager ~]# yum install -y httpd[root@manager ~]# systemctl start httpd[root@manager ~]# systemctl enable httpd

2.安装MySQL

3.配置MySQL

#mysql有密码复杂度要求,如果不需要密码策略在/etc/my.cnf文件中添加如下配置并重启mysql即可禁用validate_password = offsystemctl restart mysqld#查看mysql的初始默认密码[root@manager ~]# cat /var/log/mysqld.log | grep password2017-12-13T01:49:55.629403Z 1 [Note] A temporary password is generated for root@localhost: 3aYp&Zsqq7Ov#使用初始密码进入mysql修改密码ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';#在mysql中创建ambari数据库及用户CREATE DATABASE ambari CHARACTER SET utf8 ;  CREATE USER 'ambari'@'%'IDENTIFIED BY '123456';CREATE USER 'ambari'@'local'IDENTIFIED BY '123456';GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';FLUSH PRIVILEGES;#创建hive和其它数据库也类似

4.下载Ambari和HDP

wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.3.0/ambari-2.4.3.0-centos7.tar.gzwget -nv http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0/HDP-2.5.3.0-centos7-rpm.tar.gzwget -nv http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz

5.解压至httpd目录下

[root@manager ~]# mkdir /var/www/html/ambari [root@manager ~]# mkdir /var/www/html/ambari/HDP-UTILStar zxvf ambari-2.4.3.0-centos7.tar.gz -C /var/www/html/ambaritar zxvf HDP-2.5.3.0-centos7-rpm.tar.gz -C /var/www/html/ambaritar zxvf HDP-UTILS-1.1.0.21-centos7.tar.gz -C /var/www/html/ambari/HDP-UTILS

6.安装本地源制作相关工具

[root@manager ~]# yum install -y yum-utils createrepo yum-plugin-priorities[root@manager ~]# vim /etc/yum/pluginconf.d/priorities.conf [main]enabled = 1gpgcheck=0[root@manager data]# cd /var/www/html/ambari[root@manager ambari]# createrepo  ./

7.配置本地源

[root@manager ~]# cat /etc/yum.repos.d/ambari.repo [ambari-2.4.3.0]name=ambari-2.4.3.0baseurl=http://manager/ambari/ambari/centos7/gpgcheck=1gpgkey=http://manager/ambari/ambari/centos7/RPM-GPG-KEY/RPM-GPG-KEY-Jenkinsenabled=1priority=1[root@manager ~]# cat /etc/yum.repos.d/hdp.repo [HDP-2.5.3.0]name=HDPbaseurl=http://manager/ambari/HDP/centos7/gpgcheck=1gpgkey=http://manager/ambari/HDP/centos7/RPM-GPG-KEY/RPM-GPG-KEY-Jenkinsenabled=1priority=1[HDP-UTILS-1.1.0.21]name=HDP-UTILSbaseurl=http://manager/ambari/HDP-UTILS/gpgcheck=1gpgkey=http://manager/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkinsenabled=1priority=1
[root@manager ~]# yum clean all[root@manager ~]# yum makecache#查看ambari和hdp的资源库[root@manager ~]# yum repolistrepo id                                                          repo name                                                  statusHDP-2.5.3.0                                                      HDP                                                             200HDP-UTILS-1.1.0.21                                               HDP-UTILS                                                        64ambari-2.4.3.0                                                   ambari-2.4.3.0

8.安装ambari和mysql驱动

[root@manager ~]# yum install -y ambari-server[root@manager ~]# yum install -y mysql-connector-java

9.配置ambari

[root@manager ~]# ambari-server setupUsing python  /usr/bin/pythonSetup ambari-serverChecking SELinux...SELinux status is 'disabled'Customize user account for ambari-server daemon [y/n] (n)? yEnter user account for ambari-server daemon (root):rootAdjusting ambari-server permissions and ownership...Checking firewall status...Checking JDK...Do you want to change Oracle JDK [y/n] (n)? y[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7[3] Custom JDK==============================================================================Enter choice (1): 3WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.Path to JAVA_HOME: /usr/local/jdkValidating JDK on Ambari Server...done.Completing setup...Configuring database...Enter advanced database configuration [y/n] (n)? yConfiguring database...==============================================================================Choose one of the following options:[1] - PostgreSQL (Embedded)[2] - Oracle[3] - MySQL / MariaDB[4] - PostgreSQL[5] - Microsoft SQL Server (Tech Preview)[6] - SQL Anywhere[7] - BDB==============================================================================Enter choice (3): 3Hostname (localhost):    Port (3306): Database name (ambari): Username (ambari): Enter Database Password (123456): Configuring ambari database...Copying JDBC drivers to server resources...Configuring remote database connection properties...WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sqlProceed with configuring remote database connection properties [y/n] (y)? y   Extracting system views................Adjusting ambari-server permissions and ownership...Ambari Server 'setup' completed successfully.

10.使用msyql用户ambari在ambari数据库中导入数据

[root@manager ~]# mysql -u ambari -p123456mysql> use ambariDatabase changedmysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

11.启动ambari

[root@manager ~]# ambari-server start#在浏览器中输入ambari地址http://192.168.10.131:8080

感谢各位的阅读!关于"Amabari怎样搭建Hadoop集群"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

0