Installation of Redis in CentOS

Source: Internet
Author: User

1. Installing TCL support

Yum Install Tcl

  

2. Installing Redis We take the latest 2.8.9 as an example

$ wget http://download.redis.io/releases/redis-2.8.9.tar.gz$ tar xzf redis-2.8.9.tar.gz$ cd redis-2.8.9$ make$ make test $ make Install

After the test is installed, the Redis-server,redis-cli,redis-benchmark,redis-check-aof,redis-check-dump is automatically copied to the/usr/local/bin directory after installation.

Edit redis.conf File

VI redis.conf

Change Daemonize No to Yes.

We manually copy the redis.conf to/etc directory

CP Redis.conf/etc

Write the self-init.d script.

The contents are as follows:

Press CTRL + C to copy the code
########################### #chkconfig: 2345 90#description:start and Stop Redispath=/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 "$" in start) if [-f $PIDFILE] then echo "$PIDFI                LE 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, process was not running " Else pid=$ (cat $PIDFILE) echo "Stopping ..." $REDIS _cli-p $REDISPORT shutdo                    WN while [-X ${pidfile}] do echo "Waiting for Redis to shutdown ..." Sleep 1 DonE echo "Redis stopped" FI;;  restart|force-reload) ${0} stop ${0} start; *) echo "Usage:/etc/init.d/redis {start|stop|restart|force-reload}" >&2 exit 1esac###################### ########

  


Press CTRL + C to copy the code

Can be uploaded to the/etc/init.d/directory via WINSCP

Modify permissions, you can run

chmod +x/etc/init.d/redis

Set up start-up service automatically

sudo chkconfig redis on

Start the service:

Service Redis Start

Stop service:

Service Redis Stop

Configure the firewall to open the corresponding port:

Vi/etc/sysconfig/iptables
-A input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT

Restarting the firewall

Service Iptables Restart

Installation of Redis in CentOS

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.