How do I delete everything in Redis?

I want to delete all keys. I want everything wiped out and give me a blank database.

Is there a way to do this in Redis client?


With redis-cli:

  • FLUSHDB - Removes data from your connection's CURRENT database.
  • FLUSHALL - Removes data from ALL databases.
  • Redis documentation:

  • flushdb
  • flushall
  • For example, in your shell:

    redis-cli flushall
    

    Heads up that FLUSHALL may be overkill. FLUSHDB is the one to flush a database only. FLUSHALL will wipe out the entire server. As in every database on the server. Since the question was about flushing a database I think this is an important enough distinction to merit a separate answer.


    Answers so far are absolutely correct; they delete all keys.

    However, if you also want to delete all Lua scripts from the Redis instance, you should follow it by:

    SCRIPT FLUSH

    The OP asks two questions; this completes the second question ( everything wiped).

    链接地址: http://www.djcxy.com/p/34154.html

    上一篇: 使用Redis的Pub Sub。 RabbitMQ的优点/缺点

    下一篇: 如何删除Redis中的所有内容?