Support Questions

Find answers, ask questions, and share your expertise

Accessing a role's hostname from SDL or control script

avatar

I'm creating a CSD for a custom service with multiple roles. Some of the roles need to have knowledge of which host(s) other roles are running on, similar to how a NameNode needs to know which hosts have DataNodes.

 

I think this information should be accessible somehow after a user has chosen the role hosts in the CM UI, but I can't figure out how.

 

So, how can I access a role's hostname from the service.sdl or control.sh files?

1 ACCEPTED SOLUTION

avatar

I've figured out a way to do this. I used peerConfigGenerators in the SDL file. Peer configs create a properties file with key/value pairs--the key/value pairs themselves weren't useful to me, but each line of the file is prepended by hostname that the chose role is running on. I then parsed that file for the hostname in the control script.

View solution in original post

5 REPLIES 5

avatar
Champion

Dont mistake me  I am not savy when it comes to CSD . I have few links in my desktop sleeping.

I believe it might come handy for you. if I understand correctly these links should gear you up. 

 

https://blog.cloudera.com/blog/2014/04/how-to-extend-cloudera-manager-with-custom-service-descriptor...

 

https://github.com/cloudera/cm_ext/wiki

https://github.com/cloudera/cm_csds

 

 

avatar

Thanks for the reply @csguna. I have seen those links before, and haven't found the answer I'm looking for yet.

avatar
Champion

@benbluetalonMy bad mate.

avatar

I've figured out a way to do this. I used peerConfigGenerators in the SDL file. Peer configs create a properties file with key/value pairs--the key/value pairs themselves weren't useful to me, but each line of the file is prepended by hostname that the chose role is running on. I then parsed that file for the hostname in the control script.

avatar
Champion

Sounds good .