无法在服务器CentOS 7上运行h2o.init()

时间:2018-11-22 09:45:08

标签: r h2o

我在具有CentO 7的服务器上使用R中的h2o软件包。

我正确安装了库。 Java版本

<form action="save.php" method="POST" name="inputRecord" id="inputRecord">
  <input type="text" name="member" id="member" value="Member A">
  <input type="text" name="debit" id="debit" value="5000">
  <input type="text" name="credit" id="credit" value="1000">
  <input type="submit" name="save" id="save" value="OK">
</form>

//save.php
<?php
$limit=10;
$Member=Escape($_POST['member']);
$Debit=Escape($_POST['debit']);
$Credit=Escape($_POST['credit']);
$Insert = "INSERT INTO table_name(Member,Debit,Credit) values('".$Member."','".$Debit."','".$Credit.")";
for($i=1;$i<=$limit;$i++){
  $Inserting=mysqli_query($dbconnection,$Insert);
}

function Escape($string){
$string = preg_replace('/[^\p{L}\p{N}\s]/u', '', $string);
return $string;
}
?>

已正确设置为JAVA_HOME。 当我运行java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode) 时,我得到了一条带有错误的长消息

h2o.init()

我查看了日志,这就是显示的内容

rary: xgboost4j_gpu
11-22 10:42:12.375 127.0.0.1:54321       31865  main      INFO: XGBoost supported backends: [WITH_GPU, WITH_OMP]
11-22 10:42:12.375 127.0.0.1:54321       31865  main      INFO: ----- H2O started  -----
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Build git branch: rel-wright
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Build git hash: 0457fda98594a72aca24d06e8c3622d45bd545d2
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Build git describe: jenkins-rel-latest-stable-1-g0457fda
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Build project version: 3.20.0.8
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Build age: 2 months
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Built by: 'jenkins'
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Built on: '2018-09-21 16:54:12'
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Watchdog Build git branch: (unknown)
11-22 10:42:12.376 127.0.0.1:54321       31865  main      INFO: Watchdog Build git hash: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: Watchdog Build git describe: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: Watchdog Build project version: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: Watchdog Built by: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: Watchdog Built on: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: XGBoost Build git branch: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: XGBoost Build git hash: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: XGBoost Build git describe: (unknown)
11-22 10:42:12.377 127.0.0.1:54321       31865  main      INFO: XGBoost Build project version: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: XGBoost Built by: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: XGBoost Built on: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: KrbStandalone Build git branch: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: KrbStandalone Build git hash: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: KrbStandalone Build git describe: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: KrbStandalone Build project version: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: KrbStandalone Built by: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: KrbStandalone Built on: (unknown)
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: Processed H2O arguments: [-name, H2O_started_from_R_datascience_msi886, -ip, localhost, -web_ip, localhost, -port, 54321, -ice_root, /tmp/RtmpooR6rF]
11-22 10:42:12.378 127.0.0.1:54321       31865  main      INFO: Java availableProcessors: 4
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: Java heap totalMemory: 121.0 MB
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: Java heap maxMemory: 1.73 GB
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: Java version: Java 1.8.0_181 (from Oracle Corporation)
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: JVM launch parameters: [-Dsys.ai.h2o.debug.allowJavaVersions=11, -ea]
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: OS version: Linux 3.10.0-862.14.4.el7.x86_64 (amd64)
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: Machine physical memory: 7.80 GB
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: X-h2o-cluster-id: 1542879731843
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: User name: 'datascience'
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: IPv6 stack selected: false
11-22 10:42:12.379 127.0.0.1:54321       31865  main      INFO: Possible IP Address: ens160 (ens160), fe80:0:0:0:250:56ff:feb4:1f23%ens160
11-22 10:42:12.380 127.0.0.1:54321       31865  main      INFO: Possible IP Address: ens160 (ens160), 10.0.1.110
11-22 10:42:12.380 127.0.0.1:54321       31865  main      INFO: Possible IP Address: lo (lo), 0:0:0:0:0:0:0:1%lo
11-22 10:42:12.380 127.0.0.1:54321       31865  main      INFO: Possible IP Address: lo (lo), 127.0.0.1
11-22 10:42:12.380 127.0.0.1:54321       31865  main      FATAL: On localhost/127.0.0.1 some of the required ports 54321, 54322 are not available, change -port PORT and try again.
[1] "localhost"
[1] 54321
[1] FALSE
[1] 503
[1] ""

但是这很奇怪,因为在运行所有这些之前,我验证了指定的端口可用。我非常绝望,希望您能提供帮助。

谢谢

更新

所以我设法跑步了。我跌倒了

11-22 10:42:12.380 127.0.0.1:54321       31865  main      FATAL: On localhost/12                                                                                                                                                             7.0.0.1 some of the required ports 54321, 54322 are not available, change -port                                                                                                                                                              PORT and try again.

并运行/home/datascience/.checkpoint/2018-11-20/lib/x86_64-redhat-linux-gnu/3.5.1/h2o/java ,我发现实例在端口54323下运行。 然后我回到R并运行

java -jar h2o.jar

成功了。但为什么??我关闭了所有内容,然后重新打开它,使工作正常的唯一方法是运行 h2o.init(ip='machine_ip',port=54321,max_mem_size='2g',startH2O=FALSE) ,然后转到R会话并运行java -jar h2o.jar

2 个答案:

答案 0 :(得分:2)

h2o.init()将查找现有的h2o实例。因为您是用“ java -jar h2o.jar”手动启动的,所以h2o.init()找到了并连接了它。

如果您未指定IP地址,并且h2o.init()找不到已经在运行的h2o实例,那么如果startH2O为true,则h2o.init()会尝试创建一个。显示端口54321或端口54322不可用的消息恰恰表明了这一点。即使不是您想要的,也必须采取其中之一。使用“ netstat -anp”来诊断Linux上的端口使用情况。

答案 1 :(得分:1)

好吧,我找到了在公司工作的软件工程师的解决方案。

他只是简单地编写了一个bash,将其命名为“ java -jar h2o.jar”,它可以手动启动h2o集群,并且在R脚本中,我通过此脚本连接到现有的h2o实例

h2o.init(ip="machine_ip",port=number_port,startH2O=FALSE)