[英]Get ec2 dns name via pallet
我使用托盤返回ec2節點列表。 我想得到這些的DNS名稱。 我在jclouds中看到有一個dnsName方法,但我認為無法訪問它以便在clojure中使用托盤。 這可能嗎?
細節
我正在嘗試對storm-deploy項目進行修改以使用dns名稱,以便安全組正常工作。 具體來說,我正在嘗試編寫類似這個函數的東西在代碼中使用:
(defn zookeeper-dns-names [compute name]
(let [running-nodes (filter running?
(map (partial jclouds-node->node compute) (nodes-in-group compute (str "zookeeper-" name))))]
(map dns-name running-nodes)))
我在我們的托盤部署中使用它,它通過公共IP獲取dns名稱:
(defn get-aws-name []
(let [ip (-> (target-node) bean :publicAddresses first)]
(str "ec2-" (apply str (replace {\. \-} ip)) ".compute-1.amazonaws.com")))
私有IP也可以通過安全組工作:
(defn ips-in-group [group-name public-or-private]
"Sequence of the first public IP from each node in the group"
(->> (nodes-in-group group-name)
(map bean)
(map public-or-private)
(map first))
(defn public-ips-in-group
"Sequence of the first public IP from each node in the group"
[group-name]
(ips-in-group group-name :publicAddresses))
(defn private-ips-in-group
"Sequence of the first public IP from each node in the group"
[group-name]
(ips-in-group group-name :privateAddresses))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.