Is it possible to monitor only one database?
Currently, my understanding is that the 'monitor' command outputs all commands received by the server, no matter which database number they are sent to.
This is a problem for me as I use one db for holding 'normal' data and one db for holding session data, and the output from the session db makes it near impossible to read the output from the other db.
Is there a way to limit the o开发者_高级运维utput to only one database ?
What about this?
redis-cli monitor |grep '(db 1)'
That way you would just get the output of DB 1
Databases in redis are not at all like databases in SQL. They are essentially just a predefined key prefix with no configuration of their own.
If you only want to see changes to the real data, you will need to set it up as a separate instance so that session data goes to a different process.
There isn't much overhead in doing this (in most scenarios it will actually improve performance) and there are other good reasons for using multiple instances. For example you probably want your real data written to disk in real time and backed up, but session data is worthless after a server restart so doesn't need to be saved to disk at all. With a shared instance you would have to save and back up everything, which isn't particularly good for performance with session data changing much more than permanent data.
If only this bug was resolved, the following would work:
redis-cli -n 1 monitor
Where 1
is database number.
精彩评论