centos6.5 64 Source to install Redis service, establish a remotely connected Redis database

Source: Internet
Author: User
Tags install redis

Installation Environment: centos6.5 64-bit

Packages used: redis-2.8.19.tar.gz tcl8.6.3-src.tar.gz

Download link for package: http://downloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gz

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

This installation of the directory/home/hadoop/redis for any directory

Code implementation:

1, install the required support environment

Su Rootcd/home/hadoop/redis tar-zxvf tcl8.6.3-src.tar.gz cd tcl8.6.3/unix/./configure make do Install

2, source installation Redis

Cd/home/hadoop/redismake testmake Prefix=/usr/local/redis Install

3, Test Redis

Cd/home/hadoop/redismake Test

4. Copy and place the configuration document

Cp/home/hadoop/redis-2.8.19/redis.conf/home/hadoop/redis

5, write the startup script

Vim/etc/init.d/redis

Write the following code (note modify the relevant path):

#################################################################################!/bin/sh## redis         startup script for redis server## chkconfig :  - 80 12# description: redis is an open source, advanced  key-value store.## processname: redis-server# config: /etc/redis.conf#  Pidfile: /var/run/redis.pidsource /etc/init.d/functionsbin= "/home/hadoop/redis/bin"                 #修改为你自己相应的目录CONFIG = "/home/hadoop/redis /redis.conf "     #修改为你自己相应的目录PIDFILE ="/var/run/redis.pid "### read configuration[  -r  "$SYSCONFIG"  ] && source  "$SYSCONFIG" retval=0prog= "Redis-server" desc = "Redis server" Start ()  {        if [ -e $ Pidfile ];then             echo  "$desc  already  Running. "             exit 1         fi        echo -n  $ "starting  $desc: "         daemon  $BIN/$prog  $ config        retval=$?         echo        [  $RETVAL  -eq 0 ] & & touch /var/lock/subsys/$prog         return $ Retval}stop ()  {        echo -n $ "Stop  $desc:  "        killproc  $prog          retval=$?        echo        [  $RETVAL  -eq 0  ] && rm -f /var/lock/subsys/$prog   $PIDFILE          return  $RETVAL}restart ()  {         stop        start}case  "$"  in  start)          start        ;;   stop)         stop         ;;   restart)         restart         ;;   condrestart)         [ -e /var/lock/subsys/$prog  ] && restart        RETVAL=$?         ;;   status)         status  $prog          RETVAL=$?        ;;    *)         echo $ "Usage: $0 {start| Stop|restart|condrestart|status} "        RETVAL=1esacexit  $RETVAL #######################################################################

6. Start or close the service

Service Redis Start (test succeeded) service Redis stop (Close database)

7. Modify the configuration file:

Cd/home/hadoop/redisvim redis.conf

Daemonize Yes #redis将以守护进程的方式运行, default to No will take up your terminal

Timeout #当客户端闲置1000s后关闭连接, if specified as 0, to turn off the feature

Requirepass foobared #foobared为默认密码, change to Requirepass XXX # (XXX for the password you want)

Dir./home/hadoop/redis/data_log #指定数据和日志存的位置

Dbfilename Dump.rdb #指定数据的文件名 (default is Dump.rdb).

LogFile "" #指定日志的文件名

Modify host Name: #bind 127.0.0.1 to bind 192.168.x.x (if you want to be able to link to redis remotely, it must be set to the real IP of the machine)

Modify listening port: port=6379 to Port=xxxx (xxxx is any character)

Modify and save then: Service Redis start at this point, Redis runs as a daemon and only sees the word OK


Here's the Redis database source installation Complete



8, attention to detail:


1. Turn off the firewall: iptables-f (other machines will be able to access your database after shutting down the firewall)

Su rootiptables-f

2. If the script does not start: Execute permissions for script: chmod 777 Redis (in catalog/etc/init.d/)

3. Log in to the Redis database using redis-cli:./redis-cli-h 192.168.xx.xxx-a Password

4. Use the Python link redis:r=redis. Redis (host= ' 192.168.xx.xxx ', port=xxxx,password= ' xxxxxx ')

5. Temporary password: config set requirepass xxx

6. View password: Config get requirepass


Installation encountered problems can leave a message, hope this article to help you like this article remember to give me some praise, thank you


This article is from the "10700016" blog, please be sure to keep this source http://10710016.blog.51cto.com/10700016/1881693

centos6.5 64 Source to install Redis service, establish a remotely connected Redis database

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.