Where is the Rserve Config file located on Windows?

依然范特西╮ 提交于 2019-12-04 14:44:14

问题


I'm using a Windows 7 x64 machine with R-3.1.0. I installed the Rserve package through Rstudio.

The start of Rserve is successful with the following code in Rstudio:

library(Rserve)
Rserve()

I got the following output:

Starting Rserve...
"C:\R\R-31~1.0\library\Rserve\libs\x64\Rserve.exe" 

My problem is that I couldn't locate the configuration file. Apparently it can't be "/etc/Rserv.conf".

I did come across a webpage saying that the config file is Rserv.cfg in the working directory (unless changed at compile-time). But which working directory? I have checked the working directory of the current R project as well as the Rserve library directory, but it was not there...Could someone help me with this please? Thank you.


回答1:


Rserve does not automatically come with a config file, you must make one. Best steps for doing so:

  1. Navigate to the file where you just installed Rserve.exe (C:\R\R-31~1.0\library\Rserve\libs\x64\R, based on the message you copied here)
  2. Find Rserve.exe, Reserve_d.exe, and Rserve.dll there. Copy these files.
  3. Navigate to where R.dll is on your computer. This is probably C:\Program Files\R\R-3.1.3\bin\x64, but may be different depending on where you installed R to.
  4. Copy the 3 files mentioned above to this location.
  5. Create a text file here named "Rserv.cfg" with the arguments you are looking for, such as port 6312 or library(mvoutlier). Yes, I know that this is different from the documentation, but if you start Rserve_d.exe you will see that this is the file it is looking for. I have not had success naming it anything else.



回答2:


You can start Rserve by specifying the location of the config file. In R instead of just Rserve() try the following:

Rserve(args="--RS-conf C:\\folder\\Rserv.cfg")

If path is more complicated you need to massage it a little bit:

Rserve(args="--RS-conf C:\\PROGRA~1\\R\\R-215~1.2\\library\\Rserve\\Rserv.cfg")



回答3:


Look in the $RHOME/bin directory

If you can't find it here is a different way to approach it:

  1. Download Rserve at [http://rforge.net/snapshot/Rserve_.tar.gz], and save it in your desired directory
  2. Run R CMD INSTALL Rserve_.tar.gz

This allows you to leave Rserve where you want it.




回答4:


After looking at the Rserve source code and making some test I found that on Windows platform Rserve try to load the configuration file from the current working directory. Also pay attention because on Windows the file name is RServ.cfg and not Rserv.conf as documented.

The current working directory depends of the process, for example using RStudio by default it is your Documents and Settings folder:

C:\Users\[username]\Documents

but can be changed in the "Global Options" of the IDE

So you can create an "RServ.cfg" text file in that directory with your needed options and starting RServe in the usual way in RStudio

Rserve()

will load your configuration.



来源:https://stackoverflow.com/questions/24150959/where-is-the-rserve-config-file-located-on-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!