Linux under Redis set password and boot from boot _linux

Source: Internet
Author: User
Tags redis redis server

1, set the redis.conf daemonize to Yes, to ensure that the daemon open;

Find #requirepass foorbared This line, replace it directly, change to requirepass new password

2, write the boot from the start script

Vi/etc/init.d/redis

The script reads as follows:

 #!/bin/sh #chkconfig: 2345 # simple Redis INIT.D script conceived to work on Linux systems
# as it does use of the/proc filesystem. redisport=6379 Exec=/usr/local/bin/redis-server cliexec=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${ Redisport}.pid conf= "/etc/redis/${redisport}.conf" case "the" in Start "if [-f $PIDFILE] then echo" $PI
    Dfile exists, process is already running or crashed "else echo" starting Redis server ... "$EXEC $CONF
  fi;; STOP) if [! f $PIDFILE] then echo "$PIDFILE does not exist, the process is not running" else PI
        d=$ (cat $PIDFILE) echo "Stopping ..." $CLIEXEC-p $REDISPORT shutdown while [-x/proc/${pid}]
    Do echo ' Waiting for Redis to shutdown ... ' sleep 1 is done echo ' Redis stopped '
  fi;;
*) echo "Please use start or stop as the" "argument";; Esac 

3. Save and exit after writing

4, set permissions

chmod 755 Redis

5. Start test

/etc/init.d/redis start

6. Connection test

Redis-cli-a New password-p 6379

7, set the boot from start

Chkconfig Redis on

The above is a small set to introduce the Linux under the Redis settings password and boot from the start, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.