Installing the R Connector

The R Server/R Connector is an open-source library that provides Team Studio access to open-source R.

The R-Server Connector for Team Studio is an optional package available for download and designed to run on a separate server to provide interoperability with R. Contact Team Studio Support for the latest version of the R Connector for Team Studio package.

Perform this task on a server in your Team Studio environment.

Note: You can configure the R Connector to use TIBCO® Enterprise Runtime for R (TERR™). For detailed instructions, see the article on the TIBCO Community site. Using TERR with Team Studio is currently untested and unsupported.

Prerequisites

  • Oracle 64-bit Java 1.8 or higher must be installed. (The JRE is adequate; the entire JDK is not required.)
  • You must be the root user to run the installation commands.
  • The R Connector for Team Studio consists of an R-side and a Java-side component, and the two components must reside on the same computer on which R is running.
  • The R Connector for Team Studio requires a CentOS or RedHat operating system running on a 50GB server.
    Note: Windows servers are not supported.
    Caution: The Team Studio Web Server does not run on the same computer as the R Connector for Team Studio.
  • Port 6311 must be accessible at least on the localhost of the machine running the R Connector. See Port 6311 for more information.
  • Dedicate a separate directory to the unpacked components.
  • Additional prerequisites are described in R Execute Prerequisites.

Procedure

  1. Download the R Connector binary from the SDS-R-Connector Github repository.
  2. Unpack the R Connector archive in the dedicated directory you specified using the following code.
    $tar xvf TIB_sfire-dscr_ver-#_linux_x86_64.tar
    where ver-# is the product version you are running (for example, 6.5.0).
    The unpacked components are in the specified directory, along with the original archive.
    Important: Do not delete any unpacked components; otherwise, the services will fail to start.
  3. Review the unpacked components in the current directory, along with the original archive.
    $ls
      
    prepare_services.sh alpine-r-connector.jar  start_services.sh   prepare_r_component.R   Rserve_1.7-3.tar.gz stop_services.sh
    application.conf    start_r_component.R
  4. Run the prepare_services script.
    The prepare script installs the R-side native component (if it is not already installed).
    ./prepare_services.sh
  5. Run the start_services script.
    The start script will start the R-side service (if it is not already started) and start the Java-side service (if it is not already started).
    ./start_services.sh
    If the start-up succeeds, you see something like the following.
    Welcome to the R Server for  Data Science Team Studio 
    Checking if R is installed.
    Starting the R-side Rserve component of the service.
    The log of the R-side component will can be
    found in start_R_component.Rout 
    R-side service started.
    Starting Java-side service. Its log will be
    found in AlpineRConnector.log
    Done - check start_R_component.Rout and AlpineRConnector.log
    if you are experiencing problems.
  6. Verify that the R-side component is running by checking for the Rserve processes.
    There are N +1 such processes, where N is the number of R workers selected.

    You can modify this choice before starting the services.

    1. Open the file application.conf.
    2. Modify the parameter numActors.
      This setting should be consistent with the number of cores (real or in the case of a VM, virtual) on the computer. The default is 10, for a total of 11 processes.
    ps -ef | grep Rserve
    rstudio  3911  1 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3968 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3969 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3970 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3971 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3972 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3973 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3974 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3975 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3976 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3977 3911 0 15:22 ?  00:00:00 /usr/lib64/R/library/Rserve/libs//Rserve --no-save
    rstudio  3979 2149 0 15:22 pts/0 00:00:00 grep Rserve
    On most systems, you can simply check the number of the Rserve processes to get a more terse output.
    $pidof Rserve | wc -w
     
    11
  7. If you have only the JRE (and not the JDK), check the Java service with the following code from the command line.
    $ps -ef | grep alpine-r-connector.jar
    rstudio 3913  1 1 15:22 pts/0 00:00:05 java -Xmx4096M -Xms1024M -XX:MaxPermSize=512M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dconfig.file=./application.conf -jar ./alpine-r-connector.jar
  8. Optional: To troubleshoot problems, check start_r_component.Rout and AlpineRConnector.log by printing them to the screen. See the following for an example.
    $cat AlpineRConnector.log
      
    Java version 1.8 is OK 
    Checking if chosen port 2553 is free
    Port is free - starting actor system
    [INFO] [10/31/2014 12:37:05.497] [main] [Remoting] Starting remoting
    [INFO] [10/31/2014 12:37:05.846] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://rServeActorSystem@10.0.0.180:2553]
    [INFO] [10/31/2014 12:37:05.880] [rServeActorSystem-akka.actor.default-dispatcher-2] [akka://rServeActorSystem/user/master]
    Starting RServeMaster
    [INFO] [10/31/2014 12:37:05.883] [rServeActorSystem-akka.actor.default-dispatcher-2] [akka://rServeActorSystem/user/master]
    Number of expected R workers = 4
      
    ...
    Note: The R Connector start-up script (start_services.sh) is idempotent; that is, running the script a second time does not cause anything else to fail. The services are already started, so both logs simply say that the ports are already taken, and no additional R-side (Rserve) or Java processes are started if the script gets run a second time.
  9. To stop the services (Rserve native processes and the Java process), at the command line, type the following code.
    ./stop_services.sh