Pikiwidb is a Redis-Compatible database developed by Qihoo's infrastructure team.
Pikiwidb is a Redis-Compatible database developed by Qihoo's infrastructure team.
| Stargazers Over Time | Contributors Over Time |
|---|---|
PikiwiDB is a high-performance, large-capacity, multi-tenant, data-persistent elastic KV data storage system using RocksDB as the storage engine. It is fully compatible with the Redis protocol and supports its commonly used data structures, such as string/hash/list/zset/set/geo/hyperloglog/pubsub/bitmap/stream, etc. Redis Interface.
When Redis's in-memory usage exceeds 16GiB, it faces problems such as limited memory capacity, single-threaded blocking, long startup recovery time, high memory hardware costs, easily filled buffers, and high switching costs when one master and multiple replicas fail. The emergence of PikiwiDB is not to replace Redis but to complement it. PikiwiDB strives to completely comply with the Redis protocol, inherit Redis's convenient operation and maintenance design, and solve the bottleneck problem of Redis running out of memory capacity once the data volume becomes huge by using persistent storage. Additionally, PikiwiDB can support master-slave mode using the slaveof command, and it also supports full and incremental data synchronization.
PikiwiDB can be deployed in a single-machine master-slave mode (slaveof) or in a Codis cluster mode, allowing for simple scaling and shrinking. Migration from Redis to PikiwiDB can be smoothly executed by tools.
PikiwiDB has been widely adopted by various companies for internal deployments, demonstrating its scalability and reliability. Some notable usage instances include:
Additionally, PikiwiDB is utilized by companies such as Xunlei, Xiaomi, Zhihu, New Oriental Education & Technology Group (好未来), Kuaishou, Sohu, Meituan, Maimai, and more. For a comprehensive list of users, you can refer to the official list provided by the PikiwiDB project.
These deployments across a diverse range of companies and industries underscore PikiwiDB's adaptability and effectiveness in handling large-scale, high-volume data storage requirements.
Users can directly download the latest binary version package from releases.
2.3.1. Get the source code
git clone https://github.com/OpenAtomFoundation/pikiwidb.git2.3.2. Switch to the latest release version
git tag # Check the latest release tag (e.g., v3.4.1)
git checkout TAG # Switch to the latest version (e.g., git checkout v3.4.1)2.3.3. Execute compilation
If the machine's gcc version is less than 9, especially on CentOS6 or CentOS7, you need to upgrade the gcc version first. Execute the following commands:
sudo yum -y install centos-release-scl sudo yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ scl enable devtoolset-9 bash
For the initial compilation, it is recommended to use the build script build.sh, which checks if the required software is available on the local machine.
./build.shNote: The compiled files will be saved in the output directory.
PikiwiDB is compiled by default in release mode, which does not support debugging. If debugging is needed, compile in debug mode.
rm -rf output/
cmake -B output -DCMAKE_BUILD_TYPE=Debug
cd output && makeOther components, such as codis, can also be compiled using build.sh.
# Compile codis, default target, build-all
./build.sh codis
# Compile codis, but only build codis-proxy
./build.sh codis codis-proxy
2.3.4. (Supplementary) Manual compilation based on Docker images
…* Ubuntu
Taking Debug Mode as an Example.… ./output/pika -c ./conf/pika.confIf you need to clear the compilation content, you can choose one of the following methods based on the situation:
Method 1: Clean only the current compilation content
cd output && make cleanMethod 2: Completely recompile
rm -rf output # regenerate cmakeModify the following configuration items of conf/pika.conf file:
log-path : /data/log/
db-path : /data/db/
db-sync-path : /data/dbsync/
dump-path : /data/dump/And then execute the following statement to start pika in docker:
docker run -d \
--restart=always \
-p 9221:9221 \
-v "$(pwd)/conf":"/pika/conf" \
-v "/tmp/pika-data":"/data" \
pikadb/pika:v3.3.6
redis-cli -p 9221 "info"If you want to build your own image, we provide a script build_docker.sh to simplify the process.
This script accepts several optional parameters:
-t tag: Specify the Docker tag for the image. By default, the tag is pikadb/pika:.-p platform: Specify the platform for the Docker image. Options include all, linux/amd64, linux/arm, linux/arm64. By default, it uses the current docker platform setting.--proxy: Use a proxy to download packages to speed up the build process. The build will use Alibaba Cloud's image source.--help: Display help information.Here is an example usage:
./build_docker.sh -p linux/amd64 -t private_registry/pika:latestdocker-compose.yaml
pikadb:
image: pikadb/pika:lastest
container_name: pikadb
ports:
- "6379:9221"
volumes:
- ./data/pika:/pika/log
# Specify the configuration file path. If you need to specify a configuration file, specify it here.
# Note: pika.conf should be in the ./deploy/pika directory
#- ./deploy/pika:/pika/conf
- ./data/pika/db:/pika/db
- ./data/pika/dump:/pika/dump
- ./data/pika/dbsync:/pika/dbsync
privileged: true
restart: alwaysNote: The test results were obtained under specific conditions and scenarios, and may not represent the performance in all environments and scenarios. They are for reference only.
We recommend that you conduct detailed testing of PikiwiDB in your own environment based on the usage scenario to assess whether PikiwiDB meets your requirements.
Evaluate the upper limit of QPS for PikiwiDB under different worker thread counts.
Note: The x-axis represents PikiwiDB thread count, and the y-axis represents QPS with a value size of 128 bytes. "set3/get7" indicates 30% s
No open issues yet, or sync has not completed.