【发布时间】:2018-04-28 11:58:20
【问题描述】:
-
我正在使用 cmd 从服务器机器运行 RServe
Rserve.exe --RS-conf Rserv.conf --RS-port 12306 -
Rserv.conf 文件有以下内容:
pwdfile RserveAuth.txt
需要身份验证
远程启用
明文禁用 -
RserveAuth.txt 有以下内容:
管理员 123456
-
我正在从 JAVA 连接到 R Server
import org.rosuda.REngine.REXPMismatchException; import org.rosuda.REngine.REngineException; import org.rosuda.REngine.Rserve.RConnection; import org.rosuda.REngine.Rserve.RserveException; import org.rosuda.REngine.REXP; import org.rosuda.REngine.*; public class ConnecttoR { ... ... public void connectR() { try { RConnection connection = new RConnection("172.16.33.242",12306); // Works if authentication is not required in Rserv.conf } catch (RserveException e) { e.printStackTrace(); } catch(REXPMismatchException e){ e.printStackTrace(); } catch(REngineException e){ e.printStackTrace(); } } } 到 Rserve 的连接对所有人开放,无需用户名和密码。如何添加安全性并仅允许使用有效凭据进行连接以访问 Rserve
【问题讨论】:
-
您的 RServer 好像在 Windows
Rserve.exe上,运行 [Windows、MacOSX、Linux] 的客户端用户是什么?您的生产 RServer 在 Windows 上吗?只是检查要求。 -
@Technophobe01 RServer 在 Windows 机器上,我的客户端可以是任何连接到它的 Windows/Linux/MacOSX。对 Rserver 的连接请求是从 JAVA 类发出的,后来我使用连接对象在 Rserve 上运行脚本并将脚本的输出传递给 JSP 页面。
-
仅供参考。 Windows 下的 RServe 版本是有限的。最重要的限制是“不支持并行连接,后续连接共享相同的命名空间”/“不支持会话 - 这是不支持并行连接的结果”。请参阅“下载/使用 Windows 版本的 Rserve 之前请阅读!”下的 rforge.net/Rserve/rserve-win.html
-
@AndreyBelykh 好点——你打败了我。我的感觉是,一种选择是通过 Windows Ubuntu 子系统运行 Rserve,然后通过 ssh 限制访问。
标签: java r windows tcp-ip rserve