Support Questions

Find answers, ask questions, and share your expertise

ambari agent installation with api fails

avatar

I am trying to install ambari-agent on remote computer which I can ssh without password from server.

I followed this link : http://www-01.ibm.com/support/docview.wss?uid=swg22000281

In bootstrap.py userRunAs=null here, If I install with UI, it is usually root.

In the /var/log/ambari-server/ambari-server.log..

[Thread-12050] BSRunner:258 - Host= <remote host> bs=/usr/lib/python2.6/site-packages/ambari_server/bootstrap.py requestDir=/var/run/ambari-server/bootstrap/32 user=root sshPort=22 keyfile=/var/run/ambari-server/bootstrap/32/sshKey passwordFile null server=<server> version=2.6.1.5 serverPort=8080 userRunAs=null timeout=300

and in /var/log/ambari-server/ambari-audit.log

User(null), RemoteIp(<server>), Operation(User login), Roles( ), Status(Failed), Reason(Authentication required)

User(admin), RemoteIp(<server>), Operation(User login), Roles( Ambari: Ambari Administrator), Status(Success)

1 ACCEPTED SOLUTION

avatar

Hi @Naveen R ,

why dont you try it via UI way.

navigate to Hosts Tab ->Actions -> Add new hosts and ADd via UI.

if you are sure you want to do it via REST API. please try the following. it worked for me.

curl -u admin:admin -H "X-Requested-By:ambari" -i -X POST http://AMBARI_SERVER:8080/api/v1/bootstrap -d '{"verbose":true,"sshKey":"-----BEGIN RSA PRIVATE KEY-----XX PRIVATE KEY-----END RSA PRIVATE KEY-----","hosts":["mycomapny.com"],"user":"root","sshPort":"22","userRunAs":"root"}'

Request you to mark the answer as accepted by clicking on accept button if this helps you :)

View solution in original post

4 REPLIES 4

avatar

Hi @Naveen R ,

why dont you try it via UI way.

navigate to Hosts Tab ->Actions -> Add new hosts and ADd via UI.

if you are sure you want to do it via REST API. please try the following. it worked for me.

curl -u admin:admin -H "X-Requested-By:ambari" -i -X POST http://AMBARI_SERVER:8080/api/v1/bootstrap -d '{"verbose":true,"sshKey":"-----BEGIN RSA PRIVATE KEY-----XX PRIVATE KEY-----END RSA PRIVATE KEY-----","hosts":["mycomapny.com"],"user":"root","sshPort":"22","userRunAs":"root"}'

Request you to mark the answer as accepted by clicking on accept button if this helps you :)

avatar

avatar

Hi @Naveen R ,

IMHO you might need to add some service to the newly host added.

can you see by ssh to the host whether the added host has ambari-agent running (ambari-agent status) .

additionally the curl command :

curl -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://AMBARI_SERVER:8080/api/v1/clusters/asnaik/hosts/NEWLY_ADDED_HOST

I would again suggest you add host via Hosts Tab ->Actions -> Add new hosts which is defined and correct way of doing it. or you might need to add service also to the host.

avatar

I'm getting bad request as response with message "Attempted to add unknown hosts to a cluster. These hosts have not been registered with the server"