Redis Usage Design Scheme

Source: Internet
Author: User

I. Environmental requirements

Linux, more than 4G of memory.

Second, install the Redis1. To build a Redis directory in/usr/local, execute the following command steps:

cd/usr/local;

mkdir Redis;

2. Rename the redis-2.8.19.tar.gz to redis-cache.tar.gz using the tool to upload to the Linux-built Redis directory, perform the installation operation, and execute the command steps as follows:

tarredis-cache.tar.gz;

CD Redis-cache;

make&&makeinstall;

The above is the source of the installation, may continue to compare long time.

3. After installation, go to the Redis-cache directory, find the redis.conf file, find the relevant contents of this file, modify this profile:

VI redis.conf

Daemonize Yes

Requirepass Redis (set Redis access password)

Pidfile/usr/local/redis/var/redis.pid (custom directory)

Port 6379

Timeout 300

LogLevel Debug

Logfile/usr/local/redis/var/redis.log (custom directory)

Databases 16

Save 900 1

Save 300 10

Save 60 10000

Rdbcompression Yes

Dbfilename Dump.rdb

dir/usr/local/redis/var/(custom directory)

AppendOnly No

Appendfsync always

For more information about the contents of redis.conf, you can visit the following URLs:

Http://www.cnblogs.com/wenanry/archive/2012/02/26/2368398.html

Third, start Redis

Redis-server redis.conf

Specific use of the command reference: Http://www.redis.io/commands

Four, close Redis

REDIS-CLI shutdown

Five, the application model of Redis cache is conceived

Scenario: User login log cache, each user log in has a log log, the previous log is put into the Oracle,mysql database, the accumulation of time, the log more impact on the speed of login, first cache, night active users less, scheduled to large database related tables, backup cache service, and then delete the cache. The data flow chart is as follows:


Vi. Redis Integrated Java development case

Https://git.oschina.net/pandason125/RedisFile.git

This example provides a preliminary encapsulation of the Jedis call to Redis, which you can refer to when calling:

Com.ylzinfo.redis.model. Fileuploadmodel.java this type of

Redis Usage Design Scheme

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.