Creating a Database

To create a database you must have created at least one archive for the database. For more information, see Creating an Archive.

You may create a database in the durable domain using the nuocmd create database command:

nuocmd create database --db-name <database name> --dba-user <username> --dba-password <password> --te-server-ids <server ID>

Example

The following command shows how to create a database named test, supplying credentials for the database administrator user.

nuocmd create database --db-name test \
   --dba-user dba --dba-password goalie \
   --te-server-ids nuoadmin-0 --default-options ping-timeout 60 mem 3g
STARTING: StartProcessRequest(archive_id=0, db_name=test, engine_type=SM, labels={}, options={}, server_id=nuoadmin-0)
STARTING: StartProcessRequest(db_name=test, engine_type=TE, labels={}, options={}, server_id=nuoadmin-0)
The nuocmd create database command invocation above specifies:
- The database name (test).
- The DBA user account name (dba).
- The DBA user account password (goalie).
- The starting of a TE on the host running NuoDB Admin Process (nuoadmin-0).
- Any TE and SM processes started for the database will have ping-timeout set to 60 seconds and memory set to 3 GB by default.
The nuocmd create database command also implicitly starts SMs on all archive objects in the domain state.

Verifying the Database Created

To confirm that your database is up and running and that the SM and TE processes have started, use the nuocmd show domain command.

nuocmd show domain
server version: 6.0-1-fc6a857de9, server license: Enterprise
server time: 2023-10-14T15:04:44.712, client token: f5c160bd10886bbec541707ffc832ab6e847e354
Servers:
  [nuoadmin-0] localhost:48005 [last_ack = 3.89] [member = ADDED] [raft_state = ACTIVE] (LEADER, Leader=nuoadmin-0, log=0/16/16) Connected *
Databases:
  test [state = RUNNING]
    [SM] nuodbits-MacBook-Pro-2.local/localhost:48006 [start_id = 0] [server_id = nuoadmin-0] [pid = 21975] [node_id = 1] [last_ack =  0.45] MONITORED:RUNNING
    [TE] nuodbits-MacBook-Pro-2.local/localhost:48007 [start_id = 1] [server_id = nuoadmin-0] [pid = 21976] [node_id = 2] [last_ack =  7.44] MONITORED:RUNNING