redis2.8 Installation Small Test

Source: Internet
Author: User

Installation Environment:

CentOS 6.5

Redis redis-2.8.13

Download the installation:

1 , switch to the/usr/local/src/directory:

[Email protected] ~]# CD/USR/LOCAL/SRC

Download the source package:

[email protected] src]# wget http://download.redis.io/releases/redis-2.8.23.tar.gz

2 , Decompression:

[Email protected] src]# Tar XF redis-2.8.23.tar.gz

3 , switch to the redis-2.8.23 directory:

[Email protected] src]# CD redis-2.8.23

4 , install the Redis to/usr/local/redis directory:

[email protected] redis-2.8.23]# make Prefix=/usr/local/redisinstall

5 , provide SYSV init script for Redis:

[Email protected] redis-2.8.23]# Vim/etc/rc.d/init.d/redis

#!/bin/sh

# chkconfig:2345 83 93

# simple Redis INIT.D script conceived to work on Linuxsystems

# as it does use of the/proc filesystem.

#

# simple Redis INIT.D script conceived to work on Linuxsystems

# as it does use of the/proc filesystem.

redisport=6379

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

Cliexec=/usr/local/redis/bin/redis-cli

Pidfile=/var/run/redis.pid

conf= "/etc/redis/redis.conf"

Case "$" in

Start

If [-F $PIDFILE]

Then

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

Else

echo "Starting Redis server ..."

$EXEC $CONF &

Fi

;;

Stop

if [!-F $PIDFILE]

Then

echo "$PIDFILE does not exist, process was not running"

Else

pid=$ (Cat $PIDFILE)

echo "Stopping ..."

$CLIEXEC-P $REDISPORT shutdown

While [-x/proc/${pid}]

Do

echo "Waiting for Redis to shutdown ..."

Sleep 1

Done

echo "Redis stopped"

Fi

;;

*)

echo "Startor stop as first argument"

;;

Esac

6 , give the script Execute permissions:

[Email protected] redis-2.8.23]# chmod U+x/etc/rc.d/init.d/redis

7 , add to the service management list, and let it boot automatically:

[Email protected] redis-2.8.23]# chkconfig--add/etc/rc.d/init.d/redis

[[email protected] redis-2.8.23]# chkconfig Redis on

8 , creating a Redis persistence file directory

Mkdir-pv/var/redis/data

9 , create a configuration file to store the directory

[Email protected] redis-2.8.23]# Mkdir/etc/redis

Ten , providing configuration files

[Email protected] redis-2.8.23]# cp/usr/local/src/redis-2.8.23/redis.conf/etc/redis/

One , edit the configuration file change the following options are values

[Email protected] redis-2.8.23]# vim/etc/redis/redis.conf

Daemonizeyes # make Redis run in daemon mode

Dir/var/redis/data # Set Persistent file location, path customizable

A , start the service

[[Email protected] redis-2.8.23]# service Redis start

- , check the service port

[Email protected] redis-2.8.23]# NETSTAT-TUNL | grep 6379

TCP 0 00.0.0.0:6379 0.0.0.0:* LISTEN

- , modify the PATH environment variable so that the system can directly use Redis's related commands:

[Email protected] ~]# echo ' exportpath=/usr/local/redis/bin: $PATH ' >/etc/profile.d/redis.sh

[Email protected] ~]# source/etc/profile.d/redis.sh

the , use the Redis Client tool to connect to Redis for testing:

[Email protected] ~]# REDIS-CLI

127.0.0.1:6379> Set Hello World

Ok

127.0.0.1:6379>

127.0.0.1:6379> Get Hello

"World"

127.0.0.1:6379> quit

[Email protected] ~]#

The installation test for this redis has been completed.


redis2.8 Installation Small Test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.