-
Notifications
You must be signed in to change notification settings - Fork 22
Embedding Doradus In Another Application
[Table of Contents](https://github.com/dell-oss/Doradus/wiki/Doradus Administration: Table-of-Contents) | [Previous](https://github.com/dell-oss/Doradus/wiki/Best Practices) | [Next](https://github.com/dell-oss/Doradus/wiki/Deployment Guidelines)
Installing and Running Doradus: Embedding Doradus In Another Application
Some applications may want to embed Doradus in the same JVM process. One way to do this is to call the static `main` method, passing a `String[]` that provides runtime arguments. Example:
import com.dell.doradus.core.DoradusServer;
...
String[] args = new String[] {"-restport", "5711"};
DoradusServer.main(args);
This example overrides the doradus.yaml
parameter restport
, setting it to 5711
. When main()
is called, Doradus starts all internal services and the storage_services
configured in doradus.yaml
. However, main()
does not return until the process receives a shutdown signal (e.g., Ctrl-C or System.exit()
is called).
Alternatively, Doradus can be started with the method startEmbedded()
, which returns as soon as all internal services are initialized and started. This method accepts the same args
parameter as main()
plus a second String[]
that allows the selective initialization of services. Example:
String[] args = new String[] {"-restport", "5711"};
String[] services = new String[] {OLAPService.class.getName(), RESTService.class.getName()};
DoradusServer.startEmbedded(args, services);
This example also overrides the restport
parameter, and it starts Doradus with the OLAP storage service and the REST service. Other optional services, such as the Task Manager service, are not initialized. Regardless of the services requested, Doradus always initializes required internal services such as the DB service (persistence layer) and schema service. See the doradus.yaml
file for the list of optional services that may be requested through the services
parameter.
The full package name of each service must be passed in the services
parameter. At least one storage service must be initialized otherwise startEmbedded()
will throw a RuntimeException
. If multiple storage services are provided, the first one becomes the default for new applications created via the same Doradus instance that do not explicitly declare a storage service.
Note that multiple Doradus instances can be launched for the same Cassandra cluster with different service sets. For example, a direct-load application could embed Doradus, initializing only the storage service that it requires, while another stand-alone instance of Doradus can be executed with full services.
When Doradus is started with the startEmbedded()
method, it returns as soon as all requested services are initialized and running. Doradus can be gracefully shutdown by calling the shutDown
method. Example:
DoradusServer.shutDown(); // gracefully shutdown and return
Alternatively, Doradus can be gracefully shutdown and terminate the JVM process by calling stopServer
. Example:
DordusServer.stopServer(null); // gracefully shutdown and call System.exit()
The parameter passed to stopServer()
is a String[]
, but it is ignored.
Technical Documentation
[Doradus OLAP Databases](https://github.com/dell-oss/Doradus/wiki/Doradus OLAP Databases)
- Architecture
- OLAP Database Overview
- OLAP Data Model
- Doradus Query Language (DQL)
- OLAP Object Queries
- OLAP Aggregate Queries
- OLAP REST Commands
- Architecture
- Spider Database Overview
- Spider Data Model
- Doradus Query Language (DQL)
- Spider Object Queries
- Spider Aggregate Queries
- Spider REST Commands
- [Installing and Running Doradus](https://github.com/dell-oss/Doradus/wiki/Installing and Running Doradus)
- [Deployment Guidelines](https://github.com/dell-oss/Doradus/wiki/Deployment Guidelines)
- [Doradus Configuration and Operation](https://github.com/dell-oss/Doradus/wiki/Doradus Configuration and Operation)
- [Cassandra Configuration and Operation](https://github.com/dell-oss/Doradus/wiki/Cassandra Configuration and Operation)