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

Install redis (3.2.9)

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Install redis (3.2.9)

1.redis official website address: https://redis.io/

two。 Deployment and installation of redis3.2.9 Experimental Environment: centos 6.5

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

Yum install automake autoconf ruby rubygems-y # install dependent plug-ins

Make & & make install # the default installation is used here

3. Create a corresponding directory

Mkdir-p / usr/local/redis/bin/

Mkdir / usr/local/redis/ & & mkdir-p / data/redis/

4. Execute the installation script to install

[root@caosm103 utils] #. / install_server.sh

Welcome to the redis service installer

This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 6379

Please select the redis config file name [/ etc/redis/redis.conf] / usr/local/redis/redis_6378.conf

Please select the redis log file name [/ var/log/redis_6379.log] / usr/local/redis/redis_6378.log

Please select the data directory for this instance [/ var/lib/redis/6379] / data/redis/

Please select the redis executable path [/ usr/local/bin/redis-server] / usr/local/redis_6379/bin

Selected config:

Port: 6379

Config file: / usr/local/redis/redis.conf

Log file: / usr/local/redis/redis_6379.log

Data dir: / data/redis/

Executable: / usr/local/bin/redis-server

Cli Executable: / usr/local/bin/redis-cli

Is this ok? Then press ENTER to go on or Ctrl-C to abort.

5. Service enabled status

[root@caosm103 redis] # redis-server redis.conf

# Program configuration file configuration file where the bind ip address has been changed to the local ip address

6. Modify startup script

#! / bin/sh

# BEGIN INIT INFO

# Provides: redis-server

# Required-Start: $syslog

# Required-Stop: $syslog

# Should-Start: $local_fs

# Should-Stop: $local_fs

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: redis-server-Persistent key-value db

# Description: redis-server-Persistent key-value db

# END INIT INFO

# Note that you need to create the redis user redis.conf redis_6379.pid redis_6379.log / data/redis owner to change to redis, and grant the execution permission 755

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DAEMON=/usr/local/bin/redis-server

DAEMON_ARGS=/usr/local/redis/redis.conf

NAME=redis-server

DESC=redis-server

PIDFILE=/var/run/redis_6379.pid

Test-x $DAEMON | | exit 0

Test-x $DAEMONBOOTSTRAP | | exit 0

Set-e

Case "$1" in

Start)

Echo-n "Starting $DESC:"

Touch $PIDFILE

Chown redis:redis $PIDFILE

If start-stop-daemon-start--quiet-pidfile $PIDFILE-chuid redis:redis-exec $DAEMON-$DAEMON_ARGS

Then

Echo "[OK]"

Else

Echo "failed"

Fi

Stop)

Echo-n "Stopping $DESC:"

If start-stop-daemon-stop--retry 10-quiet-oknodo-pidfile $PIDFILE-exec $DAEMON

Then

Echo "[OK]"

Else

Echo "failed"

Fi

Rm-f $PIDFILE

Status)

If [!-r $PIDFILE]; then

Echo "redis-server is stopped"

Exit 0

Fi

PID= `cat $PIDFILE`

If ps-p $PID | grep-Q $PID; then

Echo "redis-server (pid $PID) is running..."

Else

Echo "redis-server dead but pid file exists"

Fi

Restart | force-reload)

${0} stop

${0} start

*)

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

Exit 1

Esac

Exit 0

7. Install start-stop-daemon

[root@caosm103 src] # wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz

[root@caosm103 src] # tar zxf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz

[root@caosm103 src] # mv apps/sys-utils/start-stop-daemon-IR1_9_18-2 /. /

[root@caosm103 src] # ls

Apps apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz nginx-1.8.0 redis-3.2.9 redis-3.2.9.tar.gz start-stop-daemon-IR1_9_18-2

[root@caosm103 src] # rm-rf apps

[root@caosm103 src] # cd start-stop-daemon-IR1_9_18-2 /

[root@caosm103 start-stop-daemon-IR1_9_18-2] # cc start-stop-daemon.c-o start-stop-daemon

[root@caosm103 start-stop-daemon-IR1_9_18-2] # cp start-stop-daemon / usr/local/bin/start-stop-daemon

Introduction of start-stop-demo parameters

Root@caosm103 redis] # start-stop-daemon-- help

Start-stop-daemon 1.9.18 for Debian-small and fast C version written by

Marek Michalkiewicz, public domain.

Usage:

Start-stop-daemon-S |-- start options...-- arguments.

Start-stop-daemon-K |-- stop options.

Start-stop-daemon-H |-- help

Start-stop-daemon-V |-- version

Options (at least one of-exec |-- pidfile |-- user is required):

-x |-- exec program to start/check if it is running

-p |-- pidfile pidfile to check

-c |-- chuid

Change to this user/group before starting process

-u |-- user | stop processes owned by this user

-n |-- name stop processes with this name

-s |-- signal signal to send (default TERM)

-a |-- startas program to start (default is)

-N |-- nicelevel add incr to the process's nicelevel

-b |-- background force the process to detach

-m |-- make-pidfile create the pidfile before starting

-R |-- retry check whether processes die, and retry

-t |-- test test mode, don't do anything

-o |-- oknodo exit status 0 (not 1) if nothing done

-Q |-- quiet be more quiet

-v |-- verbose be more verbose

Retry is | / /... Where is one of

-| [-] send that signal

Wait that many seconds

Forever repeat remainder forever

Or may be just, meaning / / KILL/

Exit status: 0 = done 1 = nothing done (= > 0 if-- oknodo)

3 = trouble 2 = with-- retry, processes wouldn't die

8. Start the test:

[root@caosm103 redis] # / etc/init.d/redis-server stop

Stopping redis-server: [OK]

[root@caosm103 redis] # / etc/init.d/redis-server start

Starting redis-server: [OK]

[root@caosm103 redis] #

[root@caosm103 redis] # / etc/init.d/redis-server restart

Stopping redis-server: [OK]

Starting redis-server: [OK]

Now all can run normally!

Introduction to 9.redis tools

Redis-benchmark performance testing tool

Redis-check-aof log file tester (for example, log damage caused by power outage, which can be detected and repaired)

Redis-check-dump snapshot file detection tool, on the effects class

Redis-cli client

Redis-server server

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