Skip to content

Commit

Permalink
merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Rookie committed Mar 11, 2024
2 parents d5a18f5 + 0157f12 commit 2da2ec7
Show file tree
Hide file tree
Showing 218 changed files with 6,376 additions and 14,252 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/issue-translator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Issue Translator
on:
issue_comment:
types: [created]
issues:
types: [opened]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: usthe/[email protected]
with:
IS_MODIFY_TITLE: false
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically.
40 changes: 0 additions & 40 deletions .github/workflows/operator.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish_nightly_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
file: ./docker/Dockerfile_pika
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
file: ./docker/Dockerfile_pika
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ src/build_version.cc
build/
buildtrees
deps
pkg

#develop container
.devcontainer
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ elseif(${BUILD_TYPE} STREQUAL RELWITHDEBINFO)
else()
set(LIB_BUILD_TYPE RELEASE)
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -DNDEBUG")

endif()

if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
Expand Down Expand Up @@ -172,7 +171,6 @@ set(GTEST_INCLUDE_DIR ${INSTALL_INCLUDEDIR})
set(GTEST_MAIN_INCLUDE_DIR ${INSTALL_INCLUDEDIR})
set(GMOCK_INCLUDE_DIR ${INSTALL_INCLUDEDIR})


ExternalProject_Add(gflags
URL
https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.tar.gz
Expand Down
62 changes: 20 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Users can directly download the latest binary version package from [releases](ht
cd output && make
```
Other components, such as codis and pika_operator, can also be compiled using build.sh.
Other components, such as codis, can also be compiled using build.sh.
```bash
# Compile codis, default target, build-all
Expand All @@ -171,8 +171,6 @@ Users can directly download the latest binary version package from [releases](ht
# Compile codis, but only build codis-proxy
./build.sh codis codis-proxy
# Compile pika_operator
./build.sh operator
```
* #### 2.4 Start Pika
Expand Down Expand Up @@ -235,46 +233,26 @@ Users can directly download the latest binary version package from [releases](ht
./build_docker.sh -p linux/amd64 -t private_registry/pika:latest
```

* #### 3.3 Deployment with Pika-operator

Using pika-operator simplifies the deployment of a single-instance pika in a Kubernetes environment.
* #### 3.3 Running with docker-compose

>Note: Do not use this feature in a production environment.

Local installation:

1. Install [MiniKube](https://minikube.sigs.k8s.io/docs/start/)

2. Deploy Pika-operator

```bash
cd tools/pika_operator
make minikube-up # run this if you don't have a minikube cluster
make local-deploy
```

3. Create a Pika instance

```bash
cd tools/pika_operator
kubectl apply -f examples/pika-sample/
```

4. Check the Pika status

```bash
kubectl get pika pika-sample
```

5. Get Pika instance information

```bash
kubectl run pika-sample-test \
--image redis -it --rm --restart=Never \
-- /usr/local/bin/redis-cli -h pika-sample -p 9221 info
```


docker-compose.yaml
```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: always
```

## Performance test

Expand Down
65 changes: 22 additions & 43 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,14 @@ Pika 力求在完全兼容 Redis 协议、 继承 Redis 便捷运维设计的前
cd output && make
```

其他子组件,如 `codis` `pika_operator` 也可以用 `build.sh` 进行编译。
其他子组件,如 `codis` 也可以用 `build.sh` 进行编译。

```bash
# 编译 codis, 默认 target,build-all
./build.sh codis
# 编译 codis, 但只构建 codis-proxy
./build.sh codis codis-proxy
# 编译 pika_operator
./build.sh operator
```

* #### 2.4 启动 Pika
Expand Down Expand Up @@ -229,43 +226,26 @@ Pika 力求在完全兼容 Redis 协议、 继承 Redis 便捷运维设计的前
./build_docker.sh -p linux/amd64 -t private_registry/pika:latest
```

* #### 3.3 使用 pika-operator 部署

使用 `pika-operator` 可以简单地在 Kubernetes 环境中部署单实例 `pika`
>注:__请勿在生产环境中使用此功能__。

本地安装:

1. 安装 [MiniKube](https://minikube.sigs.k8s.io/docs/start/)

2. 部署 Pika-operator

```bash
cd tools/pika_operator
make minikube-up # run this if you don't have a minikube cluster
make local-deploy
```

3. 创建 Pika 实例

```bash
cd tools/pika_operator
kubectl apply -f examples/pika-sample/
```

4. 检查 Pika 状态

```bash
kubectl get pika pika-sample
```

5. 获取 Pika 实例信息

```bash
kubectl run pika-sample-test \
--image redis -it --rm --restart=Never \
-- /usr/local/bin/redis-cli -h pika-sample -p 9221 info
```
* #### 3.4 使用 docker-compose

docker-compose.yaml

```yaml
pikadb:
image: pikadb/pika:lastest
container_name: pikadb
ports:
- "6379:9221"
volumes:
- ./data/pika:/pika/log
# 指定配置文件路径,如果有需要指定配置文件则在这里指定 注意: pika.conf 要在./deploy/pika目录中
#- ./deploy/pika:/pika/conf
- ./data/pika/db:/pika/db
- ./data/pika/dump:/pika/dump
- ./data/pika/dbsync:/pika/dbsync
privileged: true
restart: always
```

## Pika 未来工作规划

Expand All @@ -281,8 +261,7 @@ Pika 力求在完全兼容 Redis 协议、 继承 Redis 便捷运维设计的前

* 1. 提升 Slot 迁移速度, 提升 Operator 扩缩容的效率
* 2. 升级 Codis-proxy
* 3. Pika-operator
* 4. Codis-proxy性能指标监控
* 3. Codis-proxy性能指标监控

## Pika 发版特性时间轴

Expand Down
10 changes: 0 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ if [[ "${ARGS[0]}" = "codis" ]]; then
exit 0
fi

if [[ "${ARGS[0]}" = "operator" ]]; then
pushd tools/pika_operator
if [[ "${CLEAN_BUILD}" = "true" ]]; then
rm -rf bin
fi
make -j ${CPU_CORE} "${ARGS[@]:1}"
popd
exit 0
fi

source ./utils/Get_OS_Version.sh

function version_compare() {
Expand Down
26 changes: 22 additions & 4 deletions conf/pika.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# Port 10221 is used for Rsync, and port 11221 is used for Replication, while the listening port is 9221.
port : 9221

db-instance-num : 3
rocksdb-ttl-second : 86400 * 7;
rocksdb-periodic-second : 86400 * 3;

# Random value identifying the Pika server, its string length must be 40.
# If not set, Pika will generate a random string with a length of 40 random characters.
# run-id :
Expand Down Expand Up @@ -75,7 +79,7 @@ requirepass :
# [NOTICE] The value of this parameter must match the "requirepass" setting on the master.
masterauth :

# The [password of user], which is empty by default.(Deprecated)
# The [password of user], which is empty by default.
# [NOTICE] If this user password is the same as admin password (including both being empty),
# the value of this parameter will be ignored and all users are considered as administrators,
# in this scenario, users are not subject to the restrictions imposed by the userblacklist.
Expand All @@ -87,7 +91,7 @@ masterauth :
# [Advice] It's recommended to add high-risk commands to this list.
# [Format] Commands should be separated by ",". For example: FLUSHALL, SHUTDOWN, KEYS, CONFIG
# By default, this list is empty.
userblacklist :
# userblacklist :

# Running Mode of Pika, The current version only supports running in "classic mode".
# If set to 'classic', Pika will create multiple DBs whose number is the value of configure item "databases".
Expand Down Expand Up @@ -249,9 +253,8 @@ disable_auto_compactions : false
sync-window-size : 9000

# Maximum buffer size of a client connection.
# Only three values are valid here: [67108864(64MB) | 268435456(256MB) | 536870912(512MB)].
# [NOTICE] Master and slaves must have exactly the same value for the max-conn-rbuf-size.
# Supported Units [K|M|G]. Its default unit is in [bytes] and its default value is 268435456(256MB).
# Supported Units [K|M|G]. Its default unit is in [bytes] and its default value is 268435456(256MB). The value range is [64MB, 1GB].
max-conn-rbuf-size : 268435456


Expand Down Expand Up @@ -508,3 +511,18 @@ cache-lfu-decay-time: 1
#
# aclfile : ../conf/users.acl

# It is possible to change the name of dangerous commands in a shared environment.
# For instance the CONFIG command may be renamed into something Warning: To prevent
# data inconsistency caused by different configuration files, do not use the rename
# command to modify write commands on the primary and secondary servers. If necessary,
# ensure that the configuration files of the primary and secondary servers are consistent
# In addition, when using the command rename, you must not use "" to modify the command,
# for example, rename-command: FLUSHALL "360flushall" is incorrect; instead, use
# rename-command: FLUSHALL 360flushall is correct. After the rename command is executed,
# it is most appropriate to use a numeric string with uppercase or lowercase letters
# for example: rename-command : FLUSHALL joYAPNXRPmcarcR4ZDgC81TbdkSmLAzRPmcarcR
#
# Example:
#
# rename-command : FLUSHALL 360flushall
# rename-command : FLUSHDB 360flushdb
File renamed without changes.
4 changes: 2 additions & 2 deletions build_docker.sh → docker/build_pika_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ then
docker buildx use pika-builder
fi

docker buildx build --platform ${PLATFORM} -t ${TAG} --build-arg ENABLE_PROXY=${PROXY} .
docker buildx build --platform ${PLATFORM} -t ${TAG} -f Dockerfile_pika --build-arg ENABLE_PROXY=${PROXY} ..

else
# build single-arch image
docker build -t ${TAG} --build-arg ENABLE_PROXY=${PROXY} .
docker build -t ${TAG} -f Dockerfile_pika --build-arg ENABLE_PROXY=${PROXY} ..
fi


3 changes: 1 addition & 2 deletions docs/ops/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ identify-binlog-type : new
# 主从同步流量控制的的窗口,主从高延迟情形下可以通过提高该参数提高同步性能。默认值9000最大值90000。
sync-window-size : 9000
# 处理客户端连接请求的最大缓存大小,可配置的数值为67108864(64MB) 或 268435456(256MB) 或 536870912(512MB)
# 默认是268435456(256MB),需要注意的是主从的配置需要一致。
# 处理客户端连接请求的最大缓存大小,默认是268435456(256MB),范围为[64MB, 1GB],需要注意的是主从的配置需要一致。
# 单条命令超过此buffer大小,服务端会自动关闭与客户端的连接。
max-conn-rbuf-size : 268435456
Expand Down
3 changes: 3 additions & 0 deletions include/acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ class Acl {

void UpdateDefaultUserPassword(const std::string& pass);

void InitLimitUser(const std::string& bl, bool limit_exist);

// After the user channel is modified, determine whether the current channel needs to be disconnected
void KillPubsubClientsIfNeeded(const std::shared_ptr<User>& origin, const std::shared_ptr<User>& newUser);

Expand All @@ -380,6 +382,7 @@ class Acl {
static std::vector<std::string> GetAllCategoryName();

static const std::string DefaultUser;
static const std::string DefaultLimitUser;
static const int64_t LogGroupingMaxTimeDelta;

// Adds a new entry in the ACL log, making sure to delete the old entry
Expand Down
Loading

0 comments on commit 2da2ec7

Please sign in to comment.