From c0f60008cbb88bf7e2a26211a830cf82ef0c482e Mon Sep 17 00:00:00 2001 From: Maxime de Roucy Date: Sat, 2 May 2020 16:23:50 +0200 Subject: [PATCH] acl: @replication command group containing mandatory commands for replication (used by masteruser user) Former-commit-id: 123bc125cfe7b30fdeef833759a33ccc854b5c51 --- keydb.conf | 6 +++--- src/acl.cpp | 1 + src/help.h | 3 ++- src/server.cpp | 10 +++++----- src/server.h | 3 ++- utils/generate-command-help.rb | 3 ++- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/keydb.conf b/keydb.conf index 30e12a5e0..68648df35 100644 --- a/keydb.conf +++ b/keydb.conf @@ -376,9 +376,9 @@ dir ./ # # However this is not enough if you are using KeyDB ACLs (for Redis version # 6 or greater), and the default user is not capable of running the PSYNC -# command and/or other commands needed for replication. In this case it's -# better to configure a special user to use with replication, and specify the -# masteruser configuration as such: +# command and/or other commands needed for replication (gathered in the +# @replication group). In this case it's better to configure a special user to +# use with replication, and specify the masteruser configuration as such: # # masteruser # diff --git a/src/acl.cpp b/src/acl.cpp index 1453d1fa2..b3a4ea522 100644 --- a/src/acl.cpp +++ b/src/acl.cpp @@ -80,6 +80,7 @@ struct ACLCategoryItem { {"connection", CMD_CATEGORY_CONNECTION}, {"transaction", CMD_CATEGORY_TRANSACTION}, {"scripting", CMD_CATEGORY_SCRIPTING}, + {"replication", CMD_CATEGORY_REPLICATION}, {NULL,0} /* Terminator. */ }; diff --git a/src/help.h b/src/help.h index eae4e579b..2f692dfc2 100644 --- a/src/help.h +++ b/src/help.h @@ -18,7 +18,8 @@ static char *commandGroups[] = { "hyperloglog", "cluster", "geo", - "stream" + "stream", + "replication" }; struct commandHelp { diff --git a/src/server.cpp b/src/server.cpp index 654044699..cfd739d24 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -180,7 +180,7 @@ volatile unsigned long lru_clock; /* Server global current LRU time. */ * * @keyspace, @read, @write, @set, @sortedset, @list, @hash, @string, @bitmap, * @hyperloglog, @stream, @admin, @fast, @slow, @pubsub, @blocking, @dangerous, - * @connection, @transaction, @scripting, @geo. + * @connection, @transaction, @scripting, @geo, @replication. * * Note that: * @@ -673,7 +673,7 @@ struct redisCommand redisCommandTable[] = { * failure detection, and a loading server is considered to be * not available. */ {"ping",pingCommand,-1, - "ok-stale fast @connection", + "ok-stale fast @connection @replication", 0,NULL,0,0,0,0,0,0}, {"echo",echoCommand,2, @@ -717,15 +717,15 @@ struct redisCommand redisCommandTable[] = { 0,NULL,0,0,0,0,0,0}, {"sync",syncCommand,1, - "admin no-script", + "admin no-script @replication", 0,NULL,0,0,0,0,0,0}, {"psync",syncCommand,3, - "admin no-script", + "admin no-script @replication", 0,NULL,0,0,0,0,0,0}, {"replconf",replconfCommand,-1, - "admin no-script ok-loading ok-stale", + "admin no-script ok-loading ok-stale @replication", 0,NULL,0,0,0,0,0,0}, {"flushdb",flushdbCommand,-1, diff --git a/src/server.h b/src/server.h index f42968994..7a826a7cd 100644 --- a/src/server.h +++ b/src/server.h @@ -372,7 +372,8 @@ public: #define CMD_CATEGORY_CONNECTION (1ULL<<36) #define CMD_CATEGORY_TRANSACTION (1ULL<<37) #define CMD_CATEGORY_SCRIPTING (1ULL<<38) -#define CMD_SKIP_PROPOGATE (1ULL<<39) /* "noprop" flag */ +#define CMD_CATEGORY_REPLICATION (1ULL<<39) +#define CMD_SKIP_PROPOGATE (1ULL<<40) /* "noprop" flag */ /* AOF states */ #define AOF_OFF 0 /* AOF is off */ diff --git a/utils/generate-command-help.rb b/utils/generate-command-help.rb index 2e46d1ed8..3acd81244 100755 --- a/utils/generate-command-help.rb +++ b/utils/generate-command-help.rb @@ -15,7 +15,8 @@ GROUPS = [ "hyperloglog", "cluster", "geo", - "stream" + "stream", + "replication" ].freeze GROUPS_BY_NAME = Hash[*