redis7 installation and startup

1. Overview of redis

redis: It is a remote dictionary server and a memory-based key-value Nosql database.


Official explanation: Remote Dictionary Server (remote dictionary service) is completely open source, written in ANSIC language and complies with the BSD protocol. It is a high-performance Key-Value database that provides rich data structures, such as String, Hash, List, Set, SortedSet etc. Data exists in memory, and Redis supports transactions, persistence, LUA scripts, publish/subscribe, cache elimination, streaming technology and other functional features Provides master-slave mode, Redis Sentinel and Redis Cluster cluster architecture solutions

Features :

  1. Supports multiple data structures (lists, maps, sets and sorted sets, etc.)
  2. single thread single process
  3. The data is stored in memory, and the reading and writing speed is fast
  4. Support data persistence

2. Redis installation

1. Go to the official website to download the zip archive

Redis official website: Redis

insert image description here


Redis Chinese address: CRUG website (redis.cn) , this Chinese, the disadvantage is that the version of Redis may not be the latest.


Redis Chinese Documentation


2. Download gcc


gcc is a programming program under Linux and a compiling tool for C programs. I need to install gcc if I want to compile redis.

yum -y install gcc c++


Figure 1:

insert image description here

Figure II :

insert image description here


Redis has been installed, let's start Redis

3. Start redis

Figure 1: Modify the configuration file before starting

insert image description here

Figure II :

insert image description here

Figure 3:

insert image description here

Let's complete the writing of a hello world

insert image description here

quit just exits the redis client, but does not close the redis server, so let's close it

  1. Single instance shutdown:redis-cli -a 1234 shutdown
  2. Multiple instances are closed, and the specified port is closed:redis-cli -p 6379 shutdown

insert image description here

ps and grep combined command use _ps |grep_She_lock


Summarize :

启动 redis 服务器

redis-server + 配置文件所在的地方
例如 : redis-server /myredis/redis7.conf


连接服务器 : 

redis-cli +  -a  + 密码 + -p + 端口号
例如 : redis-cli -a 1234 -p 6379

退出客户端 :
quit

关闭服务器 :

处于连接状态 : 直接输入 shutdown  , 然后输入 quit 退出客户端.

在任何地方关闭服务器 :  redis-cli -a 1234 (这里可以指定 需要关闭 redis 的端口号) shutdown

例如 :  redis-cli -a 1234 -p 6379 shutdown

4. Redis uninstall

The deletion here is very simple. Didn’t we use the default installation to install redis before? The installation location is in the /usr/local/bin directory. To delete here, just delete the relevant redis in the bin directory.

1. 查找 /usr/local/bin 目录下所有与 redis 有关的文件
ls -l /usr/local/bin/redis- *

2. 执行删除操作 : rm rf /usr/local/bin/redis- *

3. 最后可以在执行 : ls -l /usr/local/bin/ redis- * 查看一下是否删除干净了.

Guess you like

Origin blog.csdn.net/mu_tong_/article/details/130353014