Create a database
Use the influxctl database create
command
to create a database in your InfluxDB cluster.
If you haven’t already, download and install the
influxctl
CLI.Run the
influxctl database create
command and provide the following:- Optional: Database retention period (default is infinite)
- Optional: Database table (measurement) limit (default is 500)
- Optional: Database column limit (default is 250)
- Optional: InfluxDB tags to use in the partition template
- Optional: InfluxDB tag buckets to use in the partition template
- Optional: A Rust strftime date and time string
that specifies the time format in the partition template and determines
the time interval to partition by (default is
%Y-%m-%d
) - Database name (see Database naming restrictions)
InfluxDB Clustered supports up to 7 total tags or tag buckets in the partition template.
influxctl database create \
--retention-period 30d \
--max-tables 500 \
--max-columns 250 \
--template-tag tag1 \
--template-tag tag2 \
--template-tag-bucket tag3,100 \
--template-tag-bucket tag4,300 \
--template-timeformat '%Y-%m-%d' \
DATABASE_NAME
- Retention period syntax
- Database naming restrictions
- InfluxQL DBRP naming convention
- Table and column limits
Retention period syntax
Use the --retention-period
flag to define a specific
retention period
for the database.
The retention period value is a time duration value made up of a numeric value
plus a duration unit.
For example, 30d
means 30 days.
A zero duration (0d
) retention period is infinite and data won’t expire.
The retention period value cannot be negative or contain whitespace.
Valid durations units include
- m: minute
- h: hour
- d: day
- w: week
- mo: month
- y: year
Example retention period values
0d
: infinite/none3d
: 3 days6w
: 6 weeks1mo
: 1 month (30 days)1y
: 1 year30d30d
: 60 days2.5d
: 60 hours
Database naming restrictions
Database names must adhere to the following naming restrictions:
- Cannot contain whitespace, punctuation, or special characters.
Only alphanumeric, underscore (
_
), dash (-
), and forward-slash (/
) characters are permitted. - Should not start with an underscore (
_
). - Maximum length of 64 characters.
InfluxQL DBRP naming convention
In InfluxDB 1.x, data is stored in databases and retention policies. In InfluxDB Clustered, databases and retention policies have been merged into databases, where databases have a retention period, but retention policies are no longer part of the data model. Because InfluxQL uses the 1.x data model, a database must be mapped to a v1 database and retention policy (DBRP) to be queryable with InfluxQL.
When naming a database that you want to query with InfluxQL, use the following naming convention to automatically map v1 DBRP combinations to an InfluxDB Clustered database:
database_name/retention_policy_name
Database naming examples
v1 Database name | v1 Retention Policy name | New database name |
---|---|---|
db | rp | db/rp |
telegraf | autogen | telegraf/autogen |
webmetrics | 1w-downsampled | webmetrics/1w-downsampled |
Table and column limits
In InfluxDB Clustered, table (measurement) and column limits can be
configured using the --max-tables
and --max-columns
flags.
Table limit
Default maximum number of tables: 500
Each measurement is represented by a table in a database. Your database’s table limit can be raised beyond the default limit of 500. InfluxData has production examples of clusters with 20,000+ active tables across multiple databases.
Increasing your table limit affects your InfluxDB cluster in the following ways:
Column limit
Default maximum number of columns: 250
Time, fields, and tags are each represented by a column in a table. Increasing your column limit affects your InfluxDB cluster in the following ways:
Custom partitioning
InfluxDB Clustered lets you define a custom partitioning strategy for each database. A partition is a logical grouping of data stored in Apache Parquet format in the InfluxDB v3 storage engine. By default, data is partitioned by day, but, depending on your schema and workload, customizing the partitioning strategy can improve query performance.
Use the --template-tag
, --template-tag-bucket, and
–template-timeformat`
flags to define partition template parts used to generate partition keys for the database.
For more information, see Manage data partitioning.
Partition templates can only be applied on create
You can only apply a partition template when creating a database. You can’t update a partition template on an existing database.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.