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) Microsoft 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 Noaut O-aof-rewrite-min-size 64mbauto-aof-rewrite-percentage 100client-output-buffer-limit Normal, 0, 0, 0 Slave, 256MB, 64MB, PubSub, 32MB, 8MB, 60daemonize nodatabases 16dbfilename Dump.rdb Dir./hash-max-ziplist-entries 512hash-max-ziplist-value 64hll-sparse-max-bytes 3000hz 10latency-monitor-threshold 0list-max-ziplist-entries 512list-max-ziplist-value 64logfileloglevel Noticelua-time-limit 5000no-appendfsync-on-rewrite Nonotify-keyspace-eventspidfile/var/run/redis.pidport 6379rdbchecksum yesrdbcompression ye Srepl-disable-tcp-nodelay Norepl-diskless-sync norepl-diskless-sync-delay 5save 900, 1 10000set-max-intset-entries 512slave-priority 100slave-read-only yesslave-serve-st Ale-data Yesslowlog-log-slower-than 10000slowlog-max-len 128stop-writes-on-bgsave-error yestcp -backlog 511tcp-keepalive 0timeout 0zset-max-ziplist-entries 128zset-max-ziplist-value 64[7696] 14:24:45.265 # warning:32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with ' noeviction ' policy now. _._ _.-' __ '-._ _.-'. `_. "-._ Redis 2.8.19 (00000000/0).-".-". ' \ \ _.,_ '-._ (',.-' | ',) Running in stand alone mode | '-._ '-...-' __...-. '-._| ' _.-' | port:6379 | '-._ '. _/_.-' | pid:7696 '-._ '-._ '-./_.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | Http://redis.io '-._ '-._ '-.__.-' _.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-"-._ '-.__.-' _.-'-._ _.-' '-.__.-' [7696] Y 14:24:45.283 # Server started, Redis version 2.8.19[7696] * 14:24:45.283 * The server is now ready to accept Connec tions on port 6379[7696] 14:39:46.081 * 1 changes in seconds. Saving...arguments seen:logfile stdoutqfork, 7696[7696] May 14:39:46.246 # Fork Operation Complete[76 14:39:46.256 * Background saving terminated with success
server side OK, now we open a client side to test, new open CMD (previously opened cmd-server end cannot be closed)
Redis-cli.exe-h 10.7.15.172-p 6379
Where 10.7.15.172 is 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