0

尝试在 3 个 centos7 节点上安装 HDP 集群(用于测试/评估目的),当被要求为 Ranger 和 Ranger KMS 配置数据库时,我遇到了错误。

在此处输入图像描述

在运行 Ambari 自动数据库和数据库用户设置的连接测试时,看到错误表明节点无法连接。

在此处输入图像描述

2019-07-18 16:22:02,448 - Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties. java.sql.SQLException: null,  message from server: "Host 'HW02.co.local' is not allowed to connect to this MySQL server" 
Traceback (most recent call last):  File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 546, in <module>    CheckHost().execute()  File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 352, in execute    method(env)  File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 207, in actionexecute    raise Fail(error_message) resource_management.core.exceptions.Fail: Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties. java.sql.SQLException: null,  message from server: "Host 'HW02.co.local' is not allowed to connect to this MySQL server"

我在数据节点上有一个新安装的 MySQL 服务器并且可以运行

mysql -u root -p -h localhost`

但得到错误

mysql -u root -p -h <some remote cluster node>`

投掷

错误 2003 (HY000): 无法连接到 MySQL 服务器上的 '' (111)

mysql 配置文件看起来绑定到所有接口......

[root@HW03 ~]# cat /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
bind-address=0.0.0.0

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

所以不确定问题可能是什么。

对 MySQL 或 DBA 不是很有经验。对此有任何调试建议或修复吗?

4

1 回答 1

1

根据 Hortonworks社区论坛的回答,最终允许 Ambari 连接测试通过:

在mysql服务器上,运行...

[root@HW03 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 51
Server version: 5.6.44 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

mysql> use mysql;
Database changed
mysql>
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '<root's password, THIS IS NOT LITERAL>';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

现在可以看到... 在此处输入图像描述

虽然,仍然没有解决无法从其他远程主机访问mysql的问题,即。仍然出现错误

mysql -u root -p -h <some remote cluster node>`

错误 2003 (HY000): 无法连接到 MySQL 服务器上的 '' (111)

于 2019-07-23T21:26:08.227 回答