Install and use Redis in Linux

Source: Internet
Author: User
Tags redis cluster install redis

Install and use Redis in Linux

What is Redis?

Redis is an open-source log-type and Key-Value database written in ansi c language that supports Network, memory-based persistence, and provides APIs in multiple languages. Redis is a key-value storage system. Similar to Memcached, Memcached supports more storage value types, including string, list, set, and zset) and hash (hash type ). These data types support push/pop, add/remove, Intersection Set and difference set, and more abundant operations, and these operations are atomic.

Redis installation (Linux)

Cd/usr/local

Wget http://download.redis.io/releases/redis-3.0.7.tar.gz get Redis installation package

Tar xvf redis-3.0.7.tar.gz

Cd redis-3.0.7

Make

Make & install

Common Redis commands

Redis-server redis. conf # Start redis

Redis-cli # enter the redis client (without a password) | redis-cli-a yourpassword # enter the redis client (with a password)

Redis-cli shutdown # Stop the redis Service

Basic Redis operations

Keys * ## view all keys in redis

Set word helloworld # Insert key-value pair data to redis. The key is word and the value is helloworld.

Get word # according to the key value, the result is helloworld

Exists word # Check whether the key exists

Del word # Delete the current key

Expire word 10 # Set the expiration time for the corresponding key

Persist word # Remove the expiration time of the current key

Randomkey # Return a random key

Type datalist # Return Value Data type

Lpush datalist redis # insert data into redis to the set header (left)

Rpush datalist org # insert data org to the end of the Set (right) to redis)

Lrange datalist 0 4 # flashall # Clear all data whose index is 0-4 in the query set

For more operations, see the official apsaradb for redis user manual.

Use of redis in java: spring-redis Integration


 

For redis usage, write it here first.

You may also like the following articles about Redis. For details, refer:

Install and test Redis in Ubuntu 14.04

Basic configuration of Redis master-slave Replication

Redis cluster details

Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis

Redis series-installation, deployment, and maintenance

Install Redis in CentOS 6.3

Learning notes on Redis installation and deployment

Redis. conf

Redis details: click here
Redis: click here

This article permanently updates the link address:

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.