Updating a topic

You can use the topic alter subcommand to update a previously created topic.

General format of the command:

ydb [global options...] topic alter [options...] <topic-path>

View the description of the update topic command:

ydb topic alter --help

Parameters of the subcommand

The command changes the values of parameters specified in the command line. The other parameter values remain unchanged.

Name Description
--partitions-count VAL The number of topic partitions. You can only increase the number of partitions.
--retention-period-hours VAL The retention period for topic data, in hours.
--supported-codecs STRING Supported data compression methods.
Possible values:
  • RAW: Without compression.
  • ZSTD: zstd compression.
  • GZIP: gzip compression.
  • LZOP: lzop compression.

Examples

Note

The examples use the db1 profile. To learn more, see Creating a connection profile.

Add a partition and the lzop compression method to the previously created topic:

ydb -p db1 topic alter \
  --partitions-count 3 \
  --supported-codecs raw,gzip,lzop \
  my-topic

Make sure that the topic parameters have been updated:

ydb -p db1 scheme describe my-topic

Result:

RetentionPeriod: 2 hours
PartitionsCount: 3
SupportedCodecs: RAW, GZIP, LZOP