使用redis-cli查看redis所有的keys及清空所有的数据

先进入redis的安装目录:

cd %redis_home%/src

调用redis-cli

./redis-cli -h 127.0.0.1

执行命令:

  127.0.0.1:6379> keys *
  (empty list or set)
  127.0.0.1:6379> keys *
  1) "652d085ae54d4a1faca9db57f5a32e57"
  2) "a13991c60d13485bb23b31c7abb9712a"
  3) "e1796a709c0f4e7093bb0d49a03953ee"
  4) "e7d44a40cacc4bca8be7649a545f642d"
  5) "bfa16cf345e447f895b91742fee63c3f"
  6) "c681aaeeb56b472b99885164702208df"
  7) "a47937356b1244e3adb672c210776ecb"
  8) "a1b47ee28a6b442d933e7ab838c57367"
  9) "8713ff5043414f7cbde68ad5a7810585"
  127.0.0.1:6379> keys *
  1) "652d085ae54d4a1faca9db57f5a32e57"
  2) "a13991c60d13485bb23b31c7abb9712a"
  3) "e1796a709c0f4e7093bb0d49a03953ee"
  4) "4a9b87b8259c192493e7fa4eac49b254"
  5) "30a828e412100ae46c1bdf01259438e3"
  6) "e7d44a40cacc4bca8be7649a545f642d"
  7) "bfa16cf345e447f895b91742fee63c3f"
  8) "c299ced6e5e731975468e1355ccf9be1"
  9) "7d963b1ce1ad48946087eb6b80c4f27a"
  10) "c681aaeeb56b472b99885164702208df"
  11) "a47937356b1244e3adb672c210776ecb"
  12) "34ea60fd6f0fb639f3c6304e860a914"
  13) "a1b47ee28a6b442d933e7ab838c57367"
  14) "8713ff5043414f7cbde68ad5a7810585"

执行清空命令

 127.0.0.1:6379> flushall

清空后屏幕输出:

  OK

再查看:

  127.0.0.1:6379> keys *

 

你可能感兴趣的