Common Redis commands

Source: Internet
Author: User

Start Redis Service
Src/redis-server or src/redis-server redis. conf

Src/redis-server redis. conf 1> log. log 2> errlog. log

1 is the standard output, 2 is the error output

Use Redis as a Linux service for random startup
Vi/etc/rc. local, add the Code:

/Root/install/redis-2.4.9/src/redis-server

Client Connection
Src/redis-cli

Stop the redis service:
Src/redis-cli shutdown

Add, delete, modify, and query:

Keys *
Retrieve all the currently matched keys

> Exists larry
(Integer) 0

Whether the current key exists

Del lv
Delete current key

Expire
Set expiration time

> Expire larry 10
(Integer) 1

> Move larry ad4
(Integer) 1

Move larry key-value pair to ad4 Database

> Persist lv
(Integer) 1
Expiration time for removing the current key

Randomkey

Returns a random key.

Rename
Rename key

Type
Data Type of the returned value

Type testlist
List


> Ping
PONG

Test whether the connection is still in progress

> Echo name

"Larry"

Print

> Select ad4databank
OK
Database Switching

> Quit
Disconnect

> Dbsize
(Integer) 12

Number of keys in the current database

> Info
Basic Server Information

Monitor

Real-time dump of received requests

Config get
Get server parameter configuration

Flushdb
Clear Current Database

Flushall
Clear all databases

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.