AMBARI deployment HADOOP cluster (3)

1. Installation ambari-server

yum -y install ambari-server

2. ambari server requires a database to store metadata used by default Postgres database. The default user name and password are:  ambari / BigData. But in general, the latter also install the hive and Ranger, also need to keep a metadata database, so as to use a mysql database. We need to create the appropriate database and user ambari. MySQL installation and configuration

(1) Download and install the MySQL official Yum Repository
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

  Using the above command directly download the installation of Yum Repository, looks about 25KB, and then you can directly install yum.

[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm

  Then began installing MySQL server.

[root@localhost ~]# yum -y install mysql-community-server

  This step may take some time, it will overwrite mariadb before the installation is complete.

  At this point MySQL installation is complete, then some set of MySQL.

(2) MySQL database settings

  First start MySQL

[root@localhost ~]# systemctl start  mysqld.service

  View MySQL running, running state is shown:

[root@localhost ~]# systemctl status mysqld.service

  At this time, MySQL has started running, but in order to enter at this time MySQL had to first find out the root user password, you can find the password in the log file with the following command:

[root@localhost ~]# grep "password" /var/log/mysqld.log

  The following command into the database:

[root@localhost ~]# mysql -uroot -p

  Enter the initial password, this time can not do anything, because the default MySQL database to operate after the password must be changed:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

  There is a problem, when setting a new password if set too simple will complain, we design a complex password it. Safety case underlined number all at once.

  But this time there is a problem, because the Yum Repository installation, yum after each operation will automatically update, you need to uninstall this:

[root@localhost ~]# yum -y remove mysql57-community-release-el7-10.noarch

  At this point considered really completed the mysql installation, start the configuration ambari.

create database ambari default character set='utf8';
CREATE USER 'ambaridba'@'localhost' IDENTIFIED BY '你的密码'; 
CREATE USER 'ambaridba'@'%' IDENTIFIED BY '你的密码';
GRANT ALL PRIVILEGES ON ambari.* TO 'ambaridba'@'localhost';
GRANT ALL PRIVILEGES ON ambari.* TO 'ambaridba'@'%';
FLUSH PRIVILEGES;

 

3. Configure ambari-server

ambari-server setup 

    3.1 If no  SELinux = disable, there will be a warning message, press enter, accept the default value (y). Step 2 in accordance with the foregoing, then, this value had been set, it will automatically skip this step.

   Note: The entry into force of this value is the need to restart the computer. If you do not restart, then there will be a warning message. After the setup is complete, start ambari server, console displays a successful start, but can not access through a browser. Later, after the restart the computer can. I do not know if it was necessary in order to access the ambari server.

    3.2 set to run ambari server users will use the default root. You can type y, and enter a carriage return after the other user

 

    3.3 Select JDK. In order to use a unified JDK, select the JDK custom here. Then the path will be asked to enter the JAVA_HOME, must not be under the user's directory, in / usr and / opt as well.

    3.4 GPL License, this step must choose y.

    3.5 database configuration information element is connected

    3.6 输入数据库驱动的 jar 包的路径,这个jar包是自己下载的,可以下载最高版本的,然后放到某一目录,如下图。

 

   3.7 进行远程数据库连接信息配置。选择 y

    3.8 运行下面的命令。

ambari-server setup --jdbc-db=mysql --jdbc-driver=/opt/soft/mysql-connector-java-5.1.43.jar

     虽然在上面的步骤中已经设置过了,但是不知道为什么,在后续安装 hive 时,测试连接存储 hive 元数据的数据库时,始终连不上。停掉 ambari-server 后,运行上面的命令后,才能连接成功。

   3.9 创建表

   在MySQL中执行:使用root登陆。

mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

4. 启动 ambari-server 。启动成功后,可以访问: http://<ip>:8080  用户和密码是: admin/admin

ambari-server start

   (1)如果报如下的错误, 

Starting ambari-server
ERROR: Exiting with exit code 1. 
REASON: Unable to detect a system user for Ambari Server.
- If this is a new setup, then run the "ambari-server setup" command to create the user
- If this is an upgrade of an existing setup, run the "ambari-server upgrade" command.
Refer to the Ambari documentation for more information on setup and upgrade.

          运行下面的命令,设置 ambari-server.user 的值为 root,或者另外一个系统用户

vi /etc/ambari-server/conf/ambari.properties

    (2)如果出现下面的错误,需要运行: yum install -y mysql-connector-java*

Starting ambari-server
Ambari Server running with administrator privileges.
ERROR: Exiting with exit code -1. 
REASON: Before starting Ambari Server, you must copy the MySQL JDBC driver JAR file to /usr/share/java and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.

      把上面 3.6 步骤中的 jar 包复制到 /usr/shar/java 目录下,不需要修改 ambari.properties 里的 server.jdbc.driver.path 的值(这个值在上面的步骤中已经设置了)。

cp /opt/soft/mysql-connector-java-5.1.43.jar /usr/share/java/ 
注意:/usr/share/java为JAVA_HOME目录。

 

(3) 其它错误的话,可以查看启动日志

more /var/log/ambari-server/ambari-server.log

       我事先没有创建库,会报数据库不存在的错误。如果报什么什么表不存在的话,需要把 /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql 中的初始化语句跑到数据库中。

mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

 

 4. 停止和查看 ambari-server 的状态

ambari-server stop
ambari-server status

 

Guess you like

Origin www.cnblogs.com/MY0213/p/11262637.html