Creating a topic
You can use the topic create subcommand to create a new topic.
General format of the command:
ydb [global options...] topic create [options...] <topic-path>
global options: Global parameters.options: Parameters of the subcommand.topic-path: Topic path.
View the description of the create topic command:
ydb topic create --help
Parameters of the subcommand
| Name | Description |
|---|---|
--partitions-count |
The number of topic partitions. The default value is 1. |
--retention-period |
Data retention time in a topic. A positive number followed by a unit of time. The following units are supported:
18h. |
--partition-write-speed-kbps |
The maximum write speed to a partition, specified in KB/s. The default value is 1024. |
--retention-storage-mb |
The maximum storage size, specified in MB. When the limit is reached, the oldest data will be deleted. The consumed space may exceed the set value when autopartitioning is enabled. The default value is 0 (no limit). |
--supported-codecs |
Supported data compression methods. Set with a comma. The default value is raw.Possible values: |
--metering-mode |
The topic pricing method for a serverless database. Possible values:
|
Examples
Note
The examples use the quickstart profile. To learn more, see Creating a profile to connect to a test database.
Create a topic with 2 partitions, RAW and GZIP compression methods, message retention time of 2 hours, and the my-topic path:
ydb -p quickstart topic create \
--partitions-count 2 \
--supported-codecs raw,gzip \
--retention-period 2h \
my-topic
View parameters of the created topic:
ydb -p quickstart scheme describe my-topic
Result:
RetentionPeriod: 2h
PartitionsCount: 2
SupportedCodecs: RAW, GZIP
Was the article helpful?
Previous
Next