From 7ee00e14268dbbd0c8d739e0cac0d4380cd07374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B9=B8=E7=A6=8F?= Date: Tue, 4 Jun 2024 21:03:59 +0800 Subject: [PATCH 1/3] delete invalid file --- README.md | 2 +- README_CN.md | 2 +- stored/cmd/main.go | 2 -- stored/plugin/gops/gops.go | 39 ------------------------- stored/server/cmd_global.go | 15 ++++++++++ stored/server/db.go | 58 ------------------------------------- stored/server/ops.go | 38 ------------------------ 7 files changed, 17 insertions(+), 139 deletions(-) delete mode 100644 stored/plugin/gops/gops.go delete mode 100644 stored/server/db.go delete mode 100644 stored/server/ops.go diff --git a/README.md b/README.md index 279290f..2cfd7bd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Introduction -- Bitalostored is a high-performance distributed storage system, core engine based on [bitalosdb](https://git.zuoyebang.cc/stored-bitalosdb/bitalosdb/README.md), compatible with Redis protocol. As an alternative to Redis, it stores data with low-cost hard disk instead of expensive memory, takes full advantage of multi-core and provides excellent single-core performance, which can significantly reduce service costs. +- Bitalostored is a high-performance distributed storage system, core engine based on [bitalosdb](https:///stored-bitalosdb/bitalosdb/README.md), compatible with Redis protocol. As an alternative to Redis, it stores data with low-cost hard disk instead of expensive memory, takes full advantage of multi-core and provides excellent single-core performance, which can significantly reduce service costs. - Bitalostored contains three main projects: dashboard (visual management platform), stored (storage service), and proxy (proxy service). Current open-source version is stable, and provides a complete industrial grade solution. In Zuoyebang company, the stability of Bitalostored has been verified. Hundreds of online clusters are running stably all year round. Now data capacity is 200TB, peak QPS is 20 million, peak network bandwidth is 5000Gbps, and since v1.0 was released in 2019, there have been no online incidents. diff --git a/README_CN.md b/README_CN.md index 9633dc8..e0e4f26 100644 --- a/README_CN.md +++ b/README_CN.md @@ -2,7 +2,7 @@ ## 简介 -- 高性能分布式存储系统,核心引擎基于[bitalosdb](https://git.zuoyebang.cc/stored-bitalosdb/bitalosdb/README_CN.md),兼容redis协议;作为redis的替代品,用成本更低的硬盘存储数据,充分发挥多核优势,且单核性能优秀,可大幅降低服务成本。 +- 高性能分布式存储系统,核心引擎基于[bitalosdb](https://github.com/zuoyebang/bitalosdb/blob/main/README.md),兼容redis协议;作为redis的替代品,用成本更低的硬盘存储数据,充分发挥多核优势,且单核性能优秀,可大幅降低服务成本。 - 开源版本,集成dashboard(可视化管理平台)、stored(存储服务)、proxy(代理服务)于一体,是完整的工业级解决方案。经历作业帮100+个集群的实践验证,存储200TB数据,峰值QPS:2000万,峰值带宽:5000Gbps;2019年发布v1.0至今线上零事故。 diff --git a/stored/cmd/main.go b/stored/cmd/main.go index 076a96a..a12b63e 100644 --- a/stored/cmd/main.go +++ b/stored/cmd/main.go @@ -25,7 +25,6 @@ import ( "github.com/zuoyebang/bitalostored/stored/internal/tclock" "github.com/zuoyebang/bitalostored/stored/plugin/anticc" "github.com/zuoyebang/bitalostored/stored/plugin/catch_panic" - "github.com/zuoyebang/bitalostored/stored/plugin/gops" "github.com/zuoyebang/bitalostored/stored/plugin/info" "github.com/zuoyebang/bitalostored/stored/plugin/pprof" "github.com/zuoyebang/bitalostored/stored/plugin/raft" @@ -71,7 +70,6 @@ func main() { info.Init() catch_panic.Init() pprof.Init() - gops.Init() raft.Init() anticc.Init() diff --git a/stored/plugin/gops/gops.go b/stored/plugin/gops/gops.go deleted file mode 100644 index 6749706..0000000 --- a/stored/plugin/gops/gops.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2019 The Bitalostored author and other contributors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package gops - -import ( - "github.com/google/gops/agent" - - "github.com/zuoyebang/bitalostored/stored/server" - - "github.com/zuoyebang/bitalostored/stored/internal/config" - - "github.com/zuoyebang/bitalostored/stored/internal/log" -) - -func Init() { - if !config.GlobalConfig.Plugin.OpenGoPs { - return - } - - server.AddPlugin(&server.Proc{Start: func(s *server.Server) { - go func() { - if err := agent.Listen(agent.Options{}); err != nil { - log.Fatal(err) - } - }() - }}) -} diff --git a/stored/server/cmd_global.go b/stored/server/cmd_global.go index d1f6d4e..af59593 100644 --- a/stored/server/cmd_global.go +++ b/stored/server/cmd_global.go @@ -15,8 +15,11 @@ package server import ( + "os" "runtime/debug" + "syscall" + "github.com/zuoyebang/bitalostored/stored/internal/errn" "github.com/zuoyebang/bitalostored/stored/internal/resp" "github.com/zuoyebang/bitalostored/stored/internal/utils" ) @@ -30,9 +33,21 @@ func init() { "debuginfo": {Sync: false, Handler: debugInfoCommand, NoKey: true}, "cacheinfo": {Sync: false, Handler: cacheInfoCommand, NoKey: true}, "freememory": {Sync: false, Handler: freeOsMemoryCommand, NoKey: true}, + "shutdown": {Sync: false, Handler: shutdownCommand, NoKey: true}, }) } +func shutdownCommand(c *Client) error { + c.conn.Close() + + p, _ := os.FindProcess(os.Getpid()) + + p.Signal(syscall.SIGTERM) + p.Signal(os.Interrupt) + + return errn.ErrClientQuit +} + func freeOsMemoryCommand(c *Client) error { debug.FreeOSMemory() c.RespWriter.WriteStatus(resp.ReplyOK) diff --git a/stored/server/db.go b/stored/server/db.go deleted file mode 100644 index c4948bc..0000000 --- a/stored/server/db.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2019 The Bitalostored author and other contributors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package server - -import ( - "os" - - "github.com/zuoyebang/bitalostored/stored/engine" - "github.com/zuoyebang/bitalostored/stored/internal/log" - "github.com/zuoyebang/bitalostored/stored/internal/task" -) - -type DB struct { - *engine.Bitalos - - Info *SInfo -} - -func init() { - AddCommand(map[string]*Cmd{ - "_task": {Name: "_task file", Handler: func(c *Client) error { - task.Run(c, func(task *task.Task) error { - log.Info("hello world") - return nil - }) - c.RespWriter.WriteStatus("OK") - return nil - }}, - "_save": {Name: "_save file", Handler: func(c *Client) error { - return nil - }}, - "_load": {Name: "_load file", Handler: func(c *Client) error { - f, e := os.Open(string(c.Args[0])) - if e != nil { - return e - } - defer f.Close() - - if e := c.server.RecoverFromSnapshot(f, nil); e != nil { - return e - } - c.RespWriter.WriteStatus("OK") - return nil - }}, - }) -} diff --git a/stored/server/ops.go b/stored/server/ops.go deleted file mode 100644 index 6621839..0000000 --- a/stored/server/ops.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2019 The Bitalostored author and other contributors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package server - -import ( - "os" - "syscall" - - "github.com/zuoyebang/bitalostored/stored/internal/errn" -) - -func init() { - AddCommand(map[string]*Cmd{ - "shutdown": {Name: "shoutdown the process", - Handler: func(c *Client) error { - c.conn.Close() - - p, _ := os.FindProcess(os.Getpid()) - - p.Signal(syscall.SIGTERM) - p.Signal(os.Interrupt) - - return errn.ErrClientQuit - }}, - }) -} From e13e4e3248b2243d9851fb3cf764a554eb7fb36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B9=B8=E7=A6=8F?= Date: Tue, 4 Jun 2024 21:07:43 +0800 Subject: [PATCH 2/3] modify readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cfd7bd..1161327 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Introduction -- Bitalostored is a high-performance distributed storage system, core engine based on [bitalosdb](https:///stored-bitalosdb/bitalosdb/README.md), compatible with Redis protocol. As an alternative to Redis, it stores data with low-cost hard disk instead of expensive memory, takes full advantage of multi-core and provides excellent single-core performance, which can significantly reduce service costs. +- Bitalostored is a high-performance distributed storage system, core engine based on [bitalosdb](https://github.com/zuoyebang/bitalosdb/blob/main/README.md), compatible with Redis protocol. As an alternative to Redis, it stores data with low-cost hard disk instead of expensive memory, takes full advantage of multi-core and provides excellent single-core performance, which can significantly reduce service costs. - Bitalostored contains three main projects: dashboard (visual management platform), stored (storage service), and proxy (proxy service). Current open-source version is stable, and provides a complete industrial grade solution. In Zuoyebang company, the stability of Bitalostored has been verified. Hundreds of online clusters are running stably all year round. Now data capacity is 200TB, peak QPS is 20 million, peak network bandwidth is 5000Gbps, and since v1.0 was released in 2019, there have been no online incidents. From 95b139cd5729eeedfea8e804b0b6af7f76e2b81c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B9=B8=E7=A6=8F?= Date: Tue, 4 Jun 2024 23:21:33 +0800 Subject: [PATCH 3/3] merge main --- go.mod | 1 - go.sum | 2 -- 2 files changed, 3 deletions(-) diff --git a/go.mod b/go.mod index b4d7620..e9a160b 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/goccy/go-json v0.10.2 github.com/golang/snappy v0.0.4 github.com/gomodule/redigo v2.0.0+incompatible - github.com/google/gops v0.3.28 github.com/hashicorp/memberlist v0.2.4 github.com/json-iterator/go v1.1.12 github.com/juju/ratelimit v1.0.2-0.20191002062651-f60b32039441 diff --git a/go.sum b/go.sum index 3c6f683..adf5779 100644 --- a/go.sum +++ b/go.sum @@ -137,8 +137,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gops v0.3.28 h1:2Xr57tqKAmQYRAfG12E+yLcoa2Y42UJo2lOrUFL9ark= -github.com/google/gops v0.3.28/go.mod h1:6f6+Nl8LcHrzJwi8+p0ii+vmBFSlB4f8cOOkTJ7sk4c= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o=