Redis installation Configuration

Source: Internet
Author: User
Tags install redis

One, download and install Redis

cd/usr/local/src/
Wget
TAR-ZXVF redis-2.8.3.tar.gzcd redis-2.8.3makemkdir/usr/local/rediscp redis.conf/usr/local/rediscd./SRCCP REDIS-SERVER/USR/LOCAL/REDISCP REDIS-BENCHMARK/USR/LOCAL/REDISCP redis-cli/usr/local/redisln-sv/usr/local/redis/ Redis-server/usr/local/bin/ln-sv/usr/local/redis/redis-cli/usr/local/bin

At this point, the installation is over, and the following is configuring Redis for the System Management Service.



Second, configure Redis boot

1.1 Edit the Redis configuration file, modify the following parameters

vim/usr/local/redis/redis.conf# By default Redis does not run as a daemon. Use ' yes ' if your need it.# Note that Redis would write a PID file in/var/run/redis.pid when daemonized.daemonize Yes #把no Change to Yes

1.2 Creating the REDISD service

Vim /etc/init.d/redisd# chkconfig: 2345 10 90# description: start and  Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379  #实际环境而定EXEC =/usr/ local/redis/src/redis-server  #实际环境而定REDIS_CLI =/usr/local/redis/src/redis-cli  #实际环境而定  pidfile=/ var/run/redis.pidconf= "/usr/local/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                 if [  "$?" = "0"  ]                 then                         echo  "Redis is running ..."                  fi                ;;         stop)                  if [ ! -f  $PIDFILE  ]                 then                          echo  "$PIDFILE  exists, 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                 ;;         *) &NBsp;               echo  "Usage:  /etc/init.d/redis {start|stop|restart|force-reload} " >&2                 exit 1esac

Note Modify the above PID and exec variables according to your installation location to save the exit.


1.3 Set boot up

Chkconfig--add redisdchkconfig--level REDISD on

At this point, you are done. Test it with service Redis [Start|stop|restart] ...

This article is from the "beginner's mind, always" blog, please be sure to keep this source http://gouyc.blog.51cto.com/1594451/1663334

Redis installation Configuration

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.