Home  >  Article  >  Database  >  How to use RedisLive to monitor Redis server

How to use RedisLive to monitor Redis server

PHPz
PHPzforward
2023-05-29 09:20:091579browse

RedisLive is an open source graphical monitoring tool written in python. It is very lightweight. The core service part only contains a web service and an info command and monitor based on redis. The command monitoring service only has a web interface based on BootStrap, which is very simple and clear. In addition, it also supports multi-instance monitoring, easy switching, and very easy to configure. Monitoring information supports redis storage and persistent storage (sqlite).

How to use RedisLive to monitor Redis server

Installation

RedisLive is written in Python and uses Tornado as its web server. No additional compilation process is required to run RedisLive. After installing the relevant Python extension package of RedisLive, you can run it directly without any additional steps. The latest source code of RedisLive can be downloaded through Git:

git clone https//githup.com/kumarnitin/RedisLive.git

Go to the downloaded RedisLive directory and you can see that the Python extension packages that RedisLive depends on have been written in the requirements.txt file. The content of requirements.txt is as follows:

argparse==1.2.1
python-dateutil==1.5
redis
tornado==2.1.1

Friends who are familiar with Python must also feel very familiar with the requirements.txt file. Use the following command to install the expansion package inside (specify Douban source to install faster) :

pip install -r requirements.txt -i http://pypi.douban.com/simple/–trusted-host pypi.douban.com

Run

After installing the dependencies, you can run RedisLive. Enter the RedisLive/src directory and you can see the redis-live.conf.example file. This file is an example configuration file for RedisLive. The content is as follows:

How to use RedisLive to monitor Redis server

  • RedisServers: List of monitored Redis instances. RedisLive supports monitoring multiple Redis instances at the same time

  • RedisStatsServer: Redis used to store monitoring data Example, this configuration is different from RedisServers. RedisLive does not monitor RedisStatsServer. RedisStatsServer is only used to store monitoring data.

  • DataStoreType: The storage solution for monitoring data can be configured as redis or sqlite

  • SqliteStatsStore: sqlite configuration for storing monitoring data

The redis-live.conf used by our instance (the .example suffix needs to be removed) is set as follows :

How to use RedisLive to monitor Redis server

That is, the monitored Redis instance is 127.0.0.1:6379, and the sqlite function is used to store the monitoring data solution, sqlite database The path is db/redislive.sqlite. After the configuration is completed, RedisLive can be run. The operation of RedisLive consists of two parts (in the RedisLive/src directory), redis-monitor.py is used to send INFO and MONITOR commands to the Redis instance and obtain their returns, and redis-live.py is used to run the Web server.

To rewrite this sentence, you can say: When starting the redis-monitor.py script, we need to adjust the duration parameter to 120 seconds. The duration parameter specifies the running duration of the monitoring script. For example, if it is set to 120 seconds, that is, after 120 seconds, the monitoring script will automatically exit and print shutting down... on the terminal.

./redis-monitor.py --duration=120

Next start the Web server:

./redis-live.py

Open the browser, enter http://localhost:8888/index.html in the address bar, press Enter, and you will see Monitoring data of Redis instances.

How to use RedisLive to monitor Redis server

It should be pointed out that since the redis-monitor.py script uses the MONITOR command and INFO command to the Redis instance to obtain monitoring data, The MONITOR command has a great impact on the performance of the Redis instance. Therefore, for the deployment of redis-monitor.py in the production environment, you need to set a more appropriate duration parameter and use crontab to execute the script regularly.

The above is the detailed content of How to use RedisLive to monitor Redis server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete