开发者

Erlang: What's a good way to automatically assign node names?

开发者 https://www.devze.com 2022-12-31 11:27 出处:网络
I want to have an EC2 based cluster that can grow and shrink at will. No node will be special in any way nor do I want开发者_C百科 them to have to coordinate their names with any other nodes. I don\'t

I want to have an EC2 based cluster that can grow and shrink at will. No node will be special in any way nor do I want开发者_C百科 them to have to coordinate their names with any other nodes. I don't want to hard code the names since I want to use one image and spin them up as needed. I understand nodes have to have names to communicate, though. What's a good strategy for automatically and dynamically coming up with a name at start script time?


Use uuidgen, or the equivalent API if your shell scripting language isn't (ba)sh. If you don't want to see single quotes around node names, then replace - with _ and add a prefix, just in case the first character is a decimal digit.

(Sorry, if I'm stating the obvious, but...) If you want the node to be discoverable, get the initialisation code to publish the node to some kind of directory service node.


Call it node@my.ip.add.ress. I did this on EC2 and had an erlang cluster I could spin up at an arbitrary size directly from the AWS console.

0

精彩评论

暂无评论...
验证码 换一张
取 消