First, what isRedis
Redis is a high performance Key-value storage System (cache and store) issued under the BSD Open Source protocol. It is commonly referred to as a data structure server, because the value can bea string (string), a hash (Map), a list, a collection (Sets ), an ordered set (sorted sets) and a bitmap (bitmaps) type. The official website is http://redis.io/
The comparison of Redis and other no SQL does not make much of a description of this article. I think the best part of Redis is to provide data persistence (to write the data in memory at timed intervals), so that data loss will not be lost once the outage is done. And, compared to Memcached , it provides a more broad selection of value types.
Second,Redis Download installation
Open the redis official website, we found that Redis officially does not support the Windows platform, but Microsoft open Tech Group has changed this situation
Click Learn more
Click Download ZIP, unzip after download, we found that it does not provide ready to execute the installation files, which requires us to compile themselves. Navigate to Directory Redis\redis2.8\msvs, open file RedisServer.sln
Project structure such as
Since the author's machine is 64 bits, before compiling we confirm compile Platform, and we can see that for this project will compile produce redis-server.exe file
Similar to other projects
After the compilation is successful, we find the compiled file in its Debug directory
For ease of handling, we create a new directory Redisand copy the files to the past
redis.conf from the following directory
Now that we've got all the required files, we can use them, open CMD, navigate to directory D:\Developer\Redis\Redis, and execute the following command
Redis-server.exe redis.conf
Successful execution (you can see that the port is 6379 and the process identifier PID is 7696)
The implementation process will also read the configuration, because it is too long, so the text is released here
Microsoft Windows [Version 6.1.7601]copyright (c)2009Microsoft Corporation. All rights reserved. C:\Windows\system32>CD D:\developer\redis\redisc:\windows\system32>D:d:\developer\redis\redis>redis-server.exe redis.confprocessing redis.confarguments seen:activerehashing yesaof-load-truncated yesaof-rewrite-incremental-fsync yesappendfilename appendonly.aofappendfsync everysecappendonly noauto-aof-rewrite-min-size 64mbauto-aof-rewrite-percentage100Client-output-buffer-limit Normal,0, 0, 0slave, 256MB, 64MB,60pubsub, 32MB, 8MB,60daemonize nodatabases16dbfilename Dump.rdbdir./Hash-max-ziplist-Entries512Hash-max-ziplist-value64HLL-sparse-max-bytes3000Hz10Latency-monitor-Threshold0List-max-ziplist-Entries512List-max-ziplist-value64Logfileloglevel Noticelua-time-Limit5000No-appendfsync-on-rewrite nonotify-keyspace-Eventspidfile/var/run/Redis.pidport6379rdbchecksum yesrdbcompression Yesrepl-disable-tcp-Nodelay Norepl-diskless-Sync Norepl-diskless-sync-Delay5Save900, 1 300, 10 60, 10000Set-max-intset-Entries512slave- Priority100slave-read-Only Yesslave-serve-stale-Data Yesslowlog-log-slower-than10000Slowlog-max-Len128Stop-writes-on-bgsave-Error Yestcp-Backlog511TCP-keepalive0Timeout0Zset-max-ziplist-Entries128Zset-max-ziplist-value64[7696] May 14:24:45.265#warning:32 bit instance detected but no memory LimIt set. Setting 3GB maxmemory limit with ' noeviction ' policy now. _._ _.-"__"-._ _.-`` `. `_. "-._ Redis 2.8.19 (00000000/0) 32bit.-`` .-```. "\ \ _.,_"-. _ (',.-` | ',) Runninginchstand alone mode| '-._ '-...-' __...-. '-._| ' ' _.-' | port:6379 | '-._ '. _/_.-' | pid:7696 `-._ '-._ '-./_.-' _.-'| '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | /HTTPRedis.io '-._ '-._ '-.__.-' _.-' _.-'| '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | `-._ '-._ '-.__.-' _.-' _.-"'-._ '-.__.-' _.-"'-._ _.-"'-.__.-' [7696] May 14:24:45.283#Server started, Redis version 2.8.19[7696] May 14:24:45.283 *The server is now a ready to accept connections on port6379[7696] 14:39:46.081 * 1 changesinch900seconds. Saving...arguments seen:logfile stdoutqfork140, 7696[7696] May 14:39:46.246#Fork Operation Complete[7696] 14:39:46.256 * Background saving terminated with success
View Code
Server Well, now let's open up a Client end to test, new open CMD (previously opened Cmd-server end cannot be closed)
Redis-cli.exe-h 10.7.15.172-p 6379
which 10.7.15.172 for the native IP
Set Hello HelloWorld
Set a value
Get Hello
Read this value
About 15 minutes later, we found a change in the server side.
The original 15 minutes automatically writes in-memory data to the RDF file in case of loss.
As for why it is 15 minutes, we can see that the configuration file is set up (a change/900 seconds, 10 changes/300 seconds, 10000 changes/60 seconds), that is, the more changes in the data to write to the file time interval shorter, so the design is quite reasonable.
III.Redis Desktop Manager
Although we can see the redis data in memory through the above CMD , but the way is too unfriendly, here is a tool for Redis Desktop Manager
Install after download is complete, then connect to Server
Click to view data
Iv.Install Redis as Windows Service
We installed the Redis in front of CMD , but it was very inconvenient, because we had to keep the window open, and it needed to be reopened if the machine restarted. Redis can also be deployed in the same way as Windows Service . We need to locate the configuration file before deployment
Then copy to the Redis directory
Installation Services
Redis-server--service-install redis.windows.conf
Installation Success Tips
View Services
Start the service
Redis-server--service-start
Stop Service
Redis-server--service-stop
Uninstall Service
Redis-server--service-uninstall
One way to install Windows Services is to download the installation files directly from Github , but it doesn't seem to be the latest version.
Using Redis (a) installation under Windows