Created 04-10-2017 06:18 AM
Hi
I've been working with ansible to create hadoop clusters, everything works fine except ambari agents fail to connect to ambari server. Even though ambari agents are in running state and that ambari-agent.ini file is updated with ambari-servers hostname, versions also match. I've written the ansible playbook in such a way that ambari-server tries to connect with ambari-agents for 200 times with 5 second delay, but at the end of the loop it fails. If I manually log in into each agent machine and restart the agents during the 200 tries, it gets connected with the server.
Thanks in advance!!
Created 04-10-2017 06:34 AM
You mentioned that you have written the ansible playbook in such a way that ambari-server tries to connect with ambari-agents for 200 times with 5 second delay.
- > However, Ideally the ambari-agent tries to connect to ambari-server based on the host/port and other information's mentioned in "ambari-agent.ini".Ambari agents sends their registration requests to ambari-server.
- If you want to connect from ambari-server to ambari-agents then you should check if the agent hostnames are resolvable from ambari hosts? Also from ambari-server how are you connecting to ambari agents? (I Mean which agent port? And is that port accessible form AmbariServer)
Created 04-10-2017 06:45 AM
So ideally ambari-agent.ini file should contain the ambari-server's hostname and /etc/hosts file must contain dns of both server and agent machines which was provided..
FYR..
ambari-agent.ini
[server]
hostname=ambari_server_hostname
url_port=8440
secured_url_port=8441
Is it required to provide the ambari-agent's hostname in the ambari-agent.ini file..?
Created 04-10-2017 06:50 AM
No we do not need to provide ambari-agents hostname inside the "ambari-agent.ini" file. It should only know what are the AmbariServer host/port information's are.
.
From ambari-server how are you connecting to ambari agents? (I Mean which agent port? And is that port accessible form AmbariServer)
Created 04-10-2017 06:58 AM
This is the part of ansible playbook..
- name: Waiting for ambari-agents to register uri: url="http://{{ ansible_default_ipv4.address }}:8080/api/v1/hosts/{{ hostvars[item]['ansible_fqdn'] | lower }}" method=GET force_basic_auth=yes user=admin password=admin HEADER_X-Requested-By="ambari" status_code=200,201,202,404 with_items: "{{ groups['all'] }}" register: result until: "result.status != 404" retries: 200 delay: 5
Created 04-10-2017 07:23 AM
How are you making sure that your Ansible is actually starting the ambari-agent properly?
Are you having the following code in your Ansible:
name: Ensure ambari-agent is running and enabled command: /etc/init.d/ambari-agent restart