Installing the Redis CentOS7 installation Nodejs+express+mongodb+redis

Source: Internet
Author: User
Tags redis server

redis,v3.2, Official link: http://www.redis.io/download, reference: http://blog.csdn.net/mlks_2008/article/details/19001595

1. Installing Redis

wget http://download.redis.io/releases/redis-3.2.1. Tar.gztar xzf redis-3.2.1. TAR.GZCD Redis- 3.2.1 Make

2. Set up Redis for boot

    • Redis commands will be copied to/usr/local/bin.

CP redis.conf/etc/

    • To create a Redis script execution file: Vi/etc/init.d/redis

The script reads as follows:

# chkconfig:2345 10 90
# Description:start and Stop Redis path=/usr/local/bin:/sbin:/usr/bin:/bin Redisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-CLI Pidfile=/var/run/redis.pidconf="/etc/redis.conf" Case" $" inchstart)if[- F $PIDFILE] then echo"$PIDFILE exists, process is already running or crashed" ElseEcho"starting Redis Server ..." $EXEC $CONFfiif["$?"="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$REDISPORTSHUTDOWN 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##############################
    • Then set the properties of this file

chmod +x/etc/init.d/redis

    • Change Daemonize No to daemonize Yes

Vim/etc/redis.conf

    • Setting up the Boot service

Chkconfig Redis on

3. Common commands

Start the service:

/etc/init.d/redis start

Stop service:

/etc/init.d/redis stop

Test command:

redis-CLI   127.0.0.1:6379> set foo 123  127.0.0.1:6379> get foo  

Installing the Redis CentOS7 installation Nodejs+express+mongodb+redis

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.