Centeros installation Redis and start-up settings detailed _linux

Source: Internet
Author: User
Tags redis redis server

Centeros installation Redis and boot start Setup detailed

From the official download of the latest Redis for 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 start

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 Redis boot

1: Configure the Init script, save the Code as Reids, and place it in the/etc/init.d/

########################### # chkconfig:2345 Description:redis is a persistent key-value database PATH=/usr/l Ocal/bin redisport=6379 exec=/usr/local/bin/redis-server redis_cli=/usr/local/bin/redis-cli #Redis密码 PASSWORD= YourPassword pidfile=/var/run/redis.pid conf= "/usr/local/reids/conf/redis.conf" case "in Start" if [-f $PIDF  ILE] 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 does not exist, the process is not running" else PI d=$ (cat $PIDFILE) echo "Stopping ..." $REDIS _cli-p $REDISPORT-a $PASSWORD SHUTDOWN while [-X ${ Pidfile}] do echo waiting for Redis to shutdown ... "Sleep 1 done echo" Redi
  S stopped "FI;; Restart|force-reload) ${0} stop ${0} start;; *) echo "Usage:/etc/init.d/redis {start|stop|restart|force-reload}" >&2 exit 1 Esac

 ######

Precautions:

1 The top note means that the Redis service must be started or closed under 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 $ '/R ': Command not found, this problem is different in line wrapping and Linux wrapping under Windows, which can be converted by nodepad++.

2: Set script permissions

 
 

3: Set boot up

 
 

4: How to use

Service Redis start  #或者/etc/init.d/redis start
service redis stop  #或者/etc/init.d/redis stop

 

Thank you for reading, I hope to help you, thank you for your support for this site!

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.