Categories

Versions

You are viewing the RapidMiner Legacy documentation for version 9.9 - Check here for latest version

Run RapidMiner Server as a service

You can run RapidMiner Server as a service, so that it will start automatically when the system starts. The method depends on your operating system:

Creating a service on Windows

You had an opportunity, at installation, to register RapidMiner Server as a Windows service (by checking a box in the installer process). If you did not check Register as a service or you did not have admin privileges when you started the installer, RapidMiner Server is not registered to run as a service. To change the configuration so that RapidMiner Server runs as a service in the future:

  1. As administrator, open a Windows command prompt.

  2. From the terminal window, change to the bin folder in your RapidMiner Server installation folder.

  3. Enter service.bat install at the prompt. This installs RapidMiner Server as a Windows service. (To uninstall the service later, enter service.bat uninstall from the same location.)

  4. By default, the service is registered with the key RMS<version>SVC (for example RMS710SVC or RMSSVC in case of older versions than 7.1.0). (This can be modified in the service.bat file.) To start the service from a Windows command prompt, enter the following command with the service name. For example:

     net start RMS710SVC
    

    Similarly, to stop the service, enter:

     net stop RMS710SVC
    

Alternatively, you can use the Windows control panel to set, start, and monitor the service.

Creating a service on Linux

A modern Linux distribution will use systemd to start and stop services, but if you are still using SysVinit, see the link below.

You can autostart RapidMiner Server under UNIX, but the method is dependent on your UNIX distribution. The following instructions apply to Ubuntu.

Linux system startup scripts are contained in /etc/init.d/. To start RapidMiner Server when an Ubuntu system boots, follow these steps:

  1. Download the file rapidminerserver.sh to your computer and open it in an editor:

     \#!/bin/bash
     \### BEGIN INIT INFO
     \# Provides:          rapidminerserver
     \# Required-Start:    $local_fs $remote_fs $network $syslog
     \# Required-Stop:     $local_fs $remote_fs $network $syslog
     \# Default-Start:     3 4 5
     \# Default-Stop:      0 1 2 6
     \# Short-Description: Start/Stop RapidMiner Server
     \### END INIT INFO
     \# chkconfig: 345 85 15
    
     RAPIDMINER-SERVER_HOME=/opt/rapidminer-server-2
     RAPIDMINER-SERVER_USER=root
    
     case "$1" in
         start)
             echo "Starting RapidMiner Server..."
             start-stop-daemon --start --quiet --background --chuid ${RAPIDMINER-SERVER_USER} --exec ${RAPIDMINER-SERVER_HOME}/bin/standalone.sh
         ;;
         stop)
             echo "Stopping RapidMiner Server..."
             start-stop-daemon --start --quiet --background --chuid ${RAPIDMINER-SERVER_USER} --exec ${RAPIDMINER-SERVER_HOME}/bin/jboss-cli.sh -- --connect --command=:shutdown
         ;;
         *)
             echo "Usage: /etc/init.d/rapidminerserver {start|stop}"; exit 1;
         ;;
     esac
    
     exit 0
    
  2. Change the RAPIDMINER-SERVER_USER variable to the Linux user who will run the service. The user you enter must already exist. To create the user, use the useradd command.

  3. Change the RAPIDMINER-SERVER_HOME variable to point to your RapidMiner Server installation.

  4. Save the script file as /etc/init.d/rapidminerserver.

  5. Make the script file executable by calling:

     chmod 755 /etc/init.d/rapidminerserver
    
  6. To configure Ubuntu to execute the script at boot time and shutdown, call:

     chkconfig --add rapidminerserver
    

In what follows, we describe the procedure for creating a RapidMiner service on Linux, with systemd. The following 3 files should be placed by root in /etc/systemd/system/:

  • rapidminer-server.service
  • rapidminer-jobagent-template.service
  • rapidminer-scoring-agent.service

If RapidMiner Server, the Job Agent, and the Real Time Scoring agent all live on the same host, then the latter two scripts are dependent on the first script, and should be started after RapidMiner Server has been started, as indicated by the following line:

After=rapidminer-server.service

In practice, your setup may be somewhat different. If the Job Agent is not on the same host as RapidMiner Server, then the line above should remain commented out in rapidminer-jobagent-template.service. If you do not have a Real Time Scoring agent, then you will have no need for the third script.

In any case, you must customize the scripts to match your setup, by modifying the path to the executables, and by correctly identifying the user and group connected with each of the services.

You may also want to set the Restart option to on-failure or always. Setting Restart=on-failure is the recommended choice for long-running services, in order to increase reliability by attempting automatic recovery from errors.

Restart=on-failure

For additional information, see the systemd service documentation.

rapidminer-server.service

If your database server is on the same host as RapidMiner Server, the script should include an After statement, with the name of the service for that database. For example, if your database server is on the same host and it is running PostgreSQL, you would uncomment the line that says After=postgresql.service.

[Unit]
Description=RapidMiner Server
After=network.target

# If your database server is on the same host, enter it's unit name here
# to make sure that RM Server is started after it.
#After=postgresql.service

[Service]
Type=simple

# Change the desired system user and group to start the service as
User=rapidminersrv
Group=rapidminersrv

# Change the path to your RapidMiner Server installation
ExecStart=/opt/rapidminer-server/bin/standalone.sh

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Restart= on-failure | always
#Restart=on-failure

[Install]
WantedBy=multi-user.target

rapidminer-jobagent-template.service

[Unit]
Description=RapidMiner Job Agent template

# If the Job Agent is on the same host as RapidMiner Server,
# uncomment the following line
#After=rapidminer-server.service

[Service]
Type=simple

# Change the desired system user and group to start the service as
User=rmserver
Group=rmserver

# Change the path to your RapidMiner Server installation
ExecStart=/opt/rapidminer-job-agents/jobagent-path/bin/rapidminer-jobagent
ExecStop=/opt/rapidminer-job-agents/jobagent-path/bin/stop-job-agent

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Restart= on-failure | always
#Restart=on-failure

[Install]
WantedBy=multi-user.target

rapidminer-scoring-agent.service

[Unit]
Description=RapidMiner Scoring Agent

# If the Real Time Scoring agent is on the same host as RapidMiner Server,
# uncomment the following line
#After=rapidminer-server.service

[Service]
Type=simple

# Change the desired system user and group to start the service as
User=my_user
Group=my_group

# Change the path to your RapidMiner Scoring Agent installation
ExecStart=/opt/rapidminer-scoring-agent/bin/rapidminer-scoring-agent

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Restart= on-failure | always
#Restart=on-failure

[Install]
WantedBy=multi-user.target