代码之家  ›  专栏  ›  技术社区  ›  Hanjo Odendaal

R中的多节点H2O集群未检测到其他EC2实例

  •  0
  • Hanjo Odendaal  · 技术社区  · 5 年前

    this h2o.jar 他们都有档案,

    • 名称群集 -name
    • 而是使用 -network 旗帜
    • 0.0.0.0

    以下是我的步骤:

    1) 在同一可用区启动awsec2并获取私有ip和网络cidr( 172.31.0.0/20 ). 将ip地址放入 flatfile.txt

    172.31.8.210:54321
    172.31.9.207:54321
    172.31.13.136:54321
    

    2) 复制 平面文件.txt 到所有我想作为节点连接并启动H2O的服务器

    # cluster_run
    library(h2oEnsemble)
    library(ssh)
    
    ips <- gsub("(.*):.*", "\\1", readLines("flatfile.txt"))
    
    start_cluster <- function(ip){
      # Copy flatfile across
      session <- ssh_connect(paste0("ubuntu@", ip), keyfile = "mykey.pem")
      scp_upload(session, "flatfile.txt")
    
      # Ensure no h2o instance is already running
      out <- ssh_exec_wait(session, "sudo pkill java")
    
      # Start H2O cluster
      cmd <- gsub("\\s+", " ", paste0("ssh -i mykey.pem -o 'StrictHostKeyChecking no' ubuntu@", ip, 
             " 'java -Xmx20g 
             -jar /home/rstudio/R/x86_64-pc-linux-gnu-library/3.5/h2o/java/h2o.jar
             -name mycluster
             -network 172.31.0.0/20
             -flatfile flatfile.txt 
             -port 54321 &'"))
      system(cmd, wait = FALSE)
    
    }
    start_cluster(ips[3])
    start_cluster(ips[2])
    start_cluster(ips[1])
    

    3) 一旦完成,我现在想连接 R 到我的新多节点群集

     h2o.init(startH2O = F)
     h2o.shutdown(prompt = FALSE)
    

    enter image description here

    我还看到,当我在不同节点上启动H2O集群时,它不会拾取网络中的其他机器: enter image description here

    0 回复  |  直到 5 年前
        1
  •  2
  •   TomKraljevic    5 年前

    您还需要将端口54321+1(so54322)添加到安全组。

    内部通讯通过54322。

    (我还将为网络指定/16,因为它更容易让其他人理解。例如,即使您确定/20在技术上正确,您的网络设置,我也无法轻易确定。:-)