Skip to content

Commit

Permalink
Merge pull request #646 from midoks/dev
Browse files Browse the repository at this point in the history
valkey插件,redis的平替
  • Loading branch information
midoks authored Dec 17, 2024
2 parents 99fcfa5 + 1285641 commit 58027e4
Show file tree
Hide file tree
Showing 29 changed files with 1,577 additions and 18 deletions.
1 change: 1 addition & 0 deletions plugins/mariadb/info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sort":2,
"hook":["database"],
"title":"MariaDB",
"tip":"soft",
Expand Down
2 changes: 1 addition & 1 deletion plugins/memcached/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sort": 7,
"sort": 5,
"ps": "是一个高性能的分布式内存对象缓存系统",
"name": "memcached",
"title": "Memcached",
Expand Down
2 changes: 1 addition & 1 deletion plugins/mongodb/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sort": 7,
"sort":3,
"hook":["database"],
"ps": "一个高性能的NOSQL数据库【社区版】",
"name": "mongodb",
Expand Down
1 change: 1 addition & 0 deletions plugins/mysql/info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sort":1,
"title":"MySQL",
"tip":"soft",
"name":"mysql",
Expand Down
1 change: 1 addition & 0 deletions plugins/op_load_balance/info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sort":3,
"title":"OP负载均衡",
"tip":"soft",
"name":"op_load_balance",
Expand Down
1 change: 1 addition & 0 deletions plugins/op_waf/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
}
],
"sort":2,
"title":"OP防火墙",
"tip":"soft",
"name":"op_waf",
Expand Down
1 change: 1 addition & 0 deletions plugins/openresty/info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sort": 0,
"title":"OpenResty",
"tip":"soft",
"name":"openresty",
Expand Down
2 changes: 1 addition & 1 deletion plugins/php-guard/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sort": 7,
"sort": 5,
"ps": "监控PHP-FPM运行状态,防止大批量出现502错误!",
"shell": "install.sh",
"name": "php-guard",
Expand Down
1 change: 1 addition & 0 deletions plugins/postgresql/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"hook":["database"],
"sort": 6,
"title":"PostgreSQL",
"tip":"soft",
"name":"postgresql",
Expand Down
10 changes: 5 additions & 5 deletions plugins/redis/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def initDreplace():
mw.execShell('chmod +x ' + file_bin)

# config replace
dst_conf = getServerDir() + '/redis.conf'
dst_conf = getConf()
dst_conf_init = getServerDir() + '/init.pl'
if not os.path.exists(dst_conf_init):
conf_content = mw.readFile(getConfTpl())
Expand Down Expand Up @@ -221,7 +221,7 @@ def reload():


def getPort():
conf = getServerDir() + '/redis.conf'
conf = getConf()
content = mw.readFile(conf)

rep = r"^(port)\s*([.0-9A-Za-z_& ~]+)"
Expand All @@ -234,7 +234,7 @@ def getPort():

def getRedisCmd():
requirepass = ""
conf = getServerDir() + '/redis.conf'
conf = getConf()
content = mw.readFile(conf)
rep = r"^(requirepass)\s*([.0-9A-Za-z_& ~]+)"
tmp = re.search(rep, content, re.M)
Expand Down Expand Up @@ -467,7 +467,7 @@ def runLog():


def getRedisConfInfo():
conf = getServerDir() + '/redis.conf'
conf = getConf()

gets = [
{'name': 'bind', 'type': 2, 'ps': '绑定IP(修改绑定IP可能会存在安全隐患)','must_show':1},
Expand Down Expand Up @@ -510,7 +510,7 @@ def submitRedisConf():
gets = ['bind', 'port', 'timeout', 'maxclients',
'databases', 'requirepass', 'maxmemory','slaveof','masterauth']
args = getArgs()
conf = getServerDir() + '/redis.conf'
conf = getConf()
content = mw.readFile(conf)
for g in gets:
if g in args:
Expand Down
2 changes: 1 addition & 1 deletion plugins/redis/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sort": 7,
"sort":4,
"ps": "一个高性能的KV数据库",
"name": "redis",
"title": "Redis",
Expand Down
90 changes: 90 additions & 0 deletions plugins/valkey/config/valkey.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
daemonize yes
pidfile {$SERVER_PATH}/valkey/valkey.pid

bind 127.0.0.1
port 6389
requirepass {$VALKEY_PASS}

timeout 3
tcp-keepalive 0

loglevel notice

logfile {$SERVER_PATH}/valkey/data/valkey.log
databases 16

################################ SNAPSHOTTING #################################

save 900 1000
save 300 10000
save 60 1000000
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir {$SERVER_PATH}/valkey/data/

################################# REPLICATION #################################

slave-serve-stale-data yes
slave-read-only yes

repl-disable-tcp-nodelay no
slave-priority 100

################################## SECURITY ###################################


################################### LIMITS ####################################
maxclients 10000
#maxmemory-samples 3
maxmemory 218mb
maxmemory-policy volatile-ttl
#maxmemory-policy allkeys-lru

############################## APPEND ONLY MODE ###############################

# appendonly no

# appendfsync always
# appendfsync everysec
# appendfsync no

# appendfilename "appendonly.aof"

no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

################################ LUA SCRIPTING ###############################

lua-time-limit 5000

################################## SLOW LOG ###################################


slowlog-log-slower-than 10000
slowlog-max-len 128

############################### ADVANCED CONFIG ###############################

hash-max-ziplist-entries 512
hash-max-ziplist-value 64

list-max-ziplist-entries 512
list-max-ziplist-value 64

set-max-intset-entries 512

zset-max-ziplist-entries 128
zset-max-ziplist-value 64

activerehashing yes

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

hz 10

aof-rewrite-incremental-fsync yes
Binary file added plugins/valkey/ico.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions plugins/valkey/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<style>
.overflow_hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
</style>

<div class="bt-form">
<div class='plugin_version'></div>
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('valkey');">服务</p>
<p onclick="pluginInitD('valkey');">自启动</p>
<p onclick="pluginConfigTpl('valkey',$('.plugin_version').attr('version'));">配置修改</p>
<!-- <p onclick="pluginConfig('valkey');">配置修改</p> -->
<p onclick="getRedisConfig($('.plugin_version').attr('version'));">性能调整</p>
<p onclick="redisStatus($('.plugin_version').attr('version'));">负载状态</p>
<p onclick="replStatus($('.plugin_version').attr('version'));">复制状态</p>
<p onclick="clusterStatus($('.plugin_version').attr('version'));">集群状态</p>
<p onclick="clusterNodes($('.plugin_version').attr('version'));">集群节点</p>
<p onclick="pluginLogs('valkey','','run_log');">运行日志</p>
<p onclick="valkeyReadme();">相关说明</p>

</div>
<div class="bt-w-con pd15">
<div class="soft-man-con" style="height: 520px; overflow: auto;"></div>
</div>
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=valkey&f=js/valkey.js", function(){
pluginService('valkey', $('.plugin_version').attr('version'));
});
</script>
Loading

0 comments on commit 58027e4

Please sign in to comment.