Data Directory Configuration

Set an external data directory to make upgrades easier

The data directory contains the web application configuration files, log files, and any other information generated during runtime. Each deployed application uses it's relative ./WEB-INF/config directory as the default data directory. This can be changed to a directory located outside of the deployed application directory by passing a Java option at startup, indicating the location for the data directory.

The main reason for setting the data directory outside of the deployed application is to preserve configuration settings when the application is re-deployed (due to an upgrade for example).

Data Directory Options

Each Kinetic Data application uses a unique Java option name to indicate the data directory. As stated previously, if the Java option is not defined, the deployed application will use it's relative ./WEB-INF/config directory by default.

Platform ComponentJava OptionDefault
Kinetic Request CE/Kinetic Platform-Dcom.kineticdata.core.dataDirectory<webapps>/kinetic/WEB-INF/config
Kinetic Task-Dcom.kineticdata.task.dataDirectory<webapps>/kinetic-task/WEB-INF/config
Kinetic Bridgehub-Dcom.kineticdata.bridgehub.dataDirectory<webapps>/kinetic-bridgehub/WEB-INF/config
Kinetic Filehub-Dcom.kineticdata.filehub.dataDirectory<webapps>/kinetic-filehub/WEB-INF/config
Kinetic Agent-Dcom.kineticdata.agent.dataDirectory<webapps>/kinetic-agent/WEB-INF/config

Setting the Data Directory

The data directory can be set by passing a Java option when the web server running the application starts. There are various ways to do this depending on the web server used, how it is configured, and what operating system it is running on.

We won't be able to cover every scenario, but will try to give examples of some of the more common configurations.

All of the following examples assume the Apache Tomcat web server is used. Also a placeholder APPLICATION variable is used in the name of the Java option. Just replace it with the corresponding Kinetic Platform Component you are configuring.

Linux / Unix Service

If you installed Tomcat with a package manager, it is likely installed to run as a service and the configuration files are typically located in the /etc directory.

You may need to reference your package manager documentation to locate the exact configuration file. The following instructions are assuming the configuration file location: /etc/tomcat/conf.d/tomcat.conf

  1. Open terminal
  2. Edit the /etc/tomcat/conf.d/tomcat.conf file, and add the data directory: export JAVA_OPTS=${JAVA_OPTS} -Dcom.kineticdata.APPLICATION.dataDirectory=/usr/local/kineticdata/APPLICATION
  3. Save the file and restart the Tomcat server

Windows Service

  1. Open command prompt, and cd to %TOMCAT_HOME%\bin
  2. Run the Tomcat Windows service manager program (tomcat8w.exe, tomcat9w.exe, etc...)
  3. Click on the Java tab
  4. Add the data directory to the Java Options input box on a new line (each property must be on a separate line) -Dcom.kineticdata.APPLICATION.dataDirectory="C:\usr\local\kineticdata\APPLICATION" where APPLICATION is replaced with the name of the application and the directory is where you opted to create that directory. Example: export CATALINA_OPTS="${CATALINA_OPTS} -Dcom.kineticdata.bridgehub.dataDirectory=/Users/chadrehm/kineticdata/bridgehub"
  5. Click apply
  6. Click on the General tab and restart the service

Tar / Zip Archive Configuration

If you installed Tomcat from a tar or zip archive file, it is likely not configured to run as a service. It is usually controlled using the startup.sh/shutdown.sh (or startup.bat/shutdown.bat for Windows) files located in the $TOMCAT_HOME/bin directory.

When the Tomcat web server starts up, it first checks if there is a setenv.sh file (setenv.bat for Windows) located in $TOMCAT_HOME/bin directory. If the file exists, Tomcat will load that file and include any configuration settings that are defined. Simply create the setenv.sh / setenv.bat file if it doesn't already exist.

Linux / Unix

  1. Open terminal and cd to $TOMCAT_HOME/bin
  2. If the setenv.sh file doesn't exist, create it and set executable permissions:
    touch setenv.sh && chmod +x setenv.sh
  3. Edit the setenv.sh file, and add the data directory: export JAVA_OPTS=${JAVA_OPTS} -Dcom.kineticdata.APPLICATION.dataDirectory=/usr/local/kineticdata/APPLICATION
  4. Save the file and restart the Tomcat server

Windows

NOTE: This method will not work if running Tomcat as a Windows service. Please see the instructions for configuring the Windows Service.

  1. Open command prompt and cd to %TOMCAT_HOME%\bin
  2. If the setenv.bat file doesn't exist, create it:
    type NUL > setenv.bat
  3. Edit the setenv.bat file, and add the data directory:
    set JAVA_OPTS=%JAVA_OPTS% -Dcom.kineticdata.APPLICATION.dataDirectory="C:\usr\local\kineticdata\APPLICATION"
  4. Save the file and restart the Tomcat server