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
试试。