Full stack development practice - Redis

introduce

Redis is an open source in-memory key-value data store. It can be used as a database, cache and message broker and supports various data structures such as strings, hashes, lists, sets, etc. Redis provides high availability via Redis Sentinel including monitoring, notifications, automatic failover. It also provides automatic partitioning among multiple Redis nodes using Redis Cluster.

Install

First update the apt package list:

sudo apt update

Install Redis:

sudo apt install redis-server

After the installation is complete, the Redis service will start automatically. You can check the status of the service by typing:

sudo systemctl status redis-server

Configure Redis Remote Access

Open the Redis configuration file with the vim text editor:

vim /etc/redis/redis.conf

Find the line starting with bind 127.0.0.1 and replace 127.0.0.1 with 0.0.0.0.

Configure the number of databases

Generally not recommended to set! ! !

The default number of databases is 16. If there are too many projects, it may not be enough. For example, a company's server may have dozens or hundreds of projects, all of which require separate db, so you need to modify this here.

Configure password

You can set requirepass in the security module of the configuration file.

restart Redis

sudo systemctl restart redis-server

Using the vim editor

The functions of vim are relatively comprehensive, and you can search for tutorials on the Internet by yourself. We only use the following ones here.

  • Press Backspace to delete characters
  • Press the Insert key to insert characters
  • Press Esc to exit edit mode
  • Type: wq to leave and save content

Redis graphical management tool

There are many redis graphical management tools, both free and paid. Here we use https://github.com/qishibo/AnotherRedisDesktopManager , which supports Linux, mac, and windows.

  • You can log in using ssh:

  • It is also possible to log in with a password:

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324136812&siteId=291194637