I recently visited the official Redis website and found that Redis not only launched many new features, but also released a visualization tool, RedisInsight. It feels very good to try it out. The most important thing is to support new features such as RedisJSON, which is unmatched by third-party tools.
Introduction to RedisInsight
RedisInsight is a visual management tool officially produced by Redis, which can be used to design, develop and optimize your Redis applications. Support both dark and light themes, the interface is very cool! It can support the management of various data types such as String, Hash, Set, List, JSON, etc. At the same time, it supports the remote use of CLI functions, which is very powerful! The following is a rendering of the use of RedisInsight, the appearance is quite good!
Introduction to RedisMod
After years of development, Redis has become more than just an in-memory database. With the support of RedisMod, the function of Redis will become very powerful. RedisMod includes the following enhancement modules:
- RediSearch: a full-featured search engine;
- RedisJSON: native support for JSON type;
- RedisTimeSeries: time series database support;
- RedisGraph: graph database support;
- RedisBloom: native support for probabilistic data;
- RedisGears: programmable data processing;
- RedisAI: Real-time model management and deployment for machine learning.
Install
First, we will use Docker to install Redis, pay attention to download the full version of Redis, RedisMod, which is an enhanced version of Redis with all the modules built in! Use the following command to download the image of RedisMod, as follows:
docker pull redislabs/redismod:preview
Then, run the RedisMod service in the container.
docker run -p 6379:6379 --name redismod \
-v /mydata/redismod/data:/data \
-d redislabs/redismod:preview
use
basic use
First download the installation package of RedisInsight, download address: https://redis.com/redis-enterprise/redis-insight/ .
After the download is complete, you can install it directly. After the installation is complete, select Add Redis database on the main interface.
Choose to manually add a database and enter the Redis service connection information;
After opening the connection, you can manage Redis, and the installed Redis enhancement module will be displayed in the upper right corner;
Next, we can add key-value pair data in Redis through RedisInsight, such as adding String type key-value pairs;
Add Hash type, you can edit a single attribute when editing;
Add JSON type, which can be supported after installing the RedisJSON module;
For native JSON types, it not only supports highlight preview, but also supports adding, editing and deleting individual properties;
CLI
If the graphical interface function of RedisInsight is not enough for you, you can also try its CLI function, and click the CLI tab in the lower left corner to open it;
The intimate Redis official is afraid that you can't remember the command, and also added the function of Command Helper to find command documents. For example, we can search for the usage of the hget command.
Profiler
Through the Profiler function, we can view the command execution log of Redis. For example, we use RedisInsight to add a key-value pair called testKey, and the Profiler will display the following log.
Visual monitoring
The Redis monitoring function of RedisInsight is relatively simple. Personally, I prefer to use Grafana to monitor Redis. For the specific use of Grafana, please refer to the Grafana usage tutorial .
Install Grafana
First download the Grafana Docker image:
docker pull grafana/grafana
Run Grafana after the download is complete;
docker run -p 3000:3000 --name grafana \
-d grafana/grafana
Next, download the Docker image of Prometheus;
docker pull prom/prometheus
Create the Prometheus configuration file prometheus.yml in the /mydata/prometheus/
directory:
global:
scrape_interval: 5s
Run Prometheus and mount the configuration file prometheus.yml in the host into the container;
docker run -p 9090:9090 --name prometheus \
-v /mydata/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
-d prom/prometheus
Enter the grafana container and install the redis-datasource plugin. After the installation is complete, you need to restart the grafana service.
docker exec -it grafana /bin/bash
grafana-cli plugins install redis-datasource
use
To connect to redismod, you need to use its container IP address. Use the following command to view the IP address of the redismod container;
Configure the Redis data source in Grafana, log in with the admin:admin account, and access the address; http://192.168.3.105:3000/
Configure Redis address information, pay attention to the container IP address of redismod;
Open Dashboard and select Redis;
Next, you can see a very complete Redis monitoring dashboard, which can basically meet the monitoring needs of Redis.
Summarize
RedisInsight is worthy of being an official visualization tool, and it feels like the best Redis tool to use at present! Especially the support for the new features of Redis, other tools are unmatched! However, the monitoring function of Redis is indeed a bit simple. You still have to use the professional monitoring tool Grafana to monitor Redis!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。