You are here: Deprecated Documentation > Deprecated Features > Creating Databases Using NuoDB Manager

Creating Databases Using NuoDB Manager

NuoDB allows the user to create two types of databases, Managed and Unmanaged. Managed databases are enforced meaning if database process count or type falls out of policy as defined by their template, then the system will attempt to restart (or shutdown processes) to meet the policy specified. The NuoDB CREATE DATABASE command is used to create a Managed database, and Managed databases have been deprecated.

Unmanaged

The recommended approach is to create unmanaged or unenforced databases. For more about the recommended approach, see Creating Your First Database and Upgrading Your First Database to Be Minimally Redundant, followed by the Start Process command with its accompanying options.

Managed

The NuoDB Manager create command will ask for information about the database you want to create.

Below, we create a database called test using the Single Host template. We accept all defaults where possible:

nuodb [domain] > create database
Database Name: test
DBA User: dba
DBA Password: dba
Template Name (Single Host, Minimally Redundant, Multi Host, Geo-distributed): Single Host
Template Variables (optional): 
Database Options (optional): 
Timeout (ms/s/m/h/d/w) (optional): 
Template Variable HOST (default: localhost): 52.24.143.83
Database Options for SMs (optional): 
Tag Constraints for SMs (optional): 
Database Options for TEs (optional): 
Tag Constraints for TEs (optional): 

First Steps

The create database command will then ask for a database name, a DBA username and a DBA password.

Example:

Database Name: test  
DBA User: dba  
DBA Password: dba   

Template

NuoDB Manager will ask you for a template.

Example:

Template Name (Single Host, Minimally Redundant, Multi Host, Geo-distributed): Single Host  

This should be entered exactly as one of the following four strings (case-sensitive):

Single Host
Minimally Redundant
Multi Host
Geo-distributed

Template Variables

NuoDB Manager allows you to enter arbitrary template variables including more than just SM_MIN, SM_MAX, TE_MIN and TE_MAX. If you look at the template source (see Viewing Templates), you will see other template variables, some with defaults and some not. Template variables are designated by an initial dollar sign ("$") followed by an open bracket ("{"), a template variable name, an option colon (":") and default value, and a close bracket ("}"). For example, let's look at the template for Single Host:

nuodb [domain] > show template
Template Name (optional): Single Host
Output File (optional): 
{
   "name": "Single Host",  
   "version": 5,
   "summary": "This template starts one Storage Manager and one Transaction Engine
      on a host that you specify. These processes will be fixed to that host and 
      will not be moved if that host goes offline.",
   "options": {
     "commit": "${COMMIT:remote:1}",   
     "backoff.reqMinUptime":"30000"
   },			
   "requirements": [
     {
       "processes": [
         {
           "name": "SMs",
           "type": "SM",
           "host": "${HOST}",
           "options": {},
           "tags": { }
         },
         {
           "name": "TEs",
           "type": "TE",
           "host": "${HOST}",
           "options": {},
           "tags": {}"
         } ]
    } ]
}

In particular, look at the options section:

"options": {
     "commit": "${COMMIT:remote:1}",   
     "backoff.reqMinUptime":"30000"
   },

This corresponds to the database options that NuoDB Manager requests. COMMIT is a template variable and has a default value of "remote:1". If the template variable is not overridden by the user when NuoDB Manager prompts for template variables, these defaults are used. The COMMIT variable is used to specify the commit database option commit. See Database Options for more information.

Note: Precedence of Database Options and Template Variables: Template variables are resolved before database options and process group options are set. So any database option setting will override any template variable that applies to a database option (like COMMIT ). As stated above, any process group option setting will override any database option setting.

See also: About Template Variables

Process Scale-out Requirements

Process scale-out requirements, in NuoDB Manager, are specified with the template variables SM_MIN, SM_MAX, TE_MIN, and TE_MAX. Template variables should be specified as key/value pairs separated by a space and multiple template variables (key/value pairs) should also be separated by a space.

Example:

Template Variables (optional):  SM_MIN 2 SM_MAX 2

In this example, we are setting the requirement that there be at least two and no more than two SMs for the database. Note: The enforcer will start a maximum of one TE and one SM per database per host.

Default Database Options

When prompted for database options by NuoDB Manager, the user may specify one or more options as key/value pairs. These options will apply to all processes in the database. Each key/value pair should be separated by a space and multiple database options (key/value pairs) should also be separated by a space.

Example:

Database Options (optional): commit remote:1 mem 2g

Timeout

Specify a timeout variable such that the operation will be cancelled if the database is not created within the specified number of milliseconds. This is governed by the NuoDB Manager createTimeout property which by default is 10000 ms.

Example:

Timeout (ms/s/m/h/d/w) (optional): 1m

Specify that the operation should be canceled if it takes more than one minute.

Host and Region

When creating a Single Host database, you will be prompted for HOST (default: localhost) if you did not specify one for Template Variables. When creating a Minimally Redundant or Multi Host database, you will be prompted for REGION (default: DEFAULT_REGION) if you did not specify one for Template Variables.

Example:

Here the required HOST template variable was specified, so we do not get prompted for it:

nuodb [domain] > create database
Database Name: test
DBA User: dba
DBA Password: dba
Template Name (Single Host, Minimally Redundant, Multi Host, Geo-distributed): Single Host
Template Variables (optional): HOST 52.24.143.83
Database Options (optional): 
Timeout (ms/s/m/h/d/w) (optional): 
Database Options for SMs (optional): 
Tag Constraints for SMs (optional): 
Database Options for TEs (optional): 
Tag Constraints for TEs (optional): 

And here the opposite is true:

nuodb [domain] > create database
Database Name: test
DBA User: dba
DBA Password: dba
Template Name (Single Host, Minimally Redundant, Multi Host, Geo-distributed): Single Host
Template Variables (optional): 
Database Options (optional): 
Timeout (ms/s/m/h/d/w) (optional): 
Template Variable HOST (default: localhost): 52.24.143.83
...

Process Group Database Options

When prompted for process group database options by NuoDB Manager, again you may specify one or more options as key/value pairs. You will be prompted for process group database options for each group (SMs and TEs) in each region. Each key/value pair should be separated by a space and multiple database options (key/value pairs) should also be separated by a space.

Example:

Database Options for SMs (optional): journal-max-directory-entries 500
Database Options for TEs (optional): verbose sql-statements

Note: Database Option Precedence: Process group options take precedence over default database options. For more information about precedence of Database Options see, Precedence for Database Process Options.

Host Tag Constraints

Host tag constraints are specified in NuoDB Manager per process group, per region. For each process group (TEs and SMs) in each region, the user will be prompted for tag constraints. The example below shows how to set these to TestDatabase a:

Example:

Tag Constraints for SMs (optional): TestDatabase ex:
Tag Constraints for TEs (optional): TestDatabase ex:

For more information on NuoDB Manager, visit NuoDB Manager.