Redis Service installation under WINDOWS64 System (verbose)

Source: Internet
Author: User
Tags delete key install redis

Linux under Redis installation link: go to

Redis is a key-value storage system. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), Zset (sorted set-ordered collection), and hash (hash type). These data types support Push/pop, Add/remove, and intersection-set and difference sets, and richer operations, and these operations are atomic. Based on this, Redis supports sorting in a variety of different ways. As with memcached, data is cached in memory to ensure efficiency. The difference is that Redis periodically writes the updated data to the disk or writes the modified operation to the appended record file, and implements the Master-slave on this basis.

1. Installing Redis
Official website: http://redis.io/


Official download: Http://redis.io/download can download different versions as needed


Windows Edition: Https://github.com/MSOpenTech/redis/releases


I chose the third, zip compressed file downloaded on GitHub.
After the download is complete, create a new folder "Redis" in the C-Drive "program Files" directory, and right-click the Redis zip package to unzip all the files into the Redis folder.


File Description:

Redis-benchmark.exe #基准测试

Redis-check-aof.exe # AOF

Redischeck-dump.exe # Dump

Redis-cli.exe # Client

Redis-server.exe # Server

REDIS.WINDOWS.CONF # configuration file

2. Start Redis

Windows run (shortcut key: Hold SHIFT + right mouse button), choose here to open the Command window, enter the CMD operating system window.

Use the command "redis-server.exe redis.windows.conf" to start the Redis service.

Service Start Success Status


Do not ask me why the color is green, to set their own, personal feeling eye protection (psychological effect, haha ^_^).

Start the Doc window for the Redis service without shutting down because the service needs to be executed all the time, close the service, and close the window directly.

1.cmd Commandinstallation command:redis-server.exe--service-install redis.windows.conf--loglevel verboseUninstall command:Redis-server--service-uninstall

3. Test use

Open a new doc window with your own client tool to test the command "redis-**cli.exe**" with the following details:


4.Java Development Kit Jedis
Jedis:http://www.oschina.net/p/jedis (Redis's official Preferred Java Development Kit)

<!--Redis -->   <dependency>   <groupId>redis.clients</groupId>   <artifactId>jedis</artifactId>   <version>2.0.0</version>   <type>jar</type>   <scope>compile</scope>   </dependency>

Test Example Original: http://flychao88.iteye.com/blog/1527163

Package com.lujianing.utils;   Import Org.junit.Before;   Import Org.junit.Test;   Import Redis.clients.jedis.Jedis;   Import Redis.clients.jedis.JedisPool;   Import Redis.clients.jedis.JedisPoolConfig;   Import Java.util.HashMap;   Import Java.util.Iterator;   Import java.util.List; Import Java.util.Map;/** * Created by lujianing on 14-2-28. */PublicClassjedisutiltest {Jedispool pool;   Jedis Jedis; @BeforePublicvoidSetUp () {pool =New Jedispool (New Jedispoolconfig (),"192.168.10.61"); Jedis = Pool.getresource ();Jedis.auth ("password"); } @TestPublicvoidTestget () {System.Out.println (Jedis.Get"Lu")); }/** * Redis Storage Primary String * CRUD * *TestPublicvoidTestbasicstring (){-----Add Data----------Jedis.Set"Name","MINXR");The VALUE--&GT;MINXR System is placed into the key-->name.Out.println (Jedis.Get"Name"));Execution Result: MINXR-----Modify the Data-----------1, on the original basis to modify the Jedis.append ("Name","Jarorwar");Very intuitive, similar to map will Jarorwar append to existing value after System.Out.println (Jedis.Get"Name"));Execution Result: Minxrjarorwar2, directly cover the original data Jedis.Set"Name","Min Xiaorong"); System.Out.println (Jedis.Get"Name"));Execution Result: Min XiaorongDelete the key corresponding to the record Jedis.del ("Name"); System.Out.println (Jedis.Get"Name"));Execution result: null/** * Mset equivalent to * jedis.set ("name", "MINXR"); * Jedis.set ("Jarorwar", "Min Xiaorong"); */Jedis.mset ("Name","MINXR","Jarorwar","Min Xiaorong"); System.Out.println (Jedis.mget ("Name","Jarorwar")); }/** * Jedis Operation map */@TestPublicvoidTestMap () {map<string,string> user=New Hashmap<string,string> (); User.put ("Name","MINXR"); User.put ("PWD","Password"); Jedis.hmset ("User", user);Remove the name from the user and execute the result:[minxr]--> note that the result is a generic listThe first parameter is the key to the Map object in Redis, followed by the key of the object placed in the map, followed by the key can be followed by multiple, is a variable parameter list<string> rsmap = Jedis.hmget ("User","Name"); System.Out.println (RSMAP);Delete a key value from a mapJedis.hdel ("User", "pwd"); System.Out.println (Jedis.hmget ("User","PWD"));Because it was deleted, the returned null System.Out.println (Jedis.hlen ("User"));Returns the number of values stored in the key for user 1 System.Out.println (Jedis.exists ("User"));Whether there is a record of key for user returns True System.Out.println (Jedis.hkeys ("User"));Returns all keys in the Map object [pwd, name] System.Out.println (Jedis.hvals ("User"));Returns all the value in the Map object [MINXR, password] iterator<string> Iter=jedis.hkeys ("User"). iterator ();while (Iter.hasnext ()) {String key = Iter.next (); System.Out.println (key+":" +jedis.hmget ("User", key)); } }/** * Jedis Operation list */@TestPublicvoidTestlist (){Before beginning, remove all content Jedis.del ("Java framework"); System.Out.println (Jedis.lrange ("Java framework",0,-1));First, store three data in the key Java framework Jedis.lpush ("Java framework","Spring"); Jedis.lpush ("Java framework","Struts"); Jedis.lpush ("Java framework","Hibernate");And then take out all the data jedis.lrange is out by range,The first one is key, the second is the starting position, the third is the end position, Jedis.llen gets the length-1 means that all System is taken.Out.println (Jedis.lrange ("Java framework",0,-1)); }/** * Jedis Operation set */@TestPublicvoidTestset (){Add Jedis.sadd ("Sname","MINXR"); Jedis.sadd ("Sname","Jarorwar"); Jedis.sadd ("Sname","Min Xiaorong"); Jedis.sadd ("Sanme","Noname");Remove Noname Jedis.srem ("Sname","Noname"); System.Out.println (Jedis.smembers ("Sname"));Gets all the added value System.Out.println (Jedis.sismember ("Sname","MINXR"));Determines whether MINXR is the element System for the Sname collection.Out.println (Jedis.srandmember ("Sname")); System.Out.println (Jedis.scard ("Sname"));Returns the number of elements of the collection} @TestPublicvoidTest) throws Interruptedexception {The wildcard System can be used to pass in keys.Out.println (Jedis.keys ("*"));Returns all keys in the current library [Sose, Sanme, name, Jarorwar, foo, sname, Java Framework, user, Braand] System.Out.println (Jedis.keys ("*name"));Returns the Sname [Sname, name] System.Out.println (Jedis.del ("Sanmdde"));Delete key for Sanmdde object Delete successfully returns 1 delete failed (or does not exist) returns 0 System.Out.println (Jedis.ttl ("Sname"));Returns the valid time for a given key, or 1 if it is always valid Jedis.setex ("TimeKey",10,"Min");This method allows you to specify the survival (active time) time of the key as seconds Thread.Sleep (5000);After 5 Seconds of sleep, the remaining time will be <=5 System.Out.println (Jedis.ttl ("TimeKey"));//output is 5 Jedis.setex ( "TimeKey", 1 ,  "Min"); //set to 1, the following to see the remaining time is 1 of the System. out.println (Jedis.ttl ( "TimeKey")); //output is 1 System. out.println (jedis.exists ("key"));//check if key exists System.out.println (Jedis.rename (" TimeKey "," Time ")); System.out.println (Jedis.get ("TimeKey"));//Because it is removed, the return is null System.out.println (Jedis.get ("Time")); Because TimeKey is renamed to time, you can get the value min//jedis sort//Note that Rpush and Lpush here are the operations of the list. is a doubly linked list (but from the performance point of view) Jedis.del ("a");//Clear the data first, then add the data to test Jedis.rpush ("A", "1"); Jedis.lpush ("A", "6"); Jedis.lpush ("A", "3"); Jedis.lpush ("A", "9"); System.out.println (Jedis.lrange ("a", 0,-1));//[9, 3, 6, 1] System.out.println (Jedis.sort ("a")); [1, 3, 6, 9]//input sorted results System.out.println (Jedis.lrange ("a", 0,-1)); } }

Redis will save data to the hard disk on a regular basis.



Text/Flower Tzs (Jane book author)
Original link: http://www.jianshu.com/p/efe533fe9704
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

Redis Service installation under WINDOWS64 System (verbose)

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.