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