LinDB on GitHub
  1. Developer Guide
  2. Create a database

Before begin

Make sure LinDB is running and Admin console is available at http://localhost:9000, if not please checkout the quick start.

Create a database

Database can be created via:

Admin console

Create or edit configuration of corresponding database

Create databaseCreate database

CLI

/*configuration in JSON format*/
create database {\"option\":{\"intervals\":[{\"interval\":\"10s\",\"retention\":\"30d\"},{\"interval\":\"5m\",\"retention\":\"3M\"},{\"interval\":\"1h\",\"retention\":\"2y\"}],\"autoCreateNS\":true,\"behead\":\"1h\",\"ahead\":\"1h\"},\"name\":\"system_monitor\",\"storage\":\"/lindb-storage\",\"numOfShard\":3,\"replicaFactor\":2}

Example: create a database named system_monitor, allocate 3 shards and 2 replicas to store in /lindb-storage storage cluster.

{
   "name":"system_monitor",
   "storage":"/lindb-storage",
   "numOfShard":3,
   "replicaFactor":2,
   "option":{
      "intervals":[
         {
            "interval":"10s",
            "retention":"30d"
         },
         {
            "interval":"5m",
            "retention":"3M"
         },
         {
            "interval":"1h",
            "retention":"2y"
         }
      ],
      "autoCreateNS":true,
      "behead":"1h",
      "ahead":"1h"
   }
}

Options

FieldDescription
nameRequired, database name
storageRequired, Storage cluster(Storage Namespace)
numOfShardRequired, number of shards
replicaFactorRequired, number of replicas for each shard
option.intervalsRequired, data storage calculation period and storage ttl, max length is 3(Day/Month/Year)
option.beheadHow long in the past data can be written
option.aheadHow long in the future data can be written
Previous
Connect