1 introduction

Redis is a high performance NoSQL database based on key-value developed using ANSI C language. It plays an important role in solving a series of problems such as high concurrency and high availability. Its main advantages are:

  • Speed is fast.
  • Persistence.
  • Atomicity.
  • Rich data structure.
  • Multilingual support.

This article will briefly introduce how to install Redis through Docker, and simple use and operation.

2 Docker Installation and Use

2.1 Docker installation

Pull the Redis image and select the latest stable version 5.0.8:

$ docker pull redis:5.0.8Copy the code

It is recommended to configure ali cloud as the mirror, which will be much faster. After the pull is successful, you can run the following command to check:

$ docker images |grep redisCopy the code

Start the Redis:

$docker run-itd --name redis -p 6379:6379 redis:5.0.8Copy the code

Run the following command to check whether the startup is successful:

$ docker ps|grep redisCopy the code

Into a container:

$ docker exec -it redis /bin/bashCopy the code

Connect to the database in the container using the Redis command line tool:

$ redis-cli -h localhost -p 6379Copy the code

You can also omit hostname and port. The default is 127.0.0.1:6379.

After the connection is successful, you can operate:

You can do a simple performance test on your installed Redis by using the following command:

$ redis-benchmark -n 100000 -qCopy the code

The results are as follows:

You can see that although it is installed through Docker, the performance is still good. About 45,000 read and write operations per second.

2.2 Common Operations of Redis

Redis data structure is rich, powerful, briefly introduce some common commands:

Redis-server [--port 6379] [-h 127.0.0.1 -p 6379] [-h 127.0.0.1 -p 6379 Type key # delete del key1 key2 key3 key list keys pattern # query key life cycle TTL key PTTL key # increase and decrease value (for numbers) incr key incrby key  step decr key decrby key stepCopy the code

Too many, not one list, you can go to (www.redis.cn/commands.ht…

3 Visualized client

Sometimes it is not very convenient to view and operate through the command line. There are many visual clients of Redis. The following four are introduced.

3.1 RedisClient

Visual tools based on Java SWT and Jedis development. Open source, free for Windows, Linux and Mac, github.com/caoxinyu/Re… But it hasn’t been updated for a long time.

3.2 RedisStudio

The free visualization tool for Windows has also not been updated in a long time.

3.3 RedisDesktopManager

A cross-platform tool based on Qt 5. Windows, Linux and Mac are supported, but for a fee, and not cheap.

3.4 AnotherRedisDesktopManager

An excellent and beautiful open source free visualization tool, support Windows, Linux and Mac, support Chinese and English switch, dark white theme switch. After comparison, I think this one is the best.

The Github address is github.com/qishibo/Ano…

You can download and install it from Github. After successful installation, the configuration connection is as shown in the figure below:

You can query, add, modify, and delete keys.

It also provides command line tools, which are really sweet:

4 summarizes

This article introduces how to use Redis via Docker installation. Of course, if you don’t want to bother, you can directly experience the online version of ‘Re’ at the official website (try.redis. IO /).

Also introduced the four Redis visualization client tools, through comparison, think AnotherRedisDesktopManager work well.


Visit pumpkin Talk www.pkslow.com for more exciting articles!

Welcome to pay attention to the wechat public number “Pumpkin slow Talk”, will continue to update for you…

Read more and share more; Write more. Organize more.