Redis installation configuration record under CentOS 6.6

Source: Internet
Author: User
Tags install redis redis server value store

Reproduced in: http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/120.html?1455855209

In the previous article, Redis was introduced, and the following is a record of installing Redis on CentOS. For later in making improvements.

1, install the required support environment

The first thing to do before you install Redis is the TCL tool that installs Unix, and you won't be able to test Redis later if you don't install it. The following error message is returned when you execute make test later: Need TCL 8.xuyao de5 or newer in order to run the Redis test, the specific process is:

The code is as follows:


Cd/usr/local/src
wget http://downloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gz
TAR-ZXVF tcl8.6.3-src.tar.gz
CD tcl8.6.3/unix/
./configure
Make
Make install

2. Installing Redis

The process of installing Redis is very simple and the specific tutorials are available on the website. Specific as follows: Http://redis.io/download

The code is as follows:


Cd/usr/local/src
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
Tar zxvf redis-2.8.19.tar.gz
CD redis-2.8.19
Make
Make Prefix=/usr/local/redis Install

Where Prefix=/usr/local/redis can be omitted and, in the case of ellipsis, Redis is installed by default into the/usr/local/bin directory.

3. Test Redis

The code is as follows:


CD src
Make Test

With the above command, Redis can be tested in greater measure.

#p # pagination Header #e#4, configuring Redis

A. Copy and modify the configuration document

The code is as follows:


CP./redis.conf/usr/local/redis/
Vim/usr/local/redis/redis.conf

I only modified the following two items:

Daemonize Yes #redis将以守护进程的方式运行, default to No will take up your terminal
Timeout #当 The client is idle for how long after the connection is closed, and if specified as 0, turns off the feature

More configuration content, follow-up carding is completed and then released.

B. Set auto-start

The code is as follows:


Vim/etc/init.d/redis

File, save the following:

The code is as follows:


#!/bin/sh
#
# redis Startup script for Redis Server
#
# Chkconfig:-80 12
# Description:redis is a open source, Advanced Key-value store.
#
# Processname:redis-server
# config:/etc/redis.conf
# Pidfile:/var/run/redis.pid
Source/etc/init.d/functions
Bin= "/usr/local/redis/bin"
Config= "/usr/local/redis/redis.conf"
Pidfile= "/var/run/redis.pid"
# # Read Configuration
[-R "$SYSCONFIG"] && source "$SYSCONFIG"
Retval=0
Prog= "Redis-server"
desc= "Redis Server"
Start () {
If [-e $PIDFILE];then
echo "$desc already running ..."
Exit 1
Fi
Echo-n $ "Starting $desc:"
Daemon $BIN/$prog $CONFIG
retval=$? #p # pagination Title #e#
Echo
[$RETVAL-eq 0] && touch/var/lock/subsys/$prog
Return $RETVAL
}
Stop () {
Echo-n $ "Stop $desc:"
Killproc $prog
Retval=$?
Echo
[$RETVAL-eq 0] && rm-f/var/lock/subsys/$prog $PIDFILE
Return $RETVAL
}
Restart () {
Stop
Start
}
Case "$" in
Start
Start
;;
Stop
Stop
;;
Restart
Restart
;;
Condrestart)
[-e/var/lock/subsys/$prog] && restart
Retval=$?
;;
Status
Status $prog
Retval=$?
;;
*)
echo $ "Usage: $ {Start|stop|restart|condrestart|status}"
Retval=1
Esac
Exit $RETVAL

C. Start or close the service

The code is as follows:


Service Redis Start
Service Redis Stop


5. Using Redis

The code is as follows:


[Email protected] redis]# Cd/usr/local/redis/bin
[Email protected] bin]#./redis-cli
127.0.0.1:6379> set Foo Bar
Ok
127.0.0.1:6379> get foo
"Bar"
127.0.0.1:6379>

Redis installation configuration record under CentOS 6.6

Related Article

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.