我在Mac和Ubuntu上都尝试过很多选项。 我读了Rserve文档如何优雅地关闭Rserve?
http://rforge.net/Rserve/doc.html
并为Rserve和RSclient包:
http://cran.r-project.org/web/packages/RSclient/RSclient.pdf
http://cran.r-project.org/web/packages/Rserve/Rserve.pdf
我无法弄清楚什么是开了正确的工作流程/关闭在Rserve内部进行连接并优雅地关闭Rserve。例如,在Ubuntu中,我使用./config --enable-R-shlib(遵循Rserve文档)从源代码安装了R,并在/etc/Rserve.conf中添加了“控制启用”行。
在一个Ubuntu终端:
library(Rserve)
library(RSclient)
Rserve()
c<-RS.connect()
C## this is an Rserve QAP1 connection
## Trying to shutdown the server
RSshutdown(c)
Error in writeBin(as.integer....): invalid connection
RS.server.shutdown(c)
Error in RS.server.shutdown(c): command failed with satus code 0x4e: no control line present (control commands disabled or server shutdown)
我可以,但是,关闭连接:
RS.close(c)
>NULL
C## Closed Rserve connection
关闭连接后,我也尝试的选项(也试图与参数 'c' 的,即使连接关闭):
RS.server.shutdown()
RSshutdown()
所以,我的问题是:
1-如何优雅地关闭Rserve?
2- Can Rserve可以在没有RSclient的情况下使用吗?
我也看了
How to Shutdown Rserve(), running in DEBUG
但问题是指在调试模式,也没有得到解决。 (我没有足够的信誉来评论/询问关机是否在非调试模式下工作)。
在又看了:
how to connect to Rserve with an R client
非常感谢!
谢谢!所以,如果我理解正确,为了将R进程与Rserve实例连接起来,我必须使用RSclient,对吗?我还需要在Rserve中指定“args”命令(否则会出现致命错误),并且在使用debug = TRUE时,命令行会一直等待,并以“错误:无法与R会话建立连接”结束。因此,使用mac,只有debug = F选项似乎可以工作,并且我使用了system('ps aux | grep Rserve')[这会打开2个连接,并带有两个不同的ID ..]。非常感谢!! – user3570398 2014-10-17 19:08:09
这适用于Rserve(port = 6311,debug = FALSE,args =“ - no-save”)。谢谢! – user3570398 2014-10-17 19:16:10