Redis beginners (1) -- Understanding Redis and redis beginners
The official Redis website defines Redis as "Redis is an open source, BSD licensed, advanced key-value cache and store". We can see that
;setnx (' key ', ' value ');$redis->setnx (' key ', ' value ');Delete Deletes the value of the specified keyReturns the number of keys that have been deleted (long integers)$redis->delete (' Key1 ', ' key2 ');$redis->delete (Array (' Key3 ', ' key4 ', ' key5 '));TtlGet a key to the time of survivalPersistRemove key for lifetime expirationIf the key expires true i
Method:The implementation of redis list is a two-way linked list, that is, it supports reverse lookup and traversal to facilitate operations. However, it brings some additional memory overhead and many internal implementations of redis, this data structure is also used, including the sending Buffer Queue.
SetCommon commands:Sadd, spop, smembers, and sunion.Application scenarios:The functions provided by
In-depth introduction to Redis-redis sentinel cluster, simple introduction to redis-redis1. Sentinel
Sentinel is a Redis high availability solution: a Sentinel system consisting of one or more Sentinel instances can monitor any number of Master servers, and all slave servers under the master server. When the monitored
returns the cardinality estimate for the given Hyperloglog. The Redis pgmerge command merges multiple hyperloglog into one hyperloglog redis Publish subscription command commands describe the Redis psubscribe command to subscribe to one or more channels that conform to a given mode.
, but the data set will be more effective than it is when it is not compressed.
rdbcompression yesData Verification
Starting from RDB of version 5CRC64Will be placed at the end of the file. This will guarantee the integrity of the file, but will lose some performance (about 10%) when saving or loading the file ). If you want to achieve higher performance, you can disable it so that the file will use0Replace, as shown during loading0The verification will be skipped directly.
rdbchecksum yesManual
200 Redis instances on a server, and it crashes. The only way to do this is to make different types of data belong to different applications and separate from each other.So, is there a way for Redis to keep different application data separate from each other and stored on the same instance? is equivalent to the MySQL database, different application data is stored under different databases.Under
. conf
# By default, redis is not running in the background mode. If you need to run the program in the background, change the value of this item to yes. The default value is no.Daemonize: whether to run in daemon mode# For example, redis writes the pid to the/run/Redis. pid file group by default when processes in
Automatic Redis installation and deployment
This article consists of four parts:
Description of the directory structure of the redis automatic installation script;
Redis automatic installation script content;
Description of the redis Operating System Service script;
The URL of the document referenced in this article.
N
types –redis supports binary case Strings, Lists, hashes, sets and Ordered sets data type operations, and is transparent to programmers without abstraction.3. All operations of atomic –redis are atomic, meaning either successful execution or failure to execute at all. A single operation is atomic. Multiple operations also support transactions, namely atomicity, wrapped by multi and EXEC
#chkconfig:35 95 95 in the third Line Plus to add system services: Chkconfig--add redis Setup boot: chkconfig redis on Check service status: Chkconfig--list redis6, specifying log location pid file Database file storage location (next write persistence) vim/etc/redis/6379.conflogfile "/var/log/redis.log" specifies that the log file will be output in the console
and other functions, on the above all the set operation, you can also use different commands to choose the results returned to the client or save set to a new collection.
Summary of some problems encountered in the process of Redis use
TPN (Taobao push notification) in the use of Redis computed message unread, encountered a series of problems, the following pr
following begins the installation of Redis on Linux.installing Redis under LinuxDownload the Redis installation package: http://redis.io/[[Email protected] ftpuser]# tar zxvf redis-3.2.0.tar.gz[[email protected] ftpuser]# CD Redis-3.2.0[[email protected] Red is-3.2.0]# Make
Note; 2) port modified to: 7001; 3) Daenonize no change to: daenonize Yesredis-cluster-02:1) Open #cluster-enable Note; 2) port modified to: 7002; 3) Daenonize no change to: daenonize Yesredis-cluster-03:1) Open #cluster-enable Note; 2) port modified to: 7003; 3) Daenonize no change to: daenonize Yesredis-cluster-04:1) Open #cluster-enable Note; 2) port modified to: 7004; 3) Daenonize no change to: daenonize Yesredis-cluster-05:1) Open #cluster-enable Note; 2) port modified to: 7005; 3) Daenoni
setting MaxMemory to 45% or 95% of the available memory for the system (depending on the persistence policy) and setting "Maxmemory-policy" to "Volatile-ttl" or "ALLKEYS-LRU" (depending on expiration settings), It is possible to limit redis maximum memory usage more accurately and use these 2 methods in most scenarios to ensure that Redis does not swap memory. If you are concerned about the loss of data du
. Well, don't say much, let's start today's course. Second, preparation installing Redis on a Linux operating system is not complicated, it can be said to be simple, but first contact, If not very clear, there will be a lot of pits waiting for you. These pits I have already filled up, as long as everyone according to my writing to do, basically no problem. Insurance point, I said "basic", haha. We'll do the preparatory work first, and these pre
remote access Redis
To support remote access debugging, you need to annotate bind 127.0.0.1 in the configuration file, in addition to the need to open server port number 6379, but should be released from the production environment to avoid hacker attacks
Four, restart Redis
V. Test usage commands
Back: Hello World, proof of installation success
This a
[TOC]
Redis Note-taking (ii): Java API use with Redis distributed cluster environment using Redis Java API (i): Standalone version of Redis API usageThe Redis Java API operates through Jedis, so the first Jedis third-party libraries are needed, because the MAVEN projec
commands
Key/value-related commands.
Keys * # Query all
Keys user * # query the specified
Exists user: 001 # determine whether the user exists.
Del name # Delete the specified key.
Expire addr 10 # set the Expiration Time
Ttl addr # query the Expiration Time
Select 0 # select database
Move age 1 # move age to database 1.
Get age # get
Persist age # the expiration time of the age to be removed.
Randomkey #
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.