Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS 7.4How to install redis5.0

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "CentOS 7.4 how to install redis5.0", in daily operation, I believe many people have doubts on how to install redis5.0 CentOS 7.4, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "CentOS 7.4 how to install redis5.0" doubts help! Next, please follow the small series to learn together!

Prepare environment: configure YUM, install gcc

1, Go to Redis official website (redis.io) to download the redis installation package

https://redis.io/download

2. Upload the server and decompress

3. Compile the source program

make

cd src

make install PREFIX=/usr/local/redis #install path

4. Move the configuration file to the redis directory

cp /usr/local/redis/bin/redis.config /etc/

5. Modify the redis.conf configuration file

vi /etc/redis.conf

protected-mode no #Turn off protection mode

daemonize yes #Daemon mode enabled

appendonly yes #(Enable persistence of AOF logging Redis operations)

appendfilename "appendonly-6380.aof" #(AOF file name, configuration port is file name for easy viewing)

6. Start

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

7. Client connection

[root@weblogic-test ~]# /usr/local/redis/bin/redis-cli

127.0.0.1:6379> ping

PONG

127.0.0.1:6379> info

# Server

redis_version:5.0.0

redis_git_sha1:00000000

redis_git_dirty:0

redis_build_id:3ebc09a77c2d0f

8. Stop redis instance

/usr/local/redis/bin/redis-cli shutdown

or

pkill redis-server

9, let redis boot up

vi /etc/rc.local

join

/usr/local/redis/bin/redis-server /etc/redis-conf

##Client fails to log in to Redis server, error, remove protection mode

1. Modify the configuration file of redis server

vi redis.conf

port 6380

pidfile /var/run/redis_6380.pid

logfile "/usr/local/redis/bin/redis_6380.log"

Comments Host addresses bound below

# bind 127.0.0.1

##Set password

1. Log in

[root@weblogic-test ~]# /usr/local/redis/bin/redis-cli -p 6380

2. Check that the current password is empty

127.0.0.1:6380> config get requirepass

1) "requirepass"

2) ""

3. Set password beijing

127.0.0.1:6380> config set requirepass "beijing"

OK

4, check the password again, prompt password verification is required

127.0.0.1:6380> config get requirepass

(error) NOAUTH Authentication required.

5. Password verification

127.0.0.1:6380> auth beijing

OK

6, check the password

127.0.0.1:6380> config get requirepass

1) "requirepass"

2) "beijing"

Configuration of Redis:

daemonize: If you need to run in the background, change the value of this item to yes.

pdifile: Put pid file in/var/run/redis.pid, can be configured to other addresses

bind: Specify redis to receive only requests from this IP. If not set, all requests will be processed. It is best to set this item in the production process.

port: listening port, default is 6379

timeout: Sets the timeout time for client connection, in seconds

Loglevel: There are 4 levels, debug, replay, notice and warning. General opening notice in production environment

logfile: configuration log file address, default to standard output, that is, printed on the port of the command line terminal

database: Set the number of databases. The default database used is 0.

save: Sets the frequency at which redis mirrors the database

rdbcompression: whether compression is performed when a mirror backup is performed

dbfilename: File name of the mirrored backup file

dir: Path where the file for database mirror backup is placed

slaveof: Sets this database as a slave database to another database

masterauth: Set here when password authentication is required for the main database connection

requirpass: password to be used after setting client connection before any other specification

maxclients: Limit the number of clients simultaneously connected

maxmemory: Sets the maximum memory redis can use

appendonly: When appendonly mode is enabled, redis appends each write operation received to the appendonly.aof file. When redis restarts, it restores the previous state from the file.

appendfsync: Sets how often appendonly.aof files are synchronized

vm_enabled: whether to enable virtual memory support

vm_swap_file: Sets the path of the swap file for virtual memory

vm_max_momery: Set the maximum physical memory size that redis will use when virtual memory is enabled. Default is 0.

vm_page_size: Sets the size of a virtual memory page

vm_pages: Sets the total number of pages to swap files

vm_max_thrrads: Sets the number of threads vm IO uses simultaneously

At this point, the study of "how to install redis5.0 in CentOS 7.4" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report