Redis notes (I) pure white edition

Source: Internet
Author: User
Tags download redis

This is the most common practice for everyone to learn how to use redis:

First: Download

Download redis: download the latest rediss from the official website http://redis.io /.

Http://redis.googlecode.com/files/redis-2.6.14.tar.gz

Download Jedis: Download jedis2.1.0 from https://github.com/xetorthio/jedis/downloadsand the path is:

Https://github.com/downloads/xetorthio/jedis/jedis-2.1.0.jar

 

Second, unzip and install

Decompress tar -zxvfredis-2.6.14.tar.gz

Go to the SRC folder, make and makeinstall. For details, see the README file.

Third: Test

Compile a test file

 

Package test. redis;

Import redis. Clients. Jedis. Jedis;
Import redis. Clients. Jedis. jedisshardinfo;

Public class testredisconnect {

Private Static Jedis;

Static {
Jedis = new Jedis ("127.0.0.1 ");
Jedis. Connect ();

}

/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
Jedis. incr ("testage ");
System. Out. println (Jedis. Get ("testage "));
}

}

 

Directory structure:

.
| -- Libs
| '-- Jedis-2.1.0.jar
'-- Test
'-- Redis
| -- Testredisconnect. Class
'-- Testredisconnect. Java

 

3 directories, 3 files

 

Start the redis service: redis-server redis. conf

Compile:

Javac-djava. Ext. dirs = libstest/redis/testredisconnect. Java

Run:

Java-djava. Ext. dirs = libstest. redis. testredisconnect

If 1 is entered, the test is successful. The next article describes the master-slave configuration of redis.

 

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.