Learn from a novice to understand Redis and learn to install it

Introduction to Redis and detailed installation process

Introduction to Redis

Redis (Remote Dictionary Server), the remote dictionary service, is an open source log-type, Key-Value database written in ANSI C language, supports the network, and can be memory-based and persistent. It supports storing relatively more value types, including string (string), list ( linked list ), set (set), zset (sorted set - ordered set) and hash (hash type). These data types all support push/pop, add/remove, intersection, union, difference, and richer operations, and these operations are all atomic.

On this basis, redis supports various different ways of sorting. Like memcached, data is cached in memory to ensure efficiency. The difference is that redis will periodically write updated data to disk or write modification operations to additional record files, and on this basis, master-slave (master-slave) synchronization is achieved. Redis supports master-slave synchronization. Data can be synchronized from the master server to any number of slave servers, which can be master servers associated with other slave servers, with very fast non-blocking first synchronization, automatic reconnection and partial resynchronization on network partitions. This allows Redis to perform single-level tree replication.

The installation process is as follows

window system installation process

Download the installation package: https://github.com/dmajkic/redis/releases
--------->>Unzip------->>Double-click to install---->>Open when completed.

Linux system installation process

step 1: Install the compilation environmentyum install gcc-c++

step 2: Upload the source code package to Linux

step 3: Unzip the installation packagetar -xzvf redis-5.0.5.tar.gz

Step 4: Enter makethe command: redis has already written the make file itself; that is to say, there is no need to execute configure. The compiled file after make will be saved in the src directory.

Enter make in the path of the redis folder

Step 5: Input make install: Copy the binary files in the src directory to the /usr/local/bin/ directory; since saving the files in the /usr/local/bin/ directory is inconvenient to manage, we save the files uniformly Go to the /usr/local/redis/bin/ directory.

mkdir -p /usr/local/redis/bin/
cd src
cp redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/

step 6: Modify environment variables in the src directory

cd /opt/software/redis-5.0.5/src

vi /etc/profile

添加: export PATH=/usr/local/redis/bin:$PATH

step 7: Start redis

redis-server

step 8: Start the client

redis-cli

Such startup will cause the page to get stuck, and background startup needs to be configured.

Configure background startup:

step 9: There is a redis.conf file in the redis directory, open this file

vim redis.conf

step 10: Configuration file

protected-mode no
bind 0.0.0.0
//后台
daemonize yes
//找到这个选项,放开注射
requirepass xx123   //这是设置的一个密码:防止攻击

Installed! !

Let me teach you a little trick: directly enter a /searched word, and the words you want to find will be checked in batches, and then press the ikey under English to edit. After editing, press the esc key to return, :wqsave and exit.

Step 11: Copy the configuration file to the local directory

cp /opt/software/redis-5.0.5/redis.conf /usr/local/redis/bin/

step 12: Start

cd /usr/local/redis/bin
./redis-server redis.conf

step 13: Client

./redis-cli -h 0.0.0.0  -a 密码

Insert image description here

client

./redis-cli -h 0.0.0.0  -a 密码

[External link pictures are being transferred...(img-xuRzazDw-1591599966659)].jpg)

All installed successfully!

Guess you like

Origin blog.csdn.net/weixin_47294072/article/details/106619650