目录
- host文件及主机名配置
- ambari配置“Confirm Hosts”出现错误解决
- 1、Failed to connect to https://xxxx:8440/ca due to [Errno 111] Connection 类似错误解决
- 2、Ambari Agent host cannot reach Ambari Server 'localhost:8080'.
- 3、does not match expected ambari server hostname 错误提示解决
- 3、hive报错The MySQL JDBC driver has not been set ……ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver
- 4、nameNode启动时报错:/usr/hdp/current/hadoop-hdfs-namenode/bin/hdfs dfsadmin -fs hdfs:……-safemode get | grep 'Safe mode is OFF'' returned 1.
host文件及主机名配置
1、host文件配置
如果有三台服务器
192.168.0.51 (master)
192.168.0.52 (slave1)
192.168.0.101 (slave2)
[root@ecs-c562-0001 ~]# cat /etc/hosts
192.168.0.51 ecs-c562-0001 ecs-c562-0001.localdomain
192.168.0.52 ecs-c562-0002 ecs-c562-0002.localdomain
192.168.0.101 ecs-c562-0003 ecs-c562-0003.localdomain
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 ecs-c562-0001 ecs-c562-0001
2、hostname主机名配置
修改各主分机的主机名,以master为例:
[root@ecs-c562-0001 ~]# cat /etc/hostname
ecs-c562-0001.localdomain
[root@ecs-c562-0001 ~]# hostname
ecs-c562-0001.localdomain
[root@ecs-c562-0001 ~]# hostname -f
ecs-c562-0001
ambari配置“Confirm Hosts”出现错误解决
1、Failed to connect to https://xxxx:8440/ca due to [Errno 111] Connection 类似错误解决
一般来说 xxxx可能是localhost,完整错误有可能是这样的:
Failed to connect to https://localhost:8440/ca due to [Errno 111] Connection refused
解决办法:
例:如果是ecs-c562-0002.localdomain出错,则在当前分机上修改ambari-agent.ini文件的hostname为master的主机名ecs-c562-0001.localdomain(对应的哪个节点报错对应改哪一个节点)
vim /etc/ambari-agent/conf/ambari-agent.ini
[server]
hostname=ecs-c562-0001.localdomain #把这个hostname修改为master的主机名
url_port=8440
secured_url_port=8441
connect_retry_delay=10
max_reconnect_retry_delay=30
修改完成后 ambari-agent restart
重启试试,应该可以。
2、Ambari Agent host cannot reach Ambari Server 'localhost:8080'.
从ambari-server传送到客户端的setupAgent.py脚本的main函数中的参数设置不对,直接在master节点上修改setupAgent.py文件的:
vim /usr/lib/ambari-server/lib/ambari_server/setupAgent.py
找到
expected_hostname = args[0]
passPhrase = args[1]
#hostname = args[2]
hostname = '192.168.0.51' #我这里直接是改成主机的IP了,也可以改成master的主机名试试
user_run_as = args[3]
projectVersion = ""
server_port = 8080
然后重新执行一遍Confirm Hosts
试试。
3、does not match expected ambari server hostname 错误提示解决
用vm-100-5-centos
主机名示例:
当报
INFO 2020-12-26 13:04:21,057 main.py:481 - Connecting to Ambari server at https://vm-100-2-centos:8440 (192.168.100.2)
INFO 2020-12-26 13:04:21,057 NetUtil.py:61 - Connecting to https://vm-100-2-centos:8440/ca
ERROR 2020-12-26 12:43:48,835 main.py:269 - Ambari agent machine hostname (vm-100-5-centos) does not match expected ambari server hostname (vm-100-5-centos.localdomain). Aborting registration. Please check hostname, hostname -f and /etc/hosts file to confirm your hostname is setup correctly
错误,在确保/etc/hosts
和hostname
没有问题的前提下,telnet vm-100-2-centos 8440
,发现不通。
因为机器用的是腾讯云,除了本地机器防火墙关外,还要在腾讯云控制台上设置安全组,开放需要的端口。这样一般就可以得到解决。
3、hive报错The MySQL JDBC driver has not been set ……ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver
报错如下:
2020-12-28 20:17:49,162 - Check db_connection_check was unsuccessful. Exit code: 1. Message: The MySQL JDBC driver has not been set. Please ensure that you have executed 'ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver'.
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: The MySQL JDBC driver has not been set. Please ensure that you have executed 'ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver'.
2020-12-28 20:27:00,725 - Check db_connection_check was unsuccessful. Exit code: 1. Message: The MySQL JDBC driver has not been set. Please ensure that you have executed 'ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver'.
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: The MySQL JDBC driver has not been set. Please ensure that you have executed 'ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver'.
解决方法:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
4、nameNode启动时报错:/usr/hdp/current/hadoop-hdfs-namenode/bin/hdfs dfsadmin -fs hdfs:……-safemode get | grep 'Safe mode is OFF'' returned 1.
报错大体内容如下:
2020-12-29 09:47:51,546 - Execute['/usr/hdp/current/hadoop-hdfs-namenode/bin/hdfs dfsadmin -fs hdfs://vm-16-2-centos.localdomain:8020 -safemode get | grep 'Safe mode is OFF''] {'logoutput': True, 'tries': 115, 'user': 'hdfs', 'try_sleep': 10}
2020-12-29 09:47:53,497 - Retrying after 10 seconds. Reason: Execution of '/usr/hdp/current/hadoop-hdfs-namenode/bin/hdfs dfsadmin -fs hdfs://vm-16-2-centos.localdomain:8020 -safemode get | grep 'Safe mode is OFF'' returned 1.
2020-12-29 09:48:05,262 - Retrying after 10 seconds. Reason: Execution of '/usr/hdp/current/hadoop-hdfs-namenode/bin/hdfs dfsadmin -fs hdfs://vm-16-2-centos.localdomain:8020 -safemode get | grep 'Safe mode is OFF'' returned 1.
解决方法:
# su hdfs //切换到hdfs用户,若关闭了hdfs的权限则可略过这一步
# hadoop dfsadmin -safemode leave //让namenode离开安全模式