Redis Installation and boot setup in Centeros

Source: Internet
Author: User
Tags redis server

Redis Installation

From the official download of the latest Redis installation, official website address: http://redis.io/download

$ wget http://download.redis.io/releases/redis-3.2.3.tar.gz$ tar xzf redis-3.2. 3 . tar.gz$ CD Redis-3.2. 3 $ make$ Make install

Redis Boot

Redisserver/path/to/redis.conf

Redis Off (default port is 6379)

Rediscli-p port-a Password shutdown

View the Reids process

Ps-ef|grep Redis

Set up Redis Boot 1: Configure the Init script, save the Code as Reids, and put it in/etc/init.d/
############################ chkconfig:2345  - Ten# Description:redis isA persistent key-value DatabasePath=/usr/local/Binredisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-Cli#redis Password Password=Yourpasswordpidfile=/var/run/redis.pidconf="/usr/local/reids/conf/redis.conf"    Case " $" inchstart)if[ -F $PIDFILE] then echo"$PIDFILE exists, process is already running or crashed"        ElseEcho"starting Redis Server ..."$EXEC $CONF fiif["$?"="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-a $PASSWORD SHUTDOWN while[ -x ${pidfile}] DoEcho"waiting for Redis to shutdown ..."Sleep1Done Echo"Redis stopped"fi;; Restart|force-Reload) ${0} stop ${0} start; *) echo"Usage:/etc/init.d/redis {start|stop|restart|force-reload}">&2Exit1esac##############################
Precautions:

1) The top note means that the Redis service must be started or shut down at run level 2,3,4,5, the priority of the boot is 90, and the priority of the shutdown is 10.     

  2) If the Execute command appears with $ '/R ': Command not found, this problem is different under Windows line break and Linux, can be converted by nodepad++.

2: Set script permissions
chmod +x/etc/init.d/redis  
3: Set Boot boot
sudo chkconfig redis on  
4: How to use
Service Redis start   #或者/etc/init.d/redis startservice redis stop   /etc/init.d/redis stop

Redis Installation and boot setup in Centeros

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.