Introduction | |||||||||||||||||
Rserve itself is the server, that is a program that responds to requests from clients. It listens for any incoming connections and processes incoming requests. You need to have R-1.5.0 or higher installed on your system in order to be able to use Rserve. For details concerning installation and start of the server, see Installation futher down.
The server is nothing without clients, therefore we have developed three client frameworks:
| |||||||||||||||||
Installation | |||||||||||||||||
The easiest way to install Rserve is to use a source package for R. Please note that this works only for unix-based operating systems such as Linux, Solaris, AIX or Mac OS X. (There is currently a binary version available for Windows, see below.) Download the package file Rserve_0.4-3.tar.gz in the current directory. Login with enough privileges to add R packages and run:
R CMD INSTALL Rserve_0.4-3.tar.gz This should compile and install Rserve. You can check whether Rserve is installed correctly by looking in the $RHOME/bin directory - there should be a file called Rserve. If the compilation fails, please check that R shared library exists and is properly installed. It is located in $RHOME/bin and is named libR.so or libR.dylib. If it is missing, get an R distribution with shared library included or compile R with --enable-R-shlib configure flag. Windows: There is a binary version of Rserve in the download section. Copy the file to the directory containing R.DLL. If you have more versions of R, make sure that you use the one most recently installed, becasue Rserve detects the location of $RHOME from the registry. Although Rserve works on Windows it is not recommended to use it on that platform. Windows lacks important features that make the separation of namespaces possible, therefore Rserve for Windows works in cooperative mode only, that is only one connection at a time is allowed and all subsequent connections share the same namespace. Briefly: don't use Windows unless you really have to. There is a DCOM interface available for R, you may be better off with that solution. | |||||||||||||||||
Launching Rserve | |||||||||||||||||
Rserve is not really a package, therefore it is not used via library command, instead it is a program on its own. To start Rserve, run:
R CMD Rserve Depending on the purpose and libraries on your computer you may want to add --gui-none. Rserve passes any parameters to the underlying R engine except for Rserver-related parameters (see command line arguments). After initialization Rserve daemonizes itself to work as a server. It can be shut down gracefully (i.e. it will wait until all existing connections are finished) if it recieves shutdown command from an authorized connection. It terminates not so gracefully if it receives usual termination signals. If no config file is supplied, Rserve accepts no remote connections, requires no authentication and file transfer is enabled. For more details about how to configure Rserve, see below. | |||||||||||||||||
Configuration | |||||||||||||||||
Rserve is configured by the configuration file /etc/Rserv.conf (can be changed at compile time by specifying -DCONFIG_FILE=..). Additional configuration files can be added by the --RS-conf command line argument. The possible configuration entries are as follows (all entries are optional; default values are in angled brackets):
workdir <path> [/tmp/Rserv] (since version 0.1-9):
socket <socket> [none=disabled]
(since version 0.3:)
(since version 0.3-16:) Most entries are self-explaining and their command line equivalents are described below. maxinbuf and maxsendbuf are rather special. Previous versions of Rserve had fixed buffer sizes. Since 0.1-9 internal buffers change per-connection automatically. The maxinbuf specifies (in kilobytes) the maximal allowable size of the input buffer, that is the maximal size of data transported from the client to the server. Analogously maxsendbuf sets the maximum size of the send buffer, that is the size of data sent from Rserve to the client. If your server is likely to process very many parallel connections you may want to lower this setting for security reasons. On the other hand if the server will process only few connections in parallel and you expect very large data, raise the value accorsing to your computer's memory. Baiscally the settings are present to prevent malicious users from crashing your server by supplying too large data. 0 has a special meaning telling Rserve to allow unlimited use. uid and gid are supported on unix computers only. If Rserve is run as root user, then it switches the user/group to the specified uid/gid before starting the server. Note: The directives are processed in the same sequence in which they occur in the config file. This implies that if using both uid and gid, you MUST use gid first, otherwise if setting uid first, then the user will have no right to change gid anymore! A note about security: Anyone with access to R has access to the shell via "system" command, so you should consider following rules:
| |||||||||||||||||
Command line arguments | |||||||||||||||||
Starting with Rserve 0.1-9 special command line arguments are supported in addition to the config file. Normally Rserve passes all arguments to R, but several special ones are processed and removed from the list before initializing R. Those parameters override any settings specified in the config file.
R CMD Rserve --help |