Redis Installation and use

Source: Internet
Author: User
Tags redis

1. Installing Redis:
Upload files to a fixed directory; version: redis-3.2.0

Tar xzvf redis-3.2.0.tar.gz

cd redis-3.2.0 make

&& make install

2. Start Redis

Redis-server  redis.conf

3, generally will not be modified on the original configuration file, the original configuration file equivalent to backup. So create on the CENTOS7

mkdir  /etc/redis

4. Copy the Redis original configuration file to/etc/redis

CP redis.conf   /etc/redis/

Start with the latest configuration file:

Redis-server  /etc/redis/redis.conf

If you close the command-line window directly after startup, Redis will run in the background, but you cannot press CTRL + C and if you press this to terminate Redis, you can simply turn off the window

[Root@localhost ~]# ps-ef |grep redis
root     30337     1  0 09:10?        00:00:00 redis-server 127.0.0.1:6379
root     32116 28120  0 09:18 pts/1    00:00:00 grep--color=auto Redis

The above Redis is started.

5. After startup, how to turn off Redis.

REDIS-CLI  shutdown
[root@localhost ~]# redis-cli shutdown
[root@localhost ~]# ps-ef |grep redis
root< c4/>32257 28120  0 09:19 pts/1    00:00:00 grep--color=auto Redis

After execution, Redis shuts down.

6. Redis Add background boot

Daemonize  Yes

7. Configure Redis log file location:

LogFile "/users/wang/documents/redis.log"

7. Add to
Boot-up configuration

echo "/usr/local/bin/redis-server/etc/redis/redis.conf &" >>/etc/rc.local

8. Add password

vi/etc/redis/redis.conf

require pass   paas2016

Add Password paas2016
Redis is not allowed to connect to other clients by default:

need to release in config file: Bind 127.0.0.1 to allow other clients to operate

Client connections:

ss:~ wqp$ redis-cli-h hostname-p 6379-a paas2016 hostname:6379> set AA "AAAA" OK hostname:6 379> get AA "AAAA" 
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.