Install and use redis in Windows

Source: Internet
Author: User

The downloaded Windows version is a redis-2.0.2, decompress it to drive D:

D: \ redis-2.0.2

The directory contains the following files:

Redis-server.exe: Service Program

Redis-check-dump.exe: Local database check

Redis-check-aof.exe: Update log check

Redis-benchmark.exe: Performance test, used to simulate sending M sets/gets queries by N clients at the same time (similar to the Apache AB tool ).

Start the redis Service (the configuration file is specified in the conf file. If this parameter is not specified, the default configuration file is used ):

D: \ redis-2.0.2> redis-server.exe redis. conf

The cmd window must be open all the time. When it is closed, the redis service will be closed.

When the service is enabled, another window is opened to set the client:

D: \ redis-2.0.2> redis-cli.exe-H 202.117.16.20.- P 6379

Then you can start playing:

Slave --------------------------------------------------------------------------------------------------------------------------------

 

Redis provides clients in multiple languages, including Java, C ++, and python.

 

The Java package recommended on the official redis website is Jedis. Download Jedis and import the Jedis package to the Java project. The error is found because the org. Apache. commons package is missing,

Find this package online. After downloading and importing the package, there will be no error in Jedis.

You can start by using Jedis to operate redis:

package test;

import redis.clients.jedis.Jedis;

public class Client {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Jedis jj = new Jedis("localhost");
jj.set("key1", "I am value 1");
String ss = jj.get("key1");
System.out.println(ss);
}

}

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.