current location:Home > Technical Articles > Database > Redis

  • How to use Lua script in Java ecosystem/Redis
    How to use Lua script in Java ecosystem/Redis
    1. Install LUA Installing LUA on Mac is very simple. Just use brew related commands directly; brewinstalllua uses the lua-v command to see that lua has been installed. 1) Simple use to create a test.lua file, the content is: Execute command: luatest.lua output is: 2. Introduction to lua syntax Lua provides interactive programming and scripted programming: Interactive programming: directly enter the syntax on the command line , you can execute it immediately and see the execution effect. Scripting is programming: write a script file and then execute it. 1. Comment Lua provides two comment methods: single-line comments and multi-line comments 1) Single-line comments use two minus signs;--2) Multi-line comments--[[Multi-line comments multi-line
    Redis 1738 2023-06-02 22:41:08
  • Example analysis of high availability in Redis sentry mode
    Example analysis of high availability in Redis sentry mode
    1. Preface There are two modes of Redis high availability: sentry mode and cluster mode. This article builds a one-master, two-slave and three-sentinel Redis high-availability service based on the sentinel mode. 1. Goals and gains: One master, two slaves and three sentry Redis services can basically meet the high availability requirements of small and medium-sized projects. Supervisor is used to monitor and manage Redis instances. Through this article, we will achieve the following goals: Sentinel mode service planning and construction Sentinel mode services are more reliable than stand-alone services, and are suitable for scenarios where read and write are separated, the amount of data is not large, and reliability and stability are required. Client integration and read-write separation connect to Sentinel mode through the Spring framework to complete common operations in the production environment. 2. Port planning Port planning is the first step in completing this solution.
    Redis 1036 2023-06-02 22:38:04
  • What is the principle of Redis's common current limiting algorithm and how to implement it
    What is the principle of Redis's common current limiting algorithm and how to implement it
    Introduction Current limiting, referred to as traffic rate limiting (RateLimit), means that only specified events are allowed to enter the system, and the excess will be denied service, queued or waited for, downgraded, etc. Common current limiting schemes are as follows: Fixed time window Fixed time window is One of the most common current limiting algorithms. The concept of window corresponds to the current limiting time unit in the current limiting scenario. The principle timeline is divided into multiple independent and fixed-size windows; requests falling within each time window will increase the counter by 1; if the counter exceeds the current limiting threshold, subsequent requests falling within this window will be rejected. But when the time reaches the next time window, the counter will be reset to 0. Example description: As shown in the above scene, the flow is limited to 10 times per second, the window size is 1 second, and each square represents
    Redis 1655 2023-06-02 22:37:35
  • What are the methods to start redis in Linux?
    What are the methods to start redis in Linux?
    1. Start directly into the redis root directory and execute the command: #Add the '&' sign to make redis run as a background program nohupredis-server& 2. Start by specifying the configuration file to start the specified configuration file for the redis service, for example, configure it as /etc/ redis/6379.conf Enter the redis root directory and enter the command: ./redis-server/etc/redis/6379.conf #If the port is changed, you also need to specify the port when using the redis-cli client to connect, for example: redis- cli-p63803
    Redis 6734 2023-06-02 22:33:03
  • What is the use of reading and writing separation in Redis?
    What is the use of reading and writing separation in Redis?
    Read-write separation Redis implements the "master-slave" operating mode through copies, which is the cornerstone of failover and is used to improve system operation reliability. It also supports read and write separation to improve read performance. You can deploy one master node and multiple slave nodes. Distribute read commands to slave nodes to reduce pressure on the master node and improve performance.
    Redis 1387 2023-06-02 22:33:00
  • How to install and configure redis database under Ubuntu
    How to install and configure redis database under Ubuntu
    1. Log in with root privileges 2. Next enter the command, apt-getinstallredis-server, as shown in the figure: 3. After the installation is completed, the redis server will start automatically. We check the redis server program and execute ps-aux|grepredis, as shown in the figure: 4. Check the redis server status through the startup command, execute: netstat-nlt|grep6379, as shown in the figure: 5. Install the redis server, and the redis command line client program will be automatically installed together. Enter the redis-cli command on this machine to start, and the client program accesses the redis server. Execute: redis-cli, as shown in Figure: 6. Go to
    Redis 1423 2023-06-02 22:28:07
  • How to install and deploy Redis in CentOS7 environment
    How to install and deploy Redis in CentOS7 environment
    1. Search for redis online and find the download link http://download.redis.io/releases/redis-6.0.3.tar.gz2. Use wget to download the gz package. The installation is successful as shown in the figure wgethttp://download .redis.io/releases/redis-6.0.3.tar.gz3. After downloading, decompress tar-zxvfredis-6.0.3.tar.gz4. Go to the decompressed redis directory and compile make5. If it appears during compilation, The following tips are given. Don’t be angry if an error is reported for the first time. There are other errors reported below. This error only means that it is not installed.
    Redis 1117 2023-06-02 22:19:54
  • What are the strange data types and cluster knowledge of redis?
    What are the strange data types and cluster knowledge of redis?
    Various data types The string type is simple and convenient, and supports space pre-allocation, that is, more space will be allocated each time, so that if the string becomes longer next time, there is no need to apply for additional space. Of course, the premise is that the remaining space is enough. . The List type can implement a simple message queue, but note that messages may be lost. It does not support ACK mode. The Hash table is a bit like a relational database, but when the hash table becomes larger and larger, please be careful to avoid using statements such as hgetall, because requesting a large amount of data will cause redis to block, so the brothers behind will have to wait. The set collection type can help you do some statistics. For example, if you want to count the active users on a certain day, you can directly add user I
    Redis 766 2023-06-02 22:01:56
  • How to solve the error when installing redis on ubuntu
    How to solve the error when installing redis on ubuntu
    Troubleshooting and solving redis installation in ubuntu system $wgethttp://download.redis.io/releases/redis-6.0.6.tar.gz#wget command to download the redis installation file, you can also download the compressed package from the official website $tar-xvfredis- 6.0.6.tar.gz#Decompress the downloaded compressed package $mvredis-6.0.6/usr/local/redis#Move the redis installation to /usr/local/, not necessary $cd/usr/local/ redis#Enter this directory
    Redis 1906 2023-06-02 21:56:24
  • Example analysis of Redis master-slave technology
    Example analysis of Redis master-slave technology
    Redis replication In the production environment, Redis uses persistence functions (RDB and AOF technology) to ensure that there will be no loss (or a small loss) of data even if the server is restarted. However, since the data is stored on a server, if this server has problems such as hard disk failure (encountered many times in the production environment), data will also be lost. In order to avoid single points of failure, the usual approach is to copy the database Multiple copies can be deployed on different servers, so that even if one server fails, other servers can still provide services as quickly as possible. To this end, Redis provides a replication function, which can automatically copy the updated data to the same database when the data in a database is updated.
    Redis 1401 2023-06-02 21:53:06
  • What is the implementation principle and process of Redis persistence mechanism?
    What is the implementation principle and process of Redis persistence mechanism?
    What is the implementation principle of Redis persistence mechanism? Persistence: Redis is an in-memory database, and data is stored in memory. In order to avoid permanent loss of data due to process exit, the data in Redis needs to be regularly saved from memory to the hard disk in some form (data or commands); next time When Redis restarts, persistent files are used to achieve data recovery. In addition, for disaster backup, persistent files can be copied to a remote location. What is the persistence process? Since redis data can be saved on disk, what is the process like? There are the following five processes: (1) The client sends a write operation to the server (the data is in the client's memory). (2) Number of write requests received by the database server
    Redis 1012 2023-06-02 21:43:50
  • How to use Redis streams
    How to use Redis streams
    After the introduction of modules in Redis 4.0, users began to think about how to fix these problems themselves. One of the users, Timothy Downs, told me via IRC: \I plan to add a transaction log-style data type to this module - this means that a large number of subscribers can do things like publish/subscribe without causing a huge increase in redis memory. The thing\subscribers hold their position in the message queue instead of having Redis have to maintain the position of each consumer and copy the message for each subscriber. His idea inspired me. I thought about it for a few days and realized that this might be an opportunity for us to address all of the above at once. I need to
    Redis 771 2023-06-02 21:42:47
  • How to use Redis to implement search interface
    How to use Redis to implement search interface
    For back-end developers, a single SQl can be used to implement the list query interface. If the query conditions are complex and the table database design is unreasonable, the query will be difficult. This article will share with you how to use Redis to implement the search interface. Let's start with an example. This is the search condition of a shopping website. If you were asked to implement such a search interface, how would you implement it? Of course, you said that with the help of search engines, such as Elasticsearch, you can implement it. But what I want to say here is, what if you want to implement it yourself? As you can see from the picture above, search is divided into 6 categories, and each category is divided into subcategories. In the middle, there is an intersection between the major categories of conditions. There are single selection, multiple selection, and customized situations in each subcategory.
    Redis 1176 2023-06-02 21:31:21
  • How to implement SpringBoot integration with Redis cache
    How to implement SpringBoot integration with Redis cache
    Cache components supported by SpringBoot In SpringBoot, the cache management and storage of data relies on the cache-related org.springframework.cache.Cache and org.springframework.cache.CacheManager cache manager interfaces in the Spring framework. If there is no bean component of type CacheManager or a CacheResolver cache resolver named cacheResolver defined in the program, SpringBoot will try to enable the following cache components (in the specified order): (1) Generic (
    Redis 1055 2023-06-02 21:28:07
  • Redis+SpringBoot case analysis
    Redis+SpringBoot case analysis
    1. Project environment Front-end technology stack: Vue-Cli Front-end software: WebStorm2020.3 Front-end style: Bootstrap Back-end technology stack: SpringBoot Back-end software: IntelliJIEDA2019 JavaJDK: 1.8 Server: Alibaba Cloud Centos7 Others: MyBatis, Redis, MySql, Docker, Shiro 2. Project demonstration project source code: shoppingProject01_pub:version6.0 project reference: Project05; bad person_Vue-Cli; bad person_Redis; bad person_Axios; Shang Silicon Valley_Redis project
    Redis 1485 2023-06-02 21:09:06

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