Linux Installation Redis Service

Source: Internet
Author: User
Tags redis server

Http://download.redis.io/releases/redis-3.2.0.tar.gz

Official website Http://redis.io/download

1. Download the installation package

Cd/tmp

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

2. Extract

TAR-ZXVF redis-3.2.0.tar.gz

3. Installation

Mkdir/usr/local/redis

CD redis-3.2.0

  Make Prefix=/usr/local/redis Install//I have Redis installed under/usr/local/redis

4. Modifying a configuration file

Cd/usr/local/redis

mkdir conf

Cp/tmp/redis-3.2.0/redis.conf/usr/local/redis/conf/6379.conf

Modify Daemonize No in the 6379.conf file to daemonize Yes to enable Redis to start in the background

5. Start Redis

/usr/local/redis/bin/redis-server/usr/local/redis/conf/6379.conf

6. Ps-ef|grep Redis to see if it starts

--------------------------------------------------------------------------------------------------------------- ---------------------------------------

Expand

If you want to join Redis in a service

1. New Redis startup script

Vim/etc/ini.d/redis

Add the following code

  

1 #!/bin/sh2 #chkconfig: 3453 #description: Startup and Shutdown script for Redis4  5progdir=/usr/Local/redis/bin#Installation Path6progname=redis-Server7daemon=$PROGDIR/$PROGNAME8config=/usr/Local/redis/conf/6379.conf9pidfile=/var/run/redis-6379.PIDTenDesc="Redis Daemon" Onescriptname=/etc/init.d/Redis A   - Start () - { the          ifTest- x $DAEMON -  Then -Echo-e"starting $DESC: $PROGNAME" -                    if $DAEMON $CONFIG +  Then -Echo-e"OK" +                    Else AEcho-e"failed" at fi -          Else -Echo-e"couldn ' t find Redis Server ($DAEMON)" - fi - } -   in Stop () - { to          ifTest-e$PIDFILE +  Then -Echo-e"stopping $DESC: $PROGNAME" the                    if Kill' Cat$PIDFILE` *  Then $Echo-e"OK"Panax Notoginseng                    Else -Echo-e"failed" the fi +          Else AEcho-e"No Redis Server ($DAEMON) running" the fi + } -   $ Restart () $ { -Echo-e"restarting $DESC: $PROGNAME" - Stop the Start - }Wuyi   the list () - { WuPS aux |grep $PROGNAME - } About   $Case $1inch - start) - Start -         ;; A stop) + Stop the         ;; - restart) $ Restart the         ;; the list) the List the         ;; -   in*) theEcho"Usage: $SCRIPTNAME {start|stop|restart|list}">&2 the         Exit 1 About         ;; the Esac the Exit 0
View Code

2. Other operations

cd/etc/ini.d/

chmod +x Redis

Chkconfig--add Redis

Chkconfig--level 345 Redis on

Chkconfig--list Redis

Service Redis Start

Linux Installation Redis Service

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.