Redis Standalone Installation

Source: Internet
Author: User

System: CentOS 6.8 64X

Redis version: redis-3.2.5


Download the installation package

# wget http://download.redis.io/releases/redis-3.2.5.tar.gz


Install the required packages for compilation

# yum-y Install gcc tcl

Create the installation directory

# Mkdir/usr/local/redis

Extract

# tar XVF redis-3.2.5.tar.gz

Compiling the installation

# CD redis-3.2.5

# Make Prefix=/usr/local/redis/install

Create a configuration file, log, RDB, PID, startup script directory

# cd/usr/local/redis/

# mkdir log data pid Initscript conf

Configure Redis startup scripts and rename

# CP ~/redis-3.2.5/utils/redis_init_script/usr/local/redis/initscript/

# cd/usr/local/redis/initscript/

# MV Redis_init_script Redis


modifying startup scripts

# vim Redis

#!/bin/sh## simple redis init.d script conceived towork on linux  systems# as it does use of the /proc filesystem. redisport= 6379exec=/usr/local/redis/bin/redis-servercliexec=/usr/local/redis/bin/redis-cli pidfile=/usr/local/redis /pid/redis_${redisport}.pidconf= "/usr/local/redis/conf/${redisport}.conf"  case  "$"  in    start)        if [ -f  $PIDFILE  ]        then                 echo  "$PIDFILE  exists, processis already running or  crashed "       else                 echo  "Starting redisserver ..."                   $EXEC   $CONF        fi        ;;    stop)        if [ ! -f  $PIDFILE  ]        then                 echo  "$PIDFILE  does notexist, process is not  running "       else                 pid=$ (cat  $PIDFILE)                  echo  "stopping&nbsp ..."                   $CLIEXEC  -p  $REDISPORT  shutdown                while [ -x /proc/${pid} ]                 do                     echo  "waiting forredis to  SHUTDOWN&NBSP: "                     sleep 1                 done                 echo  "redis stopped"        fi        ;;    *)        echo  "Please use start or  stop as first argument "       ;; Esac

Copy the configuration file and modify redis.conf and rename (consistent with startup script)

# cp/home/roger/package/redis-3.2.5/redis.conf/usr/local/redis/conf/

# cd/usr/local/redis/conf/

# MV Redis.conf 6379.conf

# vim 6379. conf

1. Note the bind parameter # bind 127.0.0.12. Turn off protected mode Protected-mode NO3. Set Port prot 63794. Set up Redis to start daemonize yes5 for the background. Set the PID file directory pidfile/usr/local/redis/pid/redis_6379.pid6. Set the log file directory logfile "/usr/local/redis/log/redis_6379.log" 7. Set the Rdb file storage name Dbfilename DUMP_6379.RDB8. Set the Rdb file storage directory dir/usr/local/redis/data/


Modify the firewall to open port 6379

# Vim/etc/sysconfig/iptables

-A input-m state--state new-m tcp-p tcp--dport 6379-j ACCEPT

Restarting the firewall

# Service Iptables Restart

Set Redis to environment variable

# Vim/etc/profile

Export path= $PATH:/usr/local/redis/bin

Make the REDIS environment variable effective

# Source/etc/profile

Start Redis

#/usr/local/redis/initscript/redis Start

Through client inspection

# redis-cli–p 6379

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/8B/E6/wKiom1hbrE-R4b9LAAAO98fRTP0850.png "title=" Sss.png "alt=" Wkiom1hbre-r4b9laaao98frtp0850.png "/>


Turn off Redis

#/usr/local/redis/initscript/redis Stop

Set up Redis for boot

# vim/etc/rc.local

/usr/local/redis/initscript/redis start


This article is from the "10950988" blog, please be sure to keep this source http://10960988.blog.51cto.com/10950988/1885194

Redis Standalone Installation

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.