4

在这里插入图片描述
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!


xiangzhihong
5.9k 声望15.3k 粉丝

著有《React Native移动开发实战》1,2,3、《Kotlin入门与实战》《Weex跨平台开发实战》、《Flutter跨平台开发与实战》1,2和《Android应用开发实战》