4

我使用托盘取回 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)))
4

1 回答 1

1

我在我们的托盘部署器中使用它,它通过公共 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)) 
于 2013-05-10T20:10:03.560 回答