Search code examples
lucenecratedb

How to remove shards in crate DB?


I am new to crate.io and I am not very familiar with the term of "sherd" and I am trying to understand why when I am running my local db it creates 4 different shards?enter image description here

I need to reduce this to one single shard because it causes problems when I try to export the data from crate into json files (it creates 4 different shards!)


Solution

  • Most users run crate on multiple servers. To distribute the records of a table between multiple servers it needs to be splitted. One piece of that table is called shards.

    To make sure that the database still has records CrateDB by defaults create on replica of each shard. A copy of the data that is located on a different server.

    While the system doesn't have full copies of the shards the cluster state is yellow / underreplicated.

    CrateDB running on a single node will never be able to create a redundant copy (because it is only one server).

    To change the amount of replicas you can use the command ALTER TABLE my_table SET(number_of_replicas=...)