“Redis 清空缓存”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
 
构建 Redis Cluster 要求集群中的所有节点都不能有数据
 
构建 Redis Cluster 要求集群中的所有节点都不能有数据
 +
 +
=== 清空当前 DB 的数据 ===
 +
<syntaxhighlight lang="powershell">
 +
F:\下载目录\Redis-x64-5.0.14.1>.\redis-cli.exe -h 127.0.0.1 -p 6379
 +
127.0.0.1:6379> auth vn4sj5kbxdaG
 +
OK
 +
127.0.0.1:6379> keys *
 +
1) "msg"
 +
2) "test_key"
 +
3) "{phoneList}:config"
 +
4) "codehole"
 +
5) "phoneList"
 +
6) "test_test"
 +
7) "\xac\xed\x00\x05t\x00\b20230218"
 +
8) "test_key2"
 +
9) "test_key1"
 +
10) "\xac\xed\x00\x05t\x00\x05nihao"
 +
11) "age"
 +
12) "name"
 +
127.0.0.1:6379> flushdb
 +
OK
 +
127.0.0.1:6379> keys *
 +
(empty list or set)
 +
127.0.0.1:6379>
 +
</syntaxhighlight>
 +
 +
=== 清空所有 DB 的数据 ===
 +
<syntaxhighlight lang="powershell">
 +
F:\下载目录\Redis-x64-5.0.14.1>.\redis-cli.exe -h 127.0.0.1 -p 6380 -a vn4sj5kbxdaG
 +
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
 +
127.0.0.1:6380> keys *
 +
1) "test_key1"
 +
2) "name"
 +
3) "test_key"
 +
4) "phoneList"
 +
5) "{phoneList}:config"
 +
6) "msg"
 +
7) "test_key2"
 +
8) "codehole"
 +
9) "\xac\xed\x00\x05t\x00\b20230218"
 +
10) "\xac\xed\x00\x05t\x00\x05nihao"
 +
11) "test_test"
 +
12) "age"
 +
127.0.0.1:6380> flushall
 +
OK
 +
127.0.0.1:6380> keys *
 +
(empty list or set)
 +
127.0.0.1:6380>
 +
</syntaxhighlight>

2023年2月20日 (一) 03:48的最新版本

构建 Redis Cluster 要求集群中的所有节点都不能有数据

清空当前 DB 的数据

F:\下载目录\Redis-x64-5.0.14.1>.\redis-cli.exe -h 127.0.0.1 -p 6379
127.0.0.1:6379> auth vn4sj5kbxdaG
OK
127.0.0.1:6379> keys *
 1) "msg"
 2) "test_key"
 3) "{phoneList}:config"
 4) "codehole"
 5) "phoneList"
 6) "test_test"
 7) "\xac\xed\x00\x05t\x00\b20230218"
 8) "test_key2"
 9) "test_key1"
10) "\xac\xed\x00\x05t\x00\x05nihao"
11) "age"
12) "name"
127.0.0.1:6379> flushdb
OK
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379>

清空所有 DB 的数据

F:\下载目录\Redis-x64-5.0.14.1>.\redis-cli.exe -h 127.0.0.1 -p 6380 -a vn4sj5kbxdaG
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6380> keys *
 1) "test_key1"
 2) "name"
 3) "test_key"
 4) "phoneList"
 5) "{phoneList}:config"
 6) "msg"
 7) "test_key2"
 8) "codehole"
 9) "\xac\xed\x00\x05t\x00\b20230218"
10) "\xac\xed\x00\x05t\x00\x05nihao"
11) "test_test"
12) "age"
127.0.0.1:6380> flushall
OK
127.0.0.1:6380> keys *
(empty list or set)
127.0.0.1:6380>