Redis installation Deployment under CentOS

Source: Internet
Author: User
Tags redis version redis server

The Redis version installed is redis-3.0.2

Please follow these steps strictly

You can exempt the following errors

1 Make[2]: Cc:command not found

Exception reason: GCC is not installed

Solution: Yum Install gcc-c++

2 Redis service does not support Chkconfig

Exception reason/etc/init.d/redis No code to add Chkconfig

===== officially started =====

1 Redis Dependent environments

Gcc

Yum Install gcc -y

Tcl

Yum Install tcl-y

2 Download the appropriate tar package. Unzip, install

cd/usr/local# Redis-3.0. 2. tar. GZ placed in the/usr/local directory, personal preferences .... tar -zxvf redis-3.0. 2. Tar . GZCD Redis-3.0. 2  Make  Make Test  Make Install

3 copying redis-cli redis-server to/etc/redis

--After make succeeds, there are some more executables in the SRC directory: REDIS-SERVER,REDIS-CLI, etc.

CD src CP redis-server/usr/local/bin/CP redis-cli/usr/local/bin/# Then create a new directory that holds the configuration file mkdir /etc/redismkdir /var/redismkdir /var/redis/logmkdir /var/ redis/Runmkdir /var/redis/6379

4 Copy config file to/etc/redis, and modify

CD.. CP redis.conf/etc/redis/6379. conf
cd/etc/redis/

6379 where the configuration file needs to be modified

daemonize Yes   /var/redis/run//var/redis/log/redis_6379.logdir /var/redis/6379

5 Start

cd/user/local/redis-3.0. 2/src/redis-server/etc/redis/6379. conf

6 Testing

127.0. 0.1 6379  "xiaoshou"// Set value  ==> OK// value ==>  "Xiaoshou"

7 Booting up Redis

You need to add Redis as a service here

Adding Redis files to/etc/init.d/

cd/etc/init.d/vim Reids
# Redis file contents are as follows
########################### #chkconfig:2345 Ten  -#description: Start and Stop Redispath=/usr/local/bin:/sbin:/usr/bin:/bin Redisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-CLI Pidfile=/var/run/redis.pidconf="/etc/redis.conf"    Case " $" inchstart)if[ -F $PIDFILE] Then                Echo "$PIDFILE exists, process is already running or crashed"        Else                Echo "starting Redis Server ..."$EXEC $CONFfi        if["$?"="0" ]          Then              Echo "Redis is running ..."        fi        ;; Stop)if[ ! -F $PIDFILE] Then                Echo "$PIDFILE does not exist, process was not running"        ElsePID=$(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}">&2Exit1Esac##############################

8 Giving execution permission

chmod +x/etc/init.d/redis

9 Adding services

cd/etc/int. d/CHKCONIFG  --

Switch for Redis service

Service Redis StartService Redis stop

Redis installation Deployment under CentOS

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.