Running the Stardog Server
This page discusses running the Stardog Server.
Page Contents
Starting the Server
Stardog server is run via Docker. The simplest way to start the server is:
$ docker run -v ~/stardog-home:/var/opt/stardog -p 5820:5820 stardog/stardog
This mounts your Stardog home directory (containing your license and databases) and exposes port 5820.
To run in the background (detached mode):
$ docker run -d --name stardog -v ~/stardog-home:/var/opt/stardog -p 5820:5820 stardog/stardog
To bind to a custom port (e.g., 8080):
$ docker run -v ~/stardog-home:/var/opt/stardog -p 8080:5820 stardog/stardog
Server startup options can be appended to the docker run command. For example, to bind to a specific network interface:
$ docker run -v ~/stardog-home:/var/opt/stardog -p 5820:5820 stardog/stardog --bind 192.168.1.100
For more information on server startup options, see the server start man page. For Docker-specific configuration, see Docker setup.
Locking the Home Directory
Stardog server will lock STARDOG_HOME when it starts in order to prevent synchronization errors and other issues. This prevents running more than one Stardog server with the same STARDOG_HOME. If you need to run more than one Stardog server instance, choose a different STARDOG_HOME, or pass a different value to the --home option.
Do not manually delete the lock file. Please see the Administrating Stardog 101 section for more information about common pitfalls with the lock file.
Stopping the Server
To stop a running Stardog server:
$ stardog-admin server stop
By default, this stops a server running on localhost on the default port (5820). Use the --server option to specify a different URL.
For more information on the server stop command, see its man page.
Docker commands
If you started Stardog in the foreground, press Ctrl+C to stop the server.
If you started Stardog in detached mode, you can also use Docker commands:
$ docker stop stardog
You can find the container name or ID with docker ps.
Safe Mode to start the server
Safe mode helps users overcome initialization errors when starting the server. This feature ensures that the server may start up, even if there is an issue with a component. Safe mode should be a temporary fallback, only for starting servers which no longer start due to a misconfiguration. Safe mode is not supported with the HA Cluster. In a clustered environment, you must use safe mode on a single node. Once you finish making changes on one node, the other nodes may be restarted and sync from the healthy node.
Safe mode will do the following:
- Disable additional modules (all of them or those selected by the user) so the server can start
- Offline all databases, so they cannot be queried nor updated
- Allow changing of all mutable database options
- Change Data Source and Virtual Graph configurations
- Support user/role/permission changes
- Create a server backup as a precaution before making further changes, i.e.
stardog-admin server backup
Situations where one would use the Safe Mode include:
- A corrupted database prevents the start of the server
- Misconfigured virtual graph prevents server startup. This could include missing jars for drivers, etc.
- User info is corrupted and the Server fails to start
Enabling safe mode
Append the --safe option to the docker run command:
$ docker run -v ~/stardog-home:/var/opt/stardog -p 5820:5820 stardog/stardog --safe
Alternatively, add a property to the stardog.properties file in your Stardog home directory. After you have resolved the issue, remove this property to disable safe mode.
stardog.safe.mode=true