zoukankan      html  css  js  c++  java
  • ambari

    参考博客: https://www.unixhot.com/article/46

    使用ambari 快速部署hadoop 集群

    Ambari是 Apache Software Foundation 中的一个顶级项目。Ambari可以创建、管理、监控 Hadoop 的集群。包括整个Hadoop生态圈(例如 Hive,Hbase,Sqoop,Zookeeper 等)。无论是初学者像快速部署一套Hadoop环境,还是用于生产的自动化部署,Ambari都可以满足。
     你可以在官网http://ambari.apache.org/获取最新的Ambari的内容,目前Ambari还支持流行的 Spark,Storm 等计算框架,Kafka消息队列、以及资源调度平台 YARN 等。
    Ambari 自身也是一个分布式架构的软件,主要由两部分组成:Ambari Server 和 Ambari Agent。我们可以通过 Ambari Server 通知 Ambari Agent 安装对应的软件;甚至连Ambari Agent我们都可以在Web界面上来进行安装和部署。
    Ambari Agent 会定时地发送各个机器每个项目组件的当前状态给 Ambari Server,并在Web界面上进行展示汇总,方面我们及时掌握集群状态
    

    基础环境准备

    [root@linux-node2 ~]# ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    6b:74:cc:37:a0:79:a7:66:48:c4:3e:b0:17:bc:d3:87 root@linux-node2
    The key's randomart image is:
    +--[ RSA 2048]----+
    | |
    | o |
    | . = . |
    | = O o |
    | . S E = |
    | + B = . |
    | + + |
    | . o |
    | |
    +-----------------+
    [root@linux-node2 ~]# cat .ssh/id_rsa.pub >.ssh/authorized_keys
    [root@linux-node2 ~]# ls -l .ssh/authorized_keys
    -rw-r--r-- 1 root root 398 May 17 21:34 .ssh/authorized_keys
    [root@linux-node2 ~]# chmod 600 .ssh/authorized_keys
    [root@linux-node2 ~]# ls -l .ssh/authorized_keys
    -rw------- 1 root root 398 May 17 21:34 .ssh/authorized_keys
    [root@linux-node2 ~]# scp .ssh/id_rsa.pub 192.168.56.13:/root/.ssh/authorized_keys
    root@192.168.56.13's password:
    id_rsa.pub 100% 398 0.4KB/s 00:00
    [root@linux-node2 ~]# ssh root@192.168.56.13
    Last failed login: Fri May 18 09:57:41 CST 2018 from slave-1 on ssh:notty
    There were 3 failed login attempts since the last successful login.
    Last login: Fri May 18 09:48:42 2018 from 192.168.56.1
    [root@linux-node3 ~]# exit

    安装jdk

    [root@linux-node2 ~]# yum install -y java-1.8.0 mysql-connector-java

    部署ambari-server

    [root@linux-node2 ~]# cd /etc/yum.repos.d/
    wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.0.0/ambari.repo #wget -O /etc/yum.repos.d/ambari.repo http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.5.1.0/ambari.repo

    yum install -y ambari-server

    数据库配置

    [root@linux-node2 ~]# mysql -uroot -psalt
    Welcome to the MariaDB monitor. Commands end with ; or g.
    Your MariaDB connection id is 3
    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 character set utf8; #创建ambari数据库及用户
    Query OK, 1 row affected (0.00 sec)

    MariaDB [(none)]> create user 'ambari'@'%' identified by 'ambari';
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [(none)]> grant all privileges on . to 'ambari'@'%';
    Query OK, 0 rows affected (0.01 sec)

    MariaDB [(none)]>

    MariaDB [(none)]> create database hive character set utf8; #创建hvie库及用户
    Query OK, 1 row affected (0.00 sec)

    MariaDB [(none)]> create user 'hive'@'%' identified by 'hive';
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [(none)]> grant all privileges on . to 'hive'@'%';
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    设置ambari-server

    [root@linux-node2 ~]# ambari-server setup
    Using python /usr/bin/python2
    Setup ambari-server
    Checking SELinux...
    SELinux status is 'disabled'
    Customize user account for ambari-server daemon [y/n] (n)?
    Adjusting ambari-server permissions and ownership...
    Checking firewall status...
    Redirecting to /bin/systemctl status iptables.service
    Unit iptables.service could not be found.

    Checking JDK...
    Do you want to change Oracle JDK [y/n] (n)?
    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
    [4] - PostgreSQL
    [5] - Microsoft SQL Server (Tech Preview)
    [6] - SQL Anywhere

    Enter choice (3): 3
    Hostname (localhost):
    Port (3306):
    Database name (ambari):
    Username (ambari):
    Enter Database Password (ambari):
    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
    Extracting system views...
    .......
    Adjusting ambari-server permissions and ownership...
    Ambari Server 'setup' completed successfully.
    [root@linux-node2 ~]#
    [root@linux-node2 ~]# ambari-server start
    Using python /usr/bin/python2
    Starting ambari-server
    Ambari Server running with administrator privileges.
    Organizing resource files at /var/lib/ambari-server/resources...
    WARNING: setpgid(2444, 0) failed - [Errno 13] Permission denied
    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.
    [root@linux-node2 ~]#

    改端口

    修改配置文件 /etc/ambari-server/conf/ambari.properties
    client.api.port=<port_number>

    报错:

    参考地址:https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.0.0/bk_ambari-administration/content/using_ambari_with_mysql.html

    1、18 May 2018 13:47:43,118 ERROR [main] DBAccessorImpl:102 - Error while creating database accessor
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    解决:

    yum install mysql-connector-java

    ls /usr/share/java/mysql-connector-java.jar

    [root@linux-node2 ~]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
    Using python /usr/bin/python2
    Setup ambari-server
    Copying /usr/share/java/mysql-connector-java.jar to /var/lib/ambari-server/resources
    JDBC driver was successfully initialized.
    Ambari Server 'setup' completed successfully.

    2、Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ambari.metainfo' doesn't exist
    解决:
    [root@linux-node2 ambari-server]# mysql -uroot -psalt

    MariaDB [(none)]> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | ambari |
    | hive |
    | mysql |
    | performance_schema |
    | salt |
    +--------------------+
    6 rows in set (0.00 sec)

    MariaDB [(none)]> use ambari;
    Database changed
    MariaDB [ambari]> show tables;
    Empty set (0.00 sec)

    MariaDB [ambari]> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

    报错:

    ERROR:root:ERROR: Bootstrap of host b25 fails because previous action finished with non-zero exit code (255)
    ERROR MESSAGE: ssh_exchange_identification: read: Connection reset by peer

    解决
    [root@b25 ~]# cat .ssh/config
    Host b25
    HostName 192.168.241.25
    Port 17717

    [root@b25 ~]# chmod 600 .ssh/config
    [root@b25 ~]# ssh -p 17717 b25 -v

  • 相关阅读:
    tcl基本语法
    linux hostid与lmhostid
    linux下uptime命令
    介绍一下 WebApplicationContext?
    Spring 由哪些模块组成?
    怎样开启注解装配?
    解释不同方式的自动装配 ?
    @Qualifier 注解有什么用?
    解释 Spring 框架中 bean 的生命周期?
    如何在 spring 中启动注解装配?
  • 原文地址:https://www.cnblogs.com/fengmeng1030/p/9056952.html
Copyright © 2011-2022 走看看