# Overview

Pika is an open-source, high-performance, persistent NoSQL product that is compatible with the Redis protocol. It stores data persistently using the RocksDB storage engine and operates in two modes: Classic mode and Sharding mode.

  • Classic Mode(Classic): In Classic mode, also known as the 1-master-N-replicas synchronization mode, one main instance stores all the data, and N replica instances fully mirror the data from the main instance. Each instance supports multiple databases, and databases are indexed starting from 0. The maximum number of databases can be configured using the "databases" option in Pika's configuration. Physically, a database in Pika exists as a file directory.
  • Sharding Mode(Sharding): In Sharding mode, the user's stored data is referred to as a "Table," which is divided into multiple shards. Each shard is called a "Slot," and a hash algorithm determines which Slot a piece of data with a specific key belongs to. All Slots and their replicas are distributed across all Pika instances according to a specified strategy. Each Pika instance manages a portion of the main Slots and a portion of the replica Slots. In Sharding mode, the division is based on Slots rather than Pika instances. Physically, a Slot in Pika exists as a file directory.

Pika can be configured to operate in Classic or Sharding mode by setting the "instance-mode" option in the configuration file.

# 1. Classic (Master-Slave) Mode

# 2. Sharding Mode