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

Centos7.6 installs redis5.0.4 stand-alone

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Centos7.6 install redis5.0.4

View list

Http://download.redis.io/releases/

The latest stable version is 5.0.6.

[] redis-5.0.6.tar.gz

[root@VM_147_31_centos src] # cat / etc/redhat-release

CentOS Linux release 7.6.1810 (Core)

[root@VM_147_31_centos src] # uname-a

Linux VM_147_31_centos 3.10.0-957.21.3.el7.x86_64 # 1 SMP Tue Jun 18 16:35:19 UTC 2019 x86 "64 GNU/Linux

[root@VM_147_31_centos src] #

Create a directory

Mkdir / home/redis

Enter the directory

Cd / home/redis/

Download redis

Wget http://download.redis.io/releases/redis-5.0.4.tar.gz

Compile

Extract the redis:

Tar-xvf redis-5.0.4.tar.gz

Compile redis (Tencent's experimental environment has already installed GCC, so it can be compiled directly):

Enter the redis decompression directory

Cd redis-5.0.4/

Compile

Make

Installation

Install redis with make

Make install PREFIX=/usr/local/mysoft/redis

At the back is your own installation path. The PREFIX parameter specifies the directory where redis is installed. General software is installed in the / usr directory

[root@VM_147_31_centos redis-5.0.4] # ll / usr/local/mysoft/redis/

Total 4

Drwxr-xr-x 2 root root 4096 Nov 13 17:53 bin

[root@VM_147_31_centos redis-5.0.4] # ll / usr/local/mysoft/redis/bin/

Total 32700

-rwxr-xr-x 1 root root 4366640 Nov 13 17:53 redis-benchmark

-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-aof

-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-rdb

-rwxr-xr-x 1 root root 4806872 Nov 13 17:53 redis-cli

Lrwxrwxrwx 1 root root 12 Nov 13 17:53 redis-sentinel-> redis-server

-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-server

[root@VM_147_31_centos redis-5.0.4] #

Modify configuration

Since the installation directory is only a binary file and does not contain configuration files, here we need to copy the configuration file of the compiled directory. We first go to the installation directory, cd / usr/local/mysoft/redis copy the configuration file, and name it single.conf by the way

Cp / home/redis/redis-5.0.4/redis.conf single.conf

Modify the configuration file to change redis startup to background startup

Edit / home/redis/redis-5.0.4/single.conf

Type ctrl+F to search, find daemonize no, change no to yes, and type ctrl+S to save.

[root@VM_147_31_centos redis-5.0.4] # cp / home/redis/redis-5.0.4/redis.conf single.conf

[root@VM_147_31_centos redis-5.0.4] # vi / home/redis/redis-5.0.4/single.conf

[root@VM_147_31_centos redis-5.0.4] #

[root@VM_147_31_centos redis-5.0.4] # grep daemonize / home/redis/redis-5.0.4/single.conf

# Note that Redis will write a pid file in / var/run/redis.pid when daemonized.

Daemonize yes

# When the server runs non daemonized, no pid file is created if none is

# specified in the configuration. When the server is daemonized, the pid file

Output for logging but daemonize, logs will be sent to / dev/null

[root@VM_147_31_centos redis-5.0.4] # pwd

/ home/redis/redis-5.0.4

[root@VM_147_31_centos redis-5.0.4] #

Start redis-server

Cd src

. / redis-server.. / single.conf

Check to see if redis starts normally

Ps aux | grep redis

[root@VM_147_31_centos redis-5.0.4] # cd src

[root@VM_147_31_centos src] #. / redis-server.. / single.conf

28677:C 13 Nov 2019 17:56:42.855 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

28677:C 13 Nov 2019 17:56:42.855 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=28677, just started

28677:C 13 Nov 2019 17:56:42.855 # Configuration loaded

[root@VM_147_31_centos src] # ps-ef | grep redis

Root 28678 1 0 17:56? 00:00:00. / redis-server 127.0.0.1:6379

Root 28700 22792 0 17:56 pts/0 00:00:00 grep-color=auto redis

[root@VM_147_31_centos src] #

Test and test

Connect to the native redis using the redis-cli client

. / redis-cli-h 127.0.0.1-p 6379

Set value

Set test 123456

Get the value

Get test

[root@VM_147_31_centos src] #. / redis-cli-h 127.0.0.1-p 6379

127.0.0.1 purl 6379 > set test 123456docker19.3

OK

127.0.0.1 purl 6379 > get test

"123456docker19.3"

127.0.0.1 purl 6379 > exit

[root@VM_147_31_centos src] #

[root@VM_147_31_centos bin] # pwd

/ usr/local/mysoft/redis/bin

[root@VM_147_31_centos bin] # ll

Total 32700

-rwxr-xr-x 1 root root 4366640 Nov 13 17:53 redis-benchmark

-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-aof

-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-rdb

-rwxr-xr-x 1 root root 4806872 Nov 13 17:53 redis-cli

Lrwxrwxrwx 1 root root 12 Nov 13 17:53 redis-sentinel-> redis-server

-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-server

[root@VM_147_31_centos bin] #. / redis-cli-v

Redis-cli 5.0.4

[root@VM_147_31_centos bin] #

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

Servers

Wechat

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

12
Report