Operation Practice of Redis NoSQL database

Source: Internet
Author: User
Tags redis cluster redis server


1, set a 1 assignment is converted to a character type by default (type a can query the variable type)
2, get a query A's value
3, Rpush list_a a b c defines a list containing a,b,c three variables list_a
4, Lpus H List_a A inserts element a
5, lrange list_a 0 9 to the left of the list list_a the first 10 elements of List_a
6, Lrange list_a 0-1 shows all elements of list_a. (-1 means the last element)
7, Lpop list_a takes the first element out and deletes it in the list, Rpop list_a is the right to take out.
8, Hmset user:01 username jimforit password [email protected] vertified 1 stores customer information in a Redis file as a hash value.
9, Hget user:01 The value of the user username of the 01 numbers in the user file.
10, Hgetall user:01 can get all key-value values of the User Object 01 number.
11, Hmset user:01 username Lixiaoteng indicates that the key value of username in the file of user object number 01 is updated to Lixiaoteng
12, Sadd L_set a b C creates a new one containing a, a, The unordered collection of C three elements L_set
13, smembers L_set can view the elements in the collection L_set
14, Sismember to see if the elements in the Redis exist, for example, Sismember l_set 4 exist return 1, otherwise return 0
15, Zadd l_set1 1 a,zadd l_set1 2,b Create a new L_set1
16, zrange L_set1 0 10 View ordered collection L_set1 The first 11 elements of the pre-ordered arrangement
17, Zrevrange L_ Set1 0-1 queries all elements in an ordered collection l_set2 that are in reverse order
18, Info [section]: Querying Redis-related information. The info command can query almost all redis information, with the following command options:

General Information for Server:redis server
Connection options for Clients:client
Memory: Storage usage Related information
Persistence:rdb and AOF related information
Stats: General Statistics
Replication:master/slave Request Information
CPU:CPU Occupancy Information Statistics
Cluster:redis Cluster Information
Keyspace: Database Information statistics
All: Return all information
Default: Returns general settings information
If the command argument is empty, the info command returns all information.

19. FLUSHDB: Empties all keys in the current database
20, Flushall: Empty All the keys in the database
21. Dbsize: Returns the total number of keys for the current database
22. Type key: Returns the data type of a key element (none: Not present, string: Character, List,set,zset,hash), key does not exist return null. Keys Key-pattern: Returns the matching key list (keys foo*: Find KEYS with the beginning of Foo case insensitive)
23, Randomkey: Randomly get an existing key, if the current database is empty, then return an empty string
24, rename A_key b_key update A_key for B_key
25. Xpire Bruce, Key named Bruce, is valid for 1000s.
26, config GET: used to read the configuration parameters running Redis server. Config SET: Used to change configuration parameters for running Redis server. AUTH: Authentication Password
27, Update password config set requirepass password or modify the configuration file by modifying/etc/redis/redis.conf.

Operation Practice of Redis NoSQL database

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.