# 检查服务状态 [root@hnode3 ~] systemctl status ntpd.service ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: active (running) since 一 2020-03-30 16:26:16 CST; 37min ago
# home下创建.ssh目录 [root@hnode1 ~] mkdir .ssh [root@hnode1 ~] cd .ssh/ [root@hnode1 .ssh] pwd /root/.ssh # 生成秘钥 [root@hnode1 .ssh] ssh-keygen -t rsa Generating public/private rsa key pair. Enter file inwhich 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: SHA256:F1XLKMmnivY288gcK5IsY90xm0kawlM62D+uyGIeB0k root@hnode1 The keys randomart image is: +---[RSA 2048]----+ | ... | | . o o . | | E = o o | |. . . = | | * o S o | |. O . +. o | | . O *o*o | |oo* O.*+++ | |=+.=.o o*+. | +----[SHA256]-----+ # 查看生成的文件 [root@hnode1 .ssh] ll 总用量 8 -rw-------. 1 root root 1675 3月 30 18:58 id_rsa -rw-r--r--. 1 root root 393 3月 30 18:58 id_rsa.pub
[root@hnode1 opt] cat /var/log/mysqld.log 2020-03-30T11:57:32.968090Z 0 [Warning] TIMESTAMP ... ... 2020-03-30T11:57:33.657151Z 1 [Note] A temporary password is generated for root@localhost: o6)j!d;l>iQz
(o6)j!d;l>iQz) # 就是 MySQL 的初始密码
[root@hnode1 opt] mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: # 刚刚查询到的MySQL初始密码(o6)j!d;l>iQz)
The existing password for the user account root has expired. Please set a new password.
New password: # 新的密码 (Admin123!)
Re-enter new password: # 新的密码
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y #是否删除匿名用户,生产环境建议删除 Success.
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n #是否禁止root远程登录,根据自己的需求选择y/n并回车
... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n #是否删除test数据库
... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y #是否重新加载权限表 Success.
# 命令行中连接MySQL [root@hnode1 opt] mysql -u root -p Enter password: (Admin123!) Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
tar -zxvf ambari-2.7.3.0-centos7.tar.gz -C /var/www/html/ambari/ tar -zxvf HDP-3.1.0.0-centos7-rpm.tar.gz -C /var/www/html/hdp/ tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/hdp/HDP-UTILS-1.1.0.22/
[root@hnode1 ~]# 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):root Adjusting ambari-server permissions and ownership... Checking firewall status... Checking JDK... [1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 [2] Custom JDK ============================================================================== Enter choice (1): 2 #选择自定义jdk 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: /opt/jdk1.8.0_191 #JAVA_HOME Validating JDK on Ambari Server...done. Check JDK version for Ambari Server... JDK version found: 8 Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server. 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)? y 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): hnode1 #mysql hostname Port (3306): # mysql 端口 默认 3306 Database name (ambari): #使用的数据库名称 Username (ambari): #mysql用户名 Enter Database Password (bigdata): #密码 前面增加的ambari用户的密码 (Ambari123) Re-enter password: #(Ambari123) Passwords do not match Enter Database Password (bigdata): Invalid characters in password. Use only alphanumeric or _ or - characters Enter 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)? y 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.sql Proceed with configuring remote database connection properties [y/n] (y)? y Extracting system views... ambari-admin-2.7.3.0.139.jar .... 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.
[root@hnode1 ~]# mysql -u ambari -p -h hnode1 Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. ... mysql> use ambari; Database changed mysql> show tables; Empty set (0.00 sec) # 执行 Ambari-DDL-MySQL-CREATE.sql 脚本 mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql; Query OK, 0 rows affected (0.00 sec)
[root@hnode1 ~]# ambari-server start # 如果启动失败,关闭服务【ambari-server stop】,重新启动 Using python /usr/bin/python Starting ambari-server Ambari Server running with administrator privileges. Organizing resource files at /var/lib/ambari-server/resources... Ambari database consistency check started... 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......................................... Server started listening on 8080
DB configs consistency check: no errors and warnings were found. Ambari Server 'start' completed successfully.
ERROR 2020-04-05 15:04:48,778 main.py:269 - Ambari agent machine hostname (localhost.localdomain) does not match expected ambari server hostname (hnode1). Aborting registration. Please check hostname, hostname -f and /etc/hosts file to confirm your hostname is setup correctly
# 请检查hostname的配置
如果某个服务A 依赖服务B,而你没有选择安装服务B, 会提示安装服务B
1 2 3 4 5 6 7 8
[root@hnode1 .ssh]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar Using python /usr/bin/python Setup ambari-server Copying /usr/share/java/mysql-connector-java.jar to /var/lib/ambari-server/resources/mysql-connector-java.jar If you are updating existing jdbc driver jar for mysql with mysql-connector-java.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts. JDBC driver was successfully initialized. Ambari Server 'setup' completed successfully.