redis installation and deployment start

1. Redis overview
1.1 Introduction to Redis

Redis is an open source, high-performance key-value database developed in C language. It provides a variety of key-value data types to adapt to storage needs in different scenarios. The key-value data types supported by Redis so far are as follows:

  • string type

  • Hash type

  • list type

  • Collection type

  • ordered set type

1.2 Redis application scenarios
  • Caching (data query, short connection, news content, product content, etc.). ( most used )

  • Session separation in distributed cluster architecture.

  • Chat room's online friends list.

  • Task queue. (Flash sale, rush sale, 12306, etc.)

  • Application rankings.

  • Website visit statistics.

  • Data expiration processing (accurate to milliseconds)

1.3 Features of Redis
  • Redis data access speed is fast (data is in memory)

  • Redis has a data persistence mechanism (there are two persistence mechanisms: 1. Regularly dumping memory data to disk; 2. Aof (append only file) persistence mechanism - recording each data update operation in a log format. Once In the event of a disaster, the entire database can be restored through log replay)

  • redis supports cluster mode (capacity can be expanded linearly)

  • Compared with other caching tools (ehcache/memcached), redis has a distinct advantage: it supports rich data structures

2. Redis installation
2.1 Download Redis

Download address: Download | Redis

Source package download address: Redis · GitHub

Official address: Redis

2.2 Redis installation environment

Redis installation is generally installed under a Linux system, and because redis is developed using C language, a C language environment is required.

  • Linux:CentOS-7.7

  • VMware:15.5

  • C locale:

2.3 Redis installation

Step 1: Install CentOS system (Linux) in VMware.

Step 2: Install the c language environment in the Linux system

# Test whether the server has internet access
 [root@qianfeng01 ~]# ping www.baidu.com
 #Install C language environment
 [root@qianfeng01~]# yum -y install gcc-c++

Step 3: Upload the redis source code package to the Linux system.

Step 4: Unzip the source code package to the specified directory

[root@qianfeng01 ~]# tar -zxvf redis-4.0.14.tar.gz -C /usr/local/
# Enter directory
[root@qianfeng01 ~]# cd /usr/local/redis-4.0.14/

Step 5: Compile the source code package

[root@qianfeng01 redis-4.0.14]# make
2.4 Redis startup
2.4.1 Front-end startup

The front end starts if the client is closed or the ctrl+c command is executed. The entire redis service will also stop.

Start the front end, that is, execute the following command in the client:

[root@qianfeng01 src]# cd ..
[root@qianfeng01 redis-4.0.14]# src/redis-server redis.conf
2.4.2 Backend startup

Modify the redis.conf file

[root@qianfeng01 redis-4.0.14]# vim redis.conf
#Modify binding IP
bind 192.168.10.101 127.0.0.1
#Modify the redis service as a daemon process
daemonize yes
#Log file location
logfile "/usr/local/redis-4.0.14/redis.log"
#Add the following content (set redis password)
requirepass root
#Data persistence directory (current directory)
dir ./

Start the redis service:

# start up
[root@qianfeng01 redis-4.0.14]# ./src/redis-server /usr/local/redis-4.0.14/redis.conf

Check whether it is started

# start up
[root@qianfeng01 redis-4.0.14]# ps -ef | grep redis
root     30562     1  0 09:16 ?        00:00:00 ./src/redis-server 192.168.10.111:6379
root     30591  1666  0 09:17 pts/1    00:00:00 grep --color=auto redis
Guff_hys_python data structure, big data development learning, python training project-CSDN blog

Guess you like

Origin blog.csdn.net/HYSliuliuliu/article/details/135006534