【问题标题】:"Host 'xxxx is not allowed to connect to this MySQL server" when installing Ranger DBs via Ambari通过 Ambari 安装 Ranger DB 时,“不允许主机 'xxxx 连接到此 MySQL 服务器”
【发布时间】:2019-12-01 23:43:36
【问题描述】:

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

在运行 Ambari 自动 DB 和 DB 用户设置的连接测试时,看到指示节点无法连接的错误。

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>`

抛出

ERROR 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 不是很有经验。对此有何调试建议或修复?

【问题讨论】:

    标签: ambari apache-ranger


    【解决方案1】:

    根据 Hortonworks community forums 的回答,最终让 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的问题,ie。仍然出现错误

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-20
      • 2013-03-31
      • 2011-02-26
      • 2014-04-02
      • 2019-06-07
      • 2023-03-29
      • 2019-08-05
      相关资源
      最近更新 更多