Ambari-Server&agent安装配置(二) — Jevic

Ambari-Server&agent安装配置(二)

2020/03/07 Bigdata

数据库配置

说明:数据库表名设置为大小写不敏感,修改mysql数据库配置文件my.cnf 即可

# mysql -u root -p123456 -e "show variables like 'lower_case_table_names';"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | 1     |
+------------------------+-------+

创建数据库

  • 根据你需要安装的服务创建对应的数据库及配置访问信息;
create database ambari character set utf8;
GRANT ALL PRIVILEGES ON ambari.* TO 'ambari'@'%' IDENTIFIED BY 'Ambari_123';
FLUSH PRIVILEGES;
create database hive character set latin1;
GRANT ALL PRIVILEGES ON hive.* TO 'hive'@'%' IDENTIFIED BY 'Hive@123';
FLUSH PRIVILEGES;
create database oozie character set utf8;
GRANT ALL PRIVILEGES ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'Oozie@123';
FLUSH PRIVILEGES;
create database ranger character set utf8;
GRANT ALL PRIVILEGES ON rangeradmin.* TO 'rangeradmin'@'%' IDENTIFIED BY 'Ranger@123';
FLUSH PRIVILEGES;
create database superset character set utf8;
GRANT ALL PRIVILEGES ON superset.* TO 'superset'@'%' IDENTIFIED BY 'Superset@123';
FLUSH PRIVILEGES;
create database hbase character set latin1;
GRANT ALL PRIVILEGES ON hbase.* TO 'hbase'@'%' IDENTIFIED BY 'Hbase@123';
FLUSH PRIVILEGES;

## hue 
create database hue character set utf8;
GRANT ALL PRIVILEGES ON hue.* TO 'hue'@'%' IDENTIFIED BY 'Hue@123456';
FLUSH PRIVILEGES;

主机初始化

    1. JDK 安装
    1. 主机名配置
      • 1.1.1.1 node.xxx.xx
    1. 双机互相
    ssh-keygen -t rsa
    ssh-copy-id NODE_NAME
    ## 也可以使用sshpass 去除密码输入提示
    yum install -y sshpass
    sshpass PASSWORD -e ssh-copy-id NODE_NAME 

ambari-server

Current Version: 2.6.5.0-292 [公共仓库]
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7


## 
yum install ambari-server -y

## jdbc 驱动下载地址 
https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.48.tar.gz
[root@jevic-t01 ~]# grep server.jdbc.driver.path /etc/ambari-server/conf/ambari.properties 
server.jdbc.driver.path=/usr/share/java/mysql-connector-java-5.1.48-bin.jar


## 初始化安装
[root@dt1 ~]# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[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): 3
WARNING: 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/java
Validating JDK on Ambari Server...done.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (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 / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (1): 3
Hostname (localhost): db1.jevic.cn
Port (3306):
Database name (ambari): ambari
Username (ambari):
Enter Database Password (bigdata):
Re-enter password:
Configuring ambari database...
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)?
Extracting system views...
ambari-admin-2.6.2.2.1.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.



## 将Ambari数据库脚本导入到数据库
mysql -uambari -pxxx
use ambari;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql


## 启动ambari server
# ambari-server start

在浏览器中访问ip:8080,默认登录名:admin 密码:admin

ambari-agent

配置yum 源
yum -y install ambari-agent

#ambari-agent 打ssl认证有问题,需要关闭
grep -q "^force_https_protocol=PROTOCOL_TLSv1_2" /etc/ambari-agent/conf/ambari-agent.ini ||sed -i 's@\[security\]@&\nforce_https_protocol=PROTOCOL_TLSv1_2@g' /etc/ambari-agent/conf/ambari-agent.ini

grep -q "^verify=diable" /etc/python/cert-verification.cfg || sed -i 's@\[https\]@&\nverify=diable@g' /etc/python/cert-verification.cfg 

/usr/sbin/ambari-agent reset ServiceNAME
/usr/sbin/ambari-agent start 

后记

以下是在安装ambari 2.7.4时遇到的问题(安装方式一样)

    1. 初始化集群加入主机,状态一直为: preparing

解决方案: sudo chown -R ambari /var/run/ambari-server

    1. HDFS 开启HA时报错 500

500 status code received on GET method for API: /api/v1/stacks/HDP/versions/2.4/recommendations Error message: Error occured during stack advisor command invocation: Cannot create /var/run/ambari-server/stack-recommendations

解决方案:sudo chown -R ambari /var/run/ambari-server

    1. ntpd 服务无法开机自启动

解决方案: systemctl disable chronyd

Search

    Post Directory