Centos-redis Installation

Source: Internet
Author: User

1. Download:

wget http://download.redis.io/releases/redis-2.8.7.tar.gz

2, Decompression installation:

tar xf redis-2.8.7.tar.gz

cd redis-2.8.7

Make

Make install

3. Create the configuration file:

mkdir /etc/redis 

cp redis.conf /etc/redis/redis.conf

4, adjust the use of memory allocation and make it effective:

echo “vm.overcommit_memory=1”>>/etc/sysctl.conf

sysctl -p

5. Modify the Redis configuration:

vi /etc/redis/redis.conf

daemonize yes        #redis以守护进程的方式运行

                          #no表示不以守护进程的方式运行(会占用一个终端)

timeout 300          #客户端闲置多长时间后断开连接,默认为0关闭此功能

loglevel verbose       #设置redis日志级别

logfile stdout       #设置日志文件的输出方式,如果以守护进程的方式运行redis

                           #并且日志输出设置为stdout,那么日志信息就输出到/dev/null里面去了

6. Start Redis:

Cd/etc/redis

Redis-server redis.conf #启动redis服务

CD ~/REDIS-2.8.7/SRC #进入redis安装目录

REDIS-CLI #进入redis终端

7. Example:

Set key value #设置redis缓存: Set Test-redis "Test for Redis"

Get key #获取redis缓存: Get Test-redis

Del key #删除redis缓存: Del Test-redis

Setex Key Time value #设置redis缓存并设置过期时间: Setex test-redis "test for Redis Too"//expires after 10 seconds

Centos-redis Installation

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.