Is it possible to track only one database?

Currently, I understand that the monitor command displays all the commands received by the server, regardless of which database number they are sent to.

This is a problem for me, because I use one db to store the β€œnormal” data and one db to store the session data, and the output from the db session makes it impossible to read the output from another db.

Is there a way to limit the output to only one database?

+8
source share
3 answers

Databases in redis are not at all like databases in SQL. They are essentially a predefined key prefix without their own configuration.

If you want to see changes in real data, you will need to configure it as a separate instance so that the session data moves to another process.

However, there is not much overhead (in most scenarios this will actually improve performance), and there are other good reasons for using multiple instances. For example, you probably want your real data to be written to disk in real time and backed up, but session data is useless after the server restarts, so it does not need to be saved to disk at all. With a shared instance, you will have to save and back up everything that is not particularly good for performance, as session data changes much more than persistent data.

+5
source

How about this?

redis-cli monitor |grep '(db 1)' 

So you just get DB output 1

+13
source

If only this error were fixed, the following would work:

 redis-cli -n 1 monitor 

Where 1 is the database number.

-1
source

All Articles