大数据平台系列:使用ambari安装hadoop(一)

                                                     

                                                       

1 前言   

   Apache Ambari是一种基于Web的工具,支持Apache Hadoop集群的供应、管理和监控。ambari项目的出现使得hadoop系列的组件可以在webUI中定制安装,并提供管理功能。

   本文转自公众号:天目星    ,请大家多多关注。链接:前往天目星


一、使用的软件版本与架构图

    linux:CentOS 7.5.1804

    ambari:ambari-2.7.3

    java:jdk-8u201-linux-x64.rpm

前提:已经配置好hosts文件、ntp服务、并安装相应的依赖包

使用三台主机搭建测试环境,角色如下

角色 ambari mysql other
node1
node2 × ×
node3 × ×

二、安装

三台主机配置好hosts文件,并配置ssh免密登录

三台主机都需要配置,并拷贝密匙到其他两台主机$ ssh-keygen$ ssh-copy-id $hostname

需要安装JDK,本例使用了RPM包安装

$ rpm -ivh jdk-8u201-linux-x64.rpm$ java -versionjava version "1.8.0_201"Java(TM) SE Runtime Environment (build 1.8.0_201-b09)Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

本例使用的数据库是mariadb来存储ambri的数据

$ vim /etc/yum.repos.d/mariadb.repo#[mariadb]name=MariaDBbaseurl=http://yum.mariadb.org/10.2/centos7-amd64gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=1#在node1中安装$ yum install MariaDB-server$ systemctl enable mariadb.service
安装mysql to java连接器$ yum install mysql-connector-java
新建ambari的账号用于读写数据库$ mysql -uroot -pMariaDB [(none)]> CREATE USER 'ambari'@'%' IDENTIFIED BY '123456';Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL ON *.* TO 'ambari'@'%';Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;Query OK, 0 rows affected (0.00 sec)

ambari建议的最大打开文件描述符数为10000或更多

修改打开文件描述符$ echo "* hard nofile 65535" >>/etc/security/limits.conf$ echo "* soft nofile 65535" >>/etc/security/limits.conf
重启生效或使用以下命令临时生效$ ulimit -n 6553

ambari可以使用公共存储库来安装也可以使用本地存储库来安装

PS:对于无法上网的用户,可以提前下载好所有文件并搭建本地库

安装yum套件$ yum install -y yum-utils
添加ambari的公共库yum-config-manager --add-repo \  http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.3.0/ambari.repo

使用yum源安装ambari

$ yum repolist$ yum install ambari-server

三、配置

使用ambari设置服务器

$ ambari-server setup
1.如果您尚未暂时禁用SELinux,则可能会收到警告。接受默认值(y)Using python  /usr/bin/pythonSetup ambari-serverChecking SELinux...SELinux status is 'disabled'Customize user account for ambari-server daemon [y/n] (n)? y
2.默认使用root权限运行ambari-serverEnter user account for ambari-server daemon (root):
3.设置JDK,我们选择本机已经安装好的,选2,并设置jdk路径Checking JDK...[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8[2] Custom JDK==============================================================================Enter choice (1): 2WARNING: 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/java/latest
4.使用LZO安装的话需要启用GPL授权,默认为不启用Checking GPL software agreement...GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.htmlEnable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? n
5.自定义数据库配置,选择y来定制Completing setup...Configuring database...Enter advanced database configuration [y/n] (n)? y
6.我们使用mysql数据库,选择3Choose 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 (1): 3Hostname (localhost): c7-hadoop1Port (3306):Database name (ambari):Username (ambari): rootEnter Database Password (bigdata): 输入你设置好的密码Re-enter password: 验证你输入的密码Configuring ambari database...Should ambari use existing default jdbc /usr/share/java/mysql-connector-java.jar [y/n] (y)?
7.注意,弹出以下提示需新建好数据库并导入sql语句,再点击回车Configuring remote database connection properties...WARNING: Before starting Ambari Server, you must run the following DDL directly from the database shell to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sqlProceed with configuring remote database connection properties [y/n] (y)?
点击确认前先在数据库中完成以下操作MariaDB [(none)]> CREATE DATABASE ambari;Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> use ambariDatabase changedMariaDB [ambari]> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sqlQuery OK, 0 rows affected (0.00 sec)          ...省略...Query OK, 56 rows affected (0.01 sec)
8.完成以上配置后安装完毕并显示以下信息Extracting system views........Ambari repo file contains latest json url http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json, updating stacks repoinfos with it...Adjusting ambari-server permissions and ownership...Ambari Server 'setup' completed successfully.

篇幅有限,下期将讲解ambari Web UI的使用

未完待续。。。

                                                                              

请关注公众号:天目星

猜你喜欢

转载自blog.csdn.net/Gordon_luo/article/details/92761039