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

Redis installation documentation

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Download the latest redis installation documentation on the official website: I will download the latest version 5.0 here.

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

Tar-xvf redis-5.0.7.tar.gz

Mv redis-5.0.7 redis

Cd redis

You can use gcc-v to check the installation environment

Then compile and install in the redis directory

Make

After the compilation is successful, it will be generated in the src directory

Redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb these startup files

You can first create a bin directory, and then put these configuration files into cp

Create new run, log and local directories under the redis directory

Profile modification

Vim redis.conf

Bind 0.0.0.0

Daemonize yes

Pidfile / app/redis/run/redis_6379.pid

Logfile "/ app/redis/log/redis.log"

Set the RDB save location

Dir / app/redis/local/redis

Turn on AOF

Appendonly yes

# set password

Requirepass admin

Startup mode:

/ app/redis/bin/redis-server / app/redis/redis.conf &

You can also make init startup scripts:

Vim / etc/init.d/redis-server

#! / bin/bash

#

PATH=$PATH:/app/redis/bin

REDISPORT=6379

EXEC=/app/redis/bin/redis-server

REDIS_CLI=/app/redis/bin/redis-cli

PIDFILE=/app/redis/run/redis_6379.pid

CONF= "/ app/redis/redis.conf"

# make sure some dir exist

If [!-d / var/lib/redis]; then

Mkdir-p / var/lib/redis

Fi

Case "$1" in

Status)

Ps-A | grep redis

Start)

If [- f $PIDFILE]

Then

Echo "$PIDFILE exists, process is already running or crashed"

Else

Echo "Starting Redis server..."

$EXEC $CONF

Fi

If ["$?" = "0"]

Then

Echo "Redis is running..."

Fi

Stop)

If [!-f $PIDFILE]

Then

Echo "$PIDFILE does not exist, process is not running"

Else

PID=$ (cat $PIDFILE)

Echo "Stopping..."

$REDIS_CLI-p $REDISPORT SHUTDOWN

While [- x ${PIDFILE}]

Do

Echo "Waiting for Redis to shutdown..."

Sleep 1

Done

Echo "Redis stopped"

Fi

Restart | force-reload)

${0} stop

${0} start

*)

Echo "Usage: / etc/init.d/redis {start | stop | restart | force-reload}" > & 2

Exit 1

Esac

Chmod overnx / etc/init.d/redis-server

Service redis-server start

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