Ambari搭建Hadoop,Spark,Storm的基础环境安装

1.最近想整理点大数据知识,使用ambari工具搭建hadoop,将来再搭建spark,storm其他组件。

环境列表,四台centos7
/etc/hosts的配置:
172.16.192.130 hadoop1
172.16.192.129 hadoop2
172.16.192.131 hadoop3
172.16.192.132 ambari-server

ambari-server向hadoop1,hadoop2,hadoop3搭建hadoop节点

2.Ambari-server免密登录hadoop1,hadoop2,hadoop3配置

在ambari-server节点生成密钥,和免密命令

(1)ssh-keygen
(2)ssh-copy-id hadoop1
(3)ssh-copy-id hadoop2
(4)ssh-copy-id hadoop3

同理,hadoop1,hadoop2,hadoop3也要无密码能登录ambari-server

  1. 安装ambari私有源,

(1)下载ambari源
wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0/ambari.repo

(2)拷贝ambari.repo /etc /yum/repos.d

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

(3)清除现有源和查看源
yum clean all
yum list | grep ambari
(4)安装ambari

《Ambari搭建Hadoop,Spark,Storm的基础环境安装》 image.png

(4) 安装ambari-server

sudo yum install ambari-server

下载jdk,设置数据库,我使用的mariadb,需要拷贝jar到/usr/share/java

(5) 安装mariadb

sudo yum install mariadb-server mariadb-client

创建数据库:ambari,并创立权限

grant all privileges on
. to ambari@’%’ identified by ‘bigdata’ with grant option;

grant all privileges on
. to ambari@’ambari-server’ identified by ‘bigdata’ with grant option;

flush privileges;

(6)安装成功,设置ambari:

sudo ambari-server setup

说明,一律采用默认配置

【1】数据库类型mysql:mariadb 用户名 ambari 密码(默认)bigdata

[botter@ambari-server ~]$ sudo ambari-server setup
[sudo] password for botter:
Using python /usr/bin/python
Setup ambari-server
Checking SELinux…
SELinux status is ‘enabled’
SELinux mode is ‘permissive’
WARNING: SELinux is set to ‘permissive’ mode and temporarily disabled.
OK to continue [y/n] (y)? y
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (botter):
Adjusting ambari-server permissions and ownership…
Checking firewall status…
WARNING: iptables is running. Confirm the necessary Ambari ports are accessible. Refer to the Ambari documentation for more details on ports.
OK to continue [y/n] (y)? y
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): 1
JDK already exists, using /var/lib/ambari-server/resources/jdk-8u77-linux-x64.tar.gz
Installing JDK to /usr/jdk64/
Successfully installed JDK to /usr/jdk64/
JCE Policy archive already exists, using /var/lib/ambari-server/resources/jce_policy-8.zip
Installing JCE policy…
Completing setup…
Configuring database…
Enter advanced database configuration [y/n] (n)? y
Configuring 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): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):
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.sql
Proceed with configuring remote database connection properties [y/n] (y)? y
Extracting system views…
ambari-admin-2.4.2.0.136.jar
…………
Adjusting ambari-server permissions and ownership…
Ambari Server ‘setup’ completed successfully.

【2】遇到的坑

连接不上数据库:,找到ambari-server的配置目录,修改去。
[botter@ambari-server tools]$ whereis ambari-server
ambari-server: /usr/sbin/ambari-server.py /usr/sbin/ambari-server /usr/lib/ambari-server /etc/ambari-server

(1)修改mysql 连接配置:/etc/ambari-server/conf/ambari.properties,搜索mysql关键字,修改mysql的连接url
(2)导入sql,sql的路径:/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

[root@ambari-server ambari-server]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 440
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> create database ambari;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> use ambari;
Database changed
MariaDB [ambari]> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

配置和启动完成的标志:端口是8080

Make sure that you include only one mysql-connector-java.jar in the java class path ‘/etc/ambari-server/conf:/usr/lib/ambari-server/*:/usr/share/java/mysql-connector-java.jar’.
Ambari database consistency check started…
No errors were found.
Ambari database consistency check finished
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start………………..
Ambari Server ‘start’ completed successfully.

平台登录:http://localhost:8080/ 默认用户和密码均是admin

《Ambari搭建Hadoop,Spark,Storm的基础环境安装》 image.png

    原文作者:老生住长亭
    原文地址: https://www.jianshu.com/p/e317a58390e4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞