Centos installs redis3 to serve the system

Source: Internet
Author: User

Centos installs redis3 to serve the system
# No wget. Run the yuminstallwget command to install the tool.wgethttp://download.redis.io/releases/redis-3.0.1.tar.gztarxzfredis-3.0.1.tar.gzcdredis-3.0.1make# If you do not have the make command, download yuminstallgccmakemaketestmakeinstall

After redis is installed, copy the binfile to usr/local/bin (This step is very important, and no errors will be reported in this step)

?cpredis-server/usr/local/bin/cpredis-cli/usr/local/bin

Modify redis. conf and enable the backend running options:

?daemonizeyes

Write and start shell: vim/Etc/init. d/redis (copy online)

?#chkconfig:23451090#description:StartandStopredisPATH=/usr/local/bin:/sbin:/usr/bin:/binREDISPORT=6379# EXEC =/usr/local/redis/src/redis-server # REDIS_CLI =/usr/local/redis/src/redis-cli # actual environment environment dependsPIDFILE=/var/run/redis.pidCONF="/usr/local/redis/redis.conf"# Depends on the actual environmentcase"$1"instart)if[-f$PIDFILE]thenecho"$PIDFILEexists,processisalreadyrunningorcrashed."elseecho"StartingRedisserver..."$EXEC$CONFfiif["$?"="0"]thenecho"Redisisrunning..."fi;;stop)if[!-f$PIDFILE]thenecho"$PIDFILEexists,processisnotrunning."elsePID=$(cat$PIDFILE)echo"Stopping..."$REDIS_CLI-p$REDISPORTSHUTDOWNwhile[-x$PIDFILE]doecho"WaitingforRedistoshutdown..."sleep1doneecho"Redisstopped"fi;;restart|force-reload)${0}stop${0}start;;*)echo"Usage:/etc/init.d/redis{start|stop|restart|force-reload}">&2exit1esac

Grant permissions to chmod + x/etc/init. d/redis

Set boot start:

?# Try to start or stop redisserviceredisstartserviceredisstop# Enable chkconfigredison

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.