In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article gives you a brief introduction to the Redis database. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
Introduction to 1.Redis database
Redis database is a non-relational database of key-value pairs based on memory persistence. In order to ensure efficiency, redis data are cached in memory, the difference is that redis will periodically write updated data to disk or modify operations to additional record files, and on this basis to achieve master-slave (master-slave) synchronization.
Redis supports master-slave synchronization. Data can be synchronized from the master server to any number of slave servers, which can be the master server associated with other slave servers. This makes it possible for Redis to perform single-layer tree replication. Save the disk can intentionally or unintentionally write to the data. Because the publish / subscribe mechanism is fully implemented, when the slave database synchronizes the tree anywhere, it can subscribe to a channel and receive the complete message release record of the master server. Synchronization is helpful for scalability and data redundancy of read operations.
Redis is a memory-managed database, so memory overhead needs to be further optimized:
1. First of all, the most important point is not to turn on the VM option of Redis, that is, the virtual memory function, which is originally used as a persistence strategy for swapping in memory and disk for data stored in excess of physical memory in Redis, but the memory management cost is also very high, and we will analyze later that this persistence strategy is not mature, so to turn off the VM function, please check that the vm-enabled in your redis.conf file is no.
two。 Secondly, it is best to set the maxmemory option in redis.conf, which tells Redis to reject subsequent write requests after using how much physical memory is used. this parameter can protect your Redis from causing swap due to the use of too much physical memory, and eventually seriously affect performance or even crash.
3. If most of the data stored in Redis is numerical, Redis uses a shared integer method to save the overhead of allocating memory, that is, when the system starts up, it allocates a number of numeric objects from 1 to n to be placed in a pool. If the stored data happens to be within this numerical range, the object is taken out of the pool directly and shared by reference count. In this way, when the system stores a large number of values, it can also save memory and improve performance to a certain extent.
2.redis data storage location
We know that redis stores data based on memory, so the data will be lost after a power outage. We can also configure to generate relevant log documents and back up the data on disk. In this way, the next boot can ensure that the data can still be obtained.
3.redis database common data types have been related to the operation
Common actions for setting expiration time:
EXPIRE sets the lifetime of key to ttl seconds
PEXPIRE sets the generation time of key to ttl milliseconds
EXPIREAT sets the expiration time of key to the timestamp of the number of seconds represented by timestamp
PEXPIREAT sets the expiration time of key to the timestamp of milliseconds represented by timestamp
Thank you for reading! This is the end of the brief introduction to Redis database. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.