# Create a real-time database

The real-time database (RDB) captures all the data from the tickerplant and stores it in memory. At the end of day event, it writes all its data to the HDB and reloads the HDB. To set up the RDB, provide it with the usual parameters and connect it to the message server, tickerplant and HDB. Most of the behavior in the RDB can be customized, but start by building a simple system.

To create an RDB, right-click on the Process Library folder in the dhtPackage and select New Process Instance from the context menu. Enter the process instance name (dhtRDB) and select the HDB template (DS_RDB) in the New Process Instance dialog. Then click Add.

As for other instances, the RDB will be configured.

In the Instance Details, provide a description for the instance.

The Shutdown Alerts subtab specifies what to do if the process shuts down either normally or unexpectedly. For the system, select No action for an expected shutdown, and Restart this instance for an unexpected shutdown - a basic level of resilience.

The Reserved Parameters subtab contains the general process configuration. The only two values in here that must be set are Host and Port. To make the system portable, reference environment variables. Set host to the fully qualified domain name of the host you are using. Set port to ENV=DELTACONTROL_PORT=+2003. This will start the RDB on the Kx Control port +2003.

Pick any available port

The example of +2003 is just a guide for incrementing port values to free ports (e.g. 2000, 2001, 2002).

The Instance Parameters subtab contains the template specific parameters. Associate the messaging server, tickerplant and HDB with the RDB.

1. Set the subscriptionChannel to tickerplant.
2. Set the messagingServer to the DS_MESSAGING_SERVER:dhtDMServer parameter.
3. Set the hdbProcess to dhtHDB.

In the Schema subtab, Associate the dhtSchemaGroup.

Save the process instance.

Run the process instance and check the partial log file for connections to the tickerplant and HDB.

Aside from checking the log file for errors, there are a few tests to run on the RDB. First, check the data is going to be written correctly to the HDB by the end-of-day job. From Kx Control open up Kx Analyst on the RDB process by right clicking and connecting to it.

Expand the tree view on the left hand side to view the tables.

Then, check the HDB directory has been correctly picked up by using the context menu on system "pwd" and displaying the results. This should give the same value as the directory parameter in dhtHDB. The results of displays are shown in the analyst console.

Finally, simulate the end-of-day job by running end 2000.01.01. This should write some empty tables and reload the HDB. Check the log file for errors, and check the directory structure directly on the Linux machine. Connect to the HDB process and expand the tree view. The currently available tables should be displayed.