Skip to content

Configuring Local Launcher Load Balancing in RStudio Server Pro#

RStudio Server Pro 1.4 - PREVIEW RELEASE

RStudio Server Pro version 1.4 is currently a preview release. We highly discourage you from upgrading your production environment with a preview release. Instead, we recommend using a sandbox environment to upgrade to the preview release of RStudio Server Pro major version 1.4.

Overview#

If your intended architecture involves multiple servers for RStudio Server Pro and you want to enable Jupyter Notebook/VSCode support without integrating with a resource manager, then you will have to configure local launcher load balancing. This document provides step-by-step procedures to achieve this architecture.

In this configuration we will:

  • Perform regular load balancing for RStudio Server Pro servers
  • Then, add additional configuration for load balancing the launcher extension

Prerequisites#

  • More than one RStudio Server Pro server with 1.4 and above
  • Postgres database
  • NFS share storage

Database Configuration#

When running RStudio Server Pro in a load balanced configuration, a Postgres database is required. You must create an empty database for RStudio Server to connect to and you must not share this database with other products or services.

Info

The minimum supported PostgreSQL version is 9.5.

  • In all the RStudio Server Pro servers in your cluster, update the /etc/rstudio/database.conf as:

    File: /etc/rstudio/database.conf
    # Note: when connecting to a PostgreSQL database, a default empty rstudio database must first be created!
    provider=postgresql
    
    # Specifies the host (hostname or IP address) of the database host
    host=localhost
    
    # Specifies the database to connect to
    database=rstudio
    
    # Specifies the TCP port where the database is listening for connections
    port=5432
    
    # Specifies the database connection username
    username=postgres
    
    # Specifies the database connection password. This may be encrypted with the secure-cookie-key.
    # The encrypted password can be generated using the helper command rstudio-server encrypt-password.
    # It is strongly recommended that you encrypt the password!
    password=postgres
    

Please make sure that this file is exactly the same on all servers. For more information, refer to the Database configuration section of RStudio Server Pro Admin guide.

Configuring load balancing at server level#

In order to fully load balance this RStudio Server Pro cluster, first you need to load balance the servers.

The details for configuring load balancing at the server level is provided in the Load Balancing section of the RStudio Server Pro Admin guide.

Configuring load balancing at launcher level#

After you have completed load balancing configuration at server level, please perform the following steps across each server instance in the cluster:

  • On all servers, make sure the local launcher section in /etc/rstudio/launcher.conf looks exactly the same. One sample configuration is:

    File: /etc/rstudio/launcher.conf
    [cluster]
    name=Local
    type=Local
    

  • Create a directory in your NFS shared storage and make rstudio-server as the owner:

    Terminal
    sudo mkdir -p {NFS-Share}/Local
    sudo chown rstudio-server {NFS-Share}/Local
    

    Note

    If your server-user is something other than rstudio-server, then please update the above command accordingly. Also, update the command if your cluster name is something other than Local.

  • Now on each server in the Server pro cluster:

    • Mount the path created above.
    • Edit the /etc/rstudio/launcher.local.conf to set the scratch-path variable as:

    File: /etc/rstudio/launcher.local.conf
    scratch-path={NFS-Share}/Local
    

  • Each local plugin node must be able to directly connect to the launcher service located on other nodes in the load-balanced cluster. Verify that the default port for the launcher (port 5559) on all servers is listening for incoming requests. You can use a command like this to test:

    Terminal
    curl -i myip.com:5559/status
    

    Note

    If you are using an external load balancer in your architecture for load balancing this RStudio Server Pro cluster, then we recommend using sticky sessions so as to maintain the most consistent view of the job state of the cluster.

  • Restart both rstudio-server and rstudio-launcher service on all servers.

    Terminal
    sudo rstudio-server restart
    sudo rstudio-launcher restart
    
    Additional details can be found in the Local Launcher Load Balancing section of the RStudio Job Launcher Admin guide.