current location:Home > Technical Articles > Database > Redis

  • How to install a six-node cluster in Redis
    How to install a six-node cluster in Redis
    Introduction: rediscluster is a native cluster solution. Currently, it has made great progress in terms of high availability and stability. According to statistics and observations, more and more companies and communities are adopting the rediscluster architecture, which has become a de facto standard. Its main feature is decentralization and no need for proxy. One of the main design goals is to achieve linear scalability. The rediscluster server alone cannot complete the officially promised functions. In a broad sense, rediscluster should include both redis servers and client implementations such as jedis. They are a whole. Distributed storage is nothing more than
    Redis 1313 2023-06-03 09:19:28
  • What are the differences between redis and Memcached?
    What are the differences between redis and Memcached?
    Redis is a database, but unlike traditional databases, redis data is stored in memory, so the read and write speed is very fast, so redis is widely used in caching. memcached is a high-performance distributed memory cache server. The general purpose of use is to increase the speed and scalability of dynamic web applications by caching database query results and reducing the number of database accesses. Salvatore Sanfilippo, author of the authoritative comparison of Redis, once compared these two memory-based data storage systems: Redis supports server-side data operations: Compared with Memcached, Redis has more data structures and supports richer
    Redis 1458 2023-06-03 09:14:04
  • How to implement Redis data sharding
    How to implement Redis data sharding
    Introduction to Twemproxy Twitter's Twemproxy is currently the most widely used on the market and is used to provide redis cluster services. Since redis is single-threaded, and the official cluster is not very stable and widely used. Twemproxy is a proxy sharding mechanism. As a proxy, Twemproxy can accept access from multiple programs, forward it to each Redis server in the background according to routing rules, and then return to the original route. This solution well solves the problem of the carrying capacity of a single Redis instance. Of course, Twemproxy itself is also a single point and needs to use Keepalived as a high-availability solution (or LVS). by Twempr
    Redis 1661 2023-06-03 09:05:25
  • What are the methods used by Go Redis client?
    What are the methods used by Go Redis client?
    Introduction: The bottom layer of go-redis and redigo is implemented by calling the universal Do method, but redigo: since the input is a universal type, you must remember the parameters and return values ​​of each command, which is very unfriendly to use. The parameter type is a universal type. As a result, the parameter type cannot be checked during the compilation phase. Each command requires time to record the usage method, number of parameters, etc., which is costly to use; go-redis: refines the functions of each redis command, we only need to remember Command, for specific usage, you can directly check the application of the interface, and the cost of use is low; secondly, it unifies the data type according to the underlying type of redis, which can help check the parameter type during compilation and its response is uniformly Res.
    Redis 1160 2023-06-03 09:01:38
  • How to use opsForValue of RedisTemplate
    How to use opsForValue of RedisTemplate
    Use of the opsForValue() method in Redis 1. set(Kkey, Vvalue) adds a string type value, key is the key, and value is the value. redisTemplate.opsForValue().set("stringValue","bbb"); 2. get(Objectkey) gets the value corresponding to the key key. StringstringValue=redisTemplate.opsForValue().get("key")3. append(Kkey,St
    Redis 2318 2023-06-03 08:55:09
  • How to use the Redis command line tool
    How to use the Redis command line tool
    When executing a single command to access the Redis server, we usually use redis-cli to enter the interactive mode, and then read and write the server by asking and answering questions. In this case, we use its "interactive mode". There is another "direct mode", which executes the command and obtains the output results by passing the command parameters directly to redis-cli. $redis-cliincrbyfoo5(integer)5$redis-cliincrbyfoo5(integer)10If the output content is large, you can also redirect the output to an external file$redis-cliinfo>info.txt$wc-linfo.txt120i
    Redis 1412 2023-06-03 08:53:05
  • Centos7.6 installation Redis instance analysis
    Centos7.6 installation Redis instance analysis
    1. Install gcc dependencies. Since redis is developed in C language, you must first confirm whether the gcc environment (gcc-v) is installed before installation. If it is not installed, execute the following command to install it [root@localhostlocal]#yuminstall-ygcc 2. Download and Unzip the installation package [root@localhostlocal]#wgethttp://download.redis.io/releases/redis-5.0.3.tar.gz[root@localhostlocal]#tar-zxvfredis-5.0.3.tar.gz 3. cd Switch to redi
    Redis 1218 2023-06-03 08:28:06
  • How to use Redis to implement distributed locks in SpringBoot
    How to use Redis to implement distributed locks in SpringBoot
    1. Redis implements distributed lock principle and why distributed locks are needed. Before talking about distributed locks, it is necessary to explain why distributed locks are needed. The opposite of distributed locks is stand-alone locks. When we write multi-threaded programs, we avoid data problems caused by operating a shared variable at the same time. We usually use a lock to mutually exclude the shared variables to ensure the correctness of the shared variables. Its scope of use is in the same process. If there are multiple processes that need to operate a shared resource at the same time, how can they be mutually exclusive? Today's business applications are usually microservice architecture, which also means that one application will deploy multiple processes. If multiple processes need to modify the same row of records in MySQL, in order to avoid dirty data caused by out-of-order operations, distribution needs to be introduced at this time. The style is locked. Want to achieve points
    Redis 1956 2023-06-03 08:16:32
  • How to build a redis replication cluster
    How to build a redis replication cluster
    Environment preparation 1. Server (or cloud server) based on centos7 system; 2. Due to resource limitations, this article will be built on a server and distinguished by different port numbers; 2. Upload the redis installation package Go to the specified directory (and decompress) 2. In the current directory, create three directories. Create three file directories 7001, 7002, and 7003 respectively. 3. Copy the redis.conf configuration file under the redis decompression package to 4. Modify the default port number of each configuration file in the three directories. The data storage directory can be replaced and modified in batches using the sed command sed-i-e's/6379/7001/
    Redis 1364 2023-06-03 08:03:49
  • How to implement Redis distributed cache and flash sales
    How to implement Redis distributed cache and flash sales
    1. Problems with single-point Redis 1. Data loss problem Redis data persistence. 2. For concurrency issues, we use master-slave clusters to achieve separation of reading and writing. 3. Fault recovery issues use Redis Sentinel to implement health detection and automatic recovery. 4. For storage capacity issues, build a sharded cluster and use the slot mechanism to achieve dynamic expansion. 2. The full name of RDBRDB is RedisDatabaseBackupfile (Redis data backup file), also called Redis data snapshot. To put it simply, all the data in the memory is recorded to the disk. When the Redis instance fails and restarts, the snapshot file is read from the disk and the data is restored. The snapshot file is called an RDB file and is saved in the current running directory by default. R
    Redis 1291 2023-06-02 23:43:20
  • How to set up php environment redis
    How to set up php environment redis
    1. Download 1. Download http://download.redis.io/releases/redis-6.0.9.tar.gz locally, transfer the file and upload it to /usr/local/src/2, wget-P/usr/local /src/http://download.redis.io/releases/redis-6.0.9.tar.gz 2. Unzip, compile, and install>cd/usr/local/src>tarxzftarxzfredis-6.0.9.tar.gz> cdredis-6.0.9>make
    Redis 926 2023-06-02 23:25:05
  • How Springboot implements Redis distributed reentrant lock source code analysis based on Redisson
    How Springboot implements Redis distributed reentrant lock source code analysis based on Redisson
    1. Introduction We are using Redis to implement distributed locks. At first, we generally use SETresource-nameanystringNXEXmax-lock-time to lock, and use Lua scripts to ensure atomicity to release the lock. This manual implementation is more troublesome. The Redis official website also clearly states that the Java version uses Redisson to implement it. The editor also looked at the official website and slowly figured it out, and took a close-up to record it. From the official website to integrating Springboot to source code interpretation, take a single node as an example. 2. Why use Redisson1. We open the official website redis Chinese official website 2. We can see that the official website allows us to use other 3. Open the official push
    Redis 1231 2023-06-02 23:21:42
  • How to catch redis exception in Python
    How to catch redis exception in Python
    Python captures the redis exception scenario and reproduces it. Using python's redis package to connect to redis, the wrong password was deliberately set, but it was found that it did not cause an exception. Environment system: win10 python version: 3.6.8 Initial code importredishost="127.0.0.1" port=6379password ="123456"redis_conn=redis.Redis(host=host,port=port,password) After testing, we found that after creating the connection object, we use the conn object to
    Redis 838 2023-06-02 23:14:46
  • How SpringBoot integrates Redis
    How SpringBoot integrates Redis
    The architectural solution uses redis for centralized storage to realize distributed cluster sharing of user information. Here we use the third-party open source plug-in crazycake to implement it. The pom.xml introduces: org.springframework.bootspring-boot-starter-data-redisorg.crazycakeshiro-redis3.2.3 Configure application.properties: #Redis#Database index (default is 0) redis.database=0#Change the server address to your own redis.host=127.0.0.1#Server connection port re
    Redis 860 2023-06-02 23:07:01
  • How to apply Redis keys and common database instructions
    How to apply Redis keys and common database instructions
    1. Redis key (key) general instruction key characteristics: key is a string, and the data saved in redis is obtained through key. 1. Key basic operation command function delkey ​​This command is used to delete keyexistskey when the key exists. Check whether the given key exists. Typekey returns the type of the value stored in the key. Demonstration results: 2. Timeliness control command function EXPIREkeyseconds sets expiration for the given key. Time, in seconds PEXPIRE keymilliseconds Set the expiration time of the key in milliseconds EXPIREAT keytimestamp The role of EXPIREAT and EXPIRE
    Redis 1278 2023-06-02 22:43:54

Tool Recommendations

jQuery enterprise message form contact code

jQuery enterprise message form contact code is a simple and practical enterprise message form and contact us introduction page code.
form button
2024-02-29

HTML5 MP3 music box playback effects

HTML5 MP3 music box playback special effect is an mp3 music player based on HTML5 css3 to create cute music box emoticons and click the switch button.

HTML5 cool particle animation navigation menu special effects

HTML5 cool particle animation navigation menu special effect is a special effect that changes color when the navigation menu is hovered by the mouse.
Menu navigation
2024-02-29

jQuery visual form drag and drop editing code

jQuery visual form drag and drop editing code is a visual form based on jQuery and bootstrap framework.
form button
2024-02-29

Organic fruit and vegetable supplier web template Bootstrap5

An organic fruit and vegetable supplier web template-Bootstrap5
Bootstrap template
2023-02-03

Bootstrap3 multifunctional data information background management responsive web page template-Novus

Bootstrap3 multifunctional data information background management responsive web page template-Novus
backend template
2023-02-02

Real estate resource service platform web page template Bootstrap5

Real estate resource service platform web page template Bootstrap5
Bootstrap template
2023-02-02

Simple resume information web template Bootstrap4

Simple resume information web template Bootstrap4
Bootstrap template
2023-02-02

Cute summer elements vector material (EPS PNG)

This is a cute summer element vector material, including the sun, sun hat, coconut tree, bikini, airplane, watermelon, ice cream, ice cream, cold drink, swimming ring, flip-flops, pineapple, conch, shell, starfish, crab, Lemons, sunscreen, sunglasses, etc., the materials are provided in EPS and PNG formats, including JPG previews.
PNG material
2024-05-09

Four red 2023 graduation badges vector material (AI EPS PNG)

This is a red 2023 graduation badge vector material, four in total, available in AI, EPS and PNG formats, including JPG preview.
PNG material
2024-02-29

Singing bird and cart filled with flowers design spring banner vector material (AI EPS)

This is a spring banner vector material designed with singing birds and a cart full of flowers. It is available in AI and EPS formats, including JPG preview.
banner picture
2024-02-29

Golden graduation cap vector material (EPS PNG)

This is a golden graduation cap vector material, available in EPS and PNG formats, including JPG preview.
PNG material
2024-02-27

Home Decor Cleaning and Repair Service Company Website Template

Home Decoration Cleaning and Maintenance Service Company Website Template is a website template download suitable for promotional websites that provide home decoration, cleaning, maintenance and other service organizations. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-05-09

Fresh color personal resume guide page template

Fresh color matching personal job application resume guide page template is a personal job search resume work display guide page web template download suitable for fresh color matching style. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-29

Designer Creative Job Resume Web Template

Designer Creative Job Resume Web Template is a downloadable web template for personal job resume display suitable for various designer positions. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28

Modern engineering construction company website template

The modern engineering and construction company website template is a downloadable website template suitable for promotion of the engineering and construction service industry. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28