Setting Up R Server
To integrate Birst with R, first you set up an R Server. R Server is an extension package to any R instance that allows it to integrate with other applications. This allows Birst to integrate with small R instances and large ones using the same mechanism. It also allows users to utilize their native R environment when using it with Birst. This is different from other solutions that embed pieces of R inside the infrastructure, but as a result, do not allow the full leveraging of R.
A convenient server to use is the R Studio Server on Amazon AWS (Amazon Web Services). R Studio Server is an open source R implementation with support that can be purchased. It provides a full web-based client and can be run from Amazon AWS. You can search the publicly available AMIs (Amazon Machine Images) for “RStudio”. See the following link for information on how to set this up: http://www.louisaslett.com/RStudio_AMI/.
Once this AMI is running, you need to connect via SSH and create the Rserv.conf configuration file. You must also ensure that the default port of 6311 is opened via Amazon’s security groups. In general, you will want ports 80 (for HTTP), 22 (for ssh) and 6311 (for Rserver) open.
For example, a screen shot of R Studio Server from a browser Interface:
Installing R Server in your R instance only needs to occur once.
To install R Server in an R instance
1. | At the R command
prompt, type the install command: install.packages("Rserve") |
2. | Start R Server
from within your R environment. Generally, it starts a background
process that exists until it is either terminated or the machine is rebooted.
Alternatively, see the R Server documentation for details on how to start
R Server from a command line. To start R Server from within the R environment, type the following: library(Rserve) Rserve(args="--no-save") |
3. | After installing R Server, SSH into your EC2 RStudio instance and create a rserv.pwd file within the /etc folder containing your user credentials. |
Tip: Assuming the
AMI you launched is Ubuntu, your SSH command will be similar to the following.
You'll need to provide the file path to your amazon private key (*.pem)
which you had specified during your EC2 RStudio Launch Instance Configuration.
chmod 400 <yourkey>.pem
ssh -i <yourkey>.pem ubuntu@<yourRStudioPublicIPAddress>
sudo su
cd /etc
vi rserv.pwd
Using vi, you can enter in your username and password on a single line
separated by a space. For example,
ruser ruser. Press the <esc> key and type
:wq to save the file.
4. | After installing
R Server, configure the Rserv.conf configuration file that by default
is located in the /etc folder. If the file does not exist, create it with
the following entries: remote enable auth required plaintext disable pwdfile /etc/rserv.pwd encoding utf8 |