transaction and discard all commands of the transaction block. If you are using watch monitoring, all monitoring will be canceled.Time Complexity: O (1)Return Value: Always Returns OK
WatchFormat: wathc key [key...]Specifies the KEY (multiple keys) to be monitored. If this (or these) key is changed by other commands before the transaction is executed, the transaction will be interrupted.Time Complexity: O
The list type in Redis is somewhat similar to an array in a programming language, and the list type, as shown in the following illustration, is actually a two-way linked list structure that controls the data in the list by Lpush, Lpop, Rpush, rpop commands, so the list type can be used as a stack, can also be used as a queue.
Redis Chain List List type
The effi
Redis 3 All commands
Note: This article refer to Redis Chinese web, content update. The list of commands in the redis.cn redis Chinese network is Redis version 2.8, this article is the latest
@~]# redis-cli info default[root@~]# redis-cli info allSee http://www.redis.cn/commands/info.html for details2. MONITORMONITOR is a debugging command that returns every command processed by the server. It helps us understand what operations have taken place on the database. There are three methods:[root@~]# redis-cli m
SET command dynamically adjusts the configuration of the Redis server without having to reboot
Dbsize
Returns the number of keys for the current database
DEBUG OBJECT
Debug OBJECT is a debug command that should not be used by the client
DEBUG Segfault
Perform an illegal memory access so that Redis crashes and is only used for BUG simulations at devel
an example)cd/data/soft/redis/src/./redis-trib.rb del-node 127.0.0.1:7007 ' 9FC511D059EB7FCCAE41663D495E73275E942AEC '#6, delete a master node (this is the case with 7006 nodes)#6.1. Remove the master node first by using Reshard to remove all of the master slotscd/data/soft/redis/src/./redis-trib.rb Reshard 127.0.0.1:
Redis provides a rich command to manipulate databases and various data types, which can be used on Linux endpoints. In programming, such as various language packs, these commands have a corresponding method. The following is a summary of the commands provided by Redis.Related articles: redis Common Command Manual: key-
Redis Common management commands:
bgrewriteaof
Asynchronously (asynchronously) rewrites the AoF file to reflect the state of the current database.
Even if the bgrewriteaof command fails, the data in the old aof file will not be lost or changed. Bgsave
Asynchronously saves data from the current database to disk in the background.
The Bgsave command returns OK immediately after execution, then
, respectively, from the left pop-up, from the right pop-up, the return value is a pop-up value. (pop-up means to remove the value and return the value)
127.0.0.1:6379> lrange mylist 0-1
1) "-2"
2) "-1"
3 "" 0 "
4)" 1 "
127.0.0.1:6379> Lpop MyList
"-2"
127.0.0.1:6379> rpop mylist
"1"
127.0.0.1:6379> lrange mylist
-0-1 1) "-1"
2) "0"
Combined with the above four commands, you can implement stacks and queues.
Stacks: lpush and lpop or usin
Redis InstallationLinux under the Environment install Redis, I download here is 3.0.0 version (currently the latest 3.2.0).wget http://download.redis.io/releases/redis-3.0.0.tar.gztar xzf redis- 3.0. 0. Tar . gz$ CD Redis-3.0. 0 makeSo
Redis watch command
Purpose:Monitors one or more keys. If the key is changed by another command before the transaction is executed, the transaction is interrupted.Usage:
redis 127.0.0.1:6379> WATCH key1 key2OKRedis unwatch command
Purpose:This command is used to cancel monitoring of all keys by the watch command.Usage:
redis 127.0.0.1:6379> UNWATCHOKRedis multi c
1437992922732 6connected9b7b98c4bf2517e4f172a895b5728d13bef62952127.0.0.1:7000Master-0 1437992923234 1Connected0-5460ee95130f0aed20c62881df8070d7690c4608a7cc127.0.0.1:7003Slave 9b7b98c4bf2517e4f172a895b5728d13bef629520 1437992924236 4Connected(2) Deleting a nodeBefore deleting a node, the first thing is to ensure that there is no data in the node, and if there is data to be fragmented, transfer the data. followed by the ID with cluster nodes will be able to find the corresponding ~Delete the da
a scoreZcard Zseta//Returns the number of all elements in the collectionZcount Zseta 1 10//Returns the number of elements in the score range 1-10Zrem Zseta 222//delete specified elementZremrangebyrank Zseta 0 2//delete element of index range 0-2, sort by scoreZremrangebyscore Zseta 1 10//Delete the element of the score range 1-10Key-Value Related:Keys *//Remove all keysKeys m*//fuzzy matchingEXPIRE Key1 100//Set Key1 expires after 100sDel Key1//Deletes a key, returns 1 successfully, otherwise r
1. PingTo test whether the connection survives:Redis 127.0.0.1:6379> PingPONGBefore executing the following command, we stop the Redis serverRedis 127.0.0.1:6379> PingCould not connect to Redis at 127.0.0.1:6379:connection refusedBefore executing the following command, we start the Redis serverNot connected> PingPONGRedis 127.0.0.1:6379>The first ping indicates
Redis provides a rich command to manipulate databases and various data types, which can be used on Linux endpoints. In programming, such as various language packs, these commands have a corresponding method. The following is a summary of the commands provided by Redis. Key-Value Related
Start Redis ServiceSrc/redis-server or Src/redis-server redis.confSrc/redis-server redis.conf 1>log.log 2>errlog.log1 is the standard output and 2 is the error outputRandomly start Redis as a Linux serviceVi/etc/rc.local, add code:/root/install/
############################### # By default, Redis is asynchronously exporting data to disk. This mode is good enough in many applications, but the Redis process # issues or power outages can cause write loss over time (depending on the configured Save command). # # AOF is a more reliable alternative to persistence mode, such as using the default data write file policy (see following configuration) #
Introduction:
Common commands
1. Start without Configuration
Src/redis-Server
2. Start with configuration
Src/redis-server redis. conf
3. Start with configuration and logs
Src/redis-server redis. conf 1>
value is the number of elements that were successfully added (ignored elements are not counted).
sremThe same is true for commands, delete elements, and if the element exists to delete the success, the return value is the number of elements that were successfully deleted.
2, get all the elements in the collection
Smembers Key
3, determine whether the element is in the collection
Sismember Key Member
The time complexity of
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.