Preliminary Introduction to Redis

Source: Internet
Author: User

http://blog.csdn.net/u014419512/article/details/25693425

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Directory (?) [+]

    1. Environment
    2. Installation
    3. Start
    4. Debugging
    5. Java calls
    6. Background process
    7. More information

Environment

Rhlinux-6.4-64-en, Red Hat 6.4 64-bit, English official release

Installation

The installation is simple, download the Redis package first, see here, then copy to your Linux machine, then execute the following command.

123 
$ tar xzf redis-2.6.14.tar.gz$ cd redis-2.6.14$ make
Start

1
$ src/redis-server
Debugging

Execute the redis-cli script under the SRC directory, which is the client for Redis.

123)45   
$ src/redis-cliredis> set foo barOKredis> get foo"bar"
Java calls
    1. Redis More famous Java client is Jedis, first download Jedis jar package, can go to Maven library search Jedis can download to, source code is on GitHub: Https://github.com/xetorthio/jedis.
    2. Simply write a main method to invoke it.
123456    
    PublicStaticvoidMain(String[]Args){ JedisJedis=NewJedis("10.20.8.39");IP for Redis server, port default 6379 Jedis.Set("Foo","Bar"); StringValue=Jedis.Get("Foo"); System. out.  println(value);  }
Background process

The previous startup method is not the background process mode, the terminal shut down the service will stop, you can use the following command to start Redis as a background process, and add to the system startup naming.

12
$ cd redis-2.6.14/utils$./install_server

After executing the command, you will be prompted to answer a few questions, you can return to the past, select the default settings.

123456789        
PleaseSelect the Redis portFor this instance:[6379]Selecting default:6379PleaseSelect the Redis config file name[/etc/redis/6379.conf]Selected Default-/etc/redis/6379.confPleaseSelect the Redis log file name[/var/log/redis_6379.log]Selected Default-/var/log/redis_6379.logPleaseSelect the Data directoryfor This instance [/var/lib/redis/6379]selected Default-/var/lib/redis/6379please select the Redis executable Path  [/usr/local/bin/redis-server]        

PS: After I execute the install_server script, I find that the service is not up, see/etc/init.d/redis_6379 This file finds that the newline symbol is replaced with a /n symbol, and manually replace the symbols with a newline.

Preliminary Introduction to 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.