Home >Database >Redis >A brief discussion on the installation and configuration methods of Bloom filters in Redis

A brief discussion on the installation and configuration methods of Bloom filters in Redis

青灯夜游
青灯夜游forward
2021-10-12 11:04:552854browse

This article will introduce you to the Bloom Filter in Redis and introduce the installation and configuration methods of Bloom Filter. I hope it will be helpful to you!

A brief discussion on the installation and configuration methods of Bloom filters in Redis

Redis installs Bloom Filter. Some students specify what Bloom Filter is and when to use it, but they may not have actually used Bloom Filter. device, so I specially released the installation chapter! ! ! You can study it in conjunction with my Bloom filter article so that you can actually operate it. [Related recommendations: Redis video tutorial]

1. Version requirements

  • Recommended version 6.x, minimum 4 .x version, you can check the version through the following command:
redis-server -v

A brief discussion on the installation and configuration methods of Bloom filters in Redis

  • Plug-in installation, most online recommend v1.1.1, When the article was written, v2.2.6 was already a release version. Users can choose by themselves. The addresses are all below (the official website of 2.2.6 says it is a maintenance version of version 1.0. If you don’t want to use new features, there is no need to upgrade!)

A brief discussion on the installation and configuration methods of Bloom filters in Redisv1.1.1

https://github.com/RedisLabsModules/rebloom/archive/v1.1.1.tar.gz

v2.2.6

https://github.com/RedisLabsModules/rebloom/archive/v2.2.6.tar.gz

2. Installation & Compilation

The following installations are all completed in the specified directory. You can choose a suitable unified directory for software installation and management.

2.1 Download the plug-in compressed package

wget https://github.com/RedisLabsModules/rebloom/archive/v2.2.6.tar.gz

2.2 Unzip

tar -zxvf v2.2.6.tar.gz

2.3 Compile the plug-in

cd RedisBloom-2.2.6/
make

A brief discussion on the installation and configuration methods of Bloom filters in Redis

After successful compilation, you can see the redisbloom.so file

3. Redis integration

3.1 Redis configuration File modification

  • Add the address of the redisbloom.so file such as RedisBloom to the redis.conf configuration file
  • If it is a clusterThe address of the redisbloom.so file needs to be added to each configuration file
  • After the addition is completed, restart redis
loadmodule /usr/local/soft/RedisBloom-2.2.6/redisbloom.so

redis. The loadmodule configuration items are preset in the conf configuration file. We can modify them directly here. Subsequent modifications will be more convenient. \

A brief discussion on the installation and configuration methods of Bloom filters in Redis

#Be sure to remember to restart Redis after saving and exiting!
Be sure to remember to restart Redis after saving and exiting!
Be sure to remember to restart Redis after saving and exiting!

3.2 Test whether it is successful

The main instructions for the Redis integrated Bloom filter are as follows:

  • bf.add Add a Element
  • bf.exists Determines whether an element exists
  • bf.madd Adds multiple elements
  • bf.mexists Determines whether multiple elements exist

Connect to the client for testing. If the command is valid, the integration is successful\

A brief discussion on the installation and configuration methods of Bloom filters in Redis

If the following situation occurs (error) ERR unknown command, you can check it by the following method:

  • SHUTDOWN the Redis instance, restart the instance, and test again
  • Check whether the configuration file is configured with the correct redisbloom.so file address
  • Check whether the Redis version is too low

A brief discussion on the installation and configuration methods of Bloom filters in Redis

For more programming-related knowledge, please visit: Introduction to Programming! !

The above is the detailed content of A brief discussion on the installation and configuration methods of Bloom filters in Redis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.cn. If there is any infringement, please contact admin@php.cn delete