redisbloom / jredisbloom Goto Github PK
View Code? Open in Web Editor NEWJava Client for RedisBloom probabilistic module
Home Page: https://redisbloom.io
License: BSD 2-Clause "Simplified" License
Java Client for RedisBloom probabilistic module
Home Page: https://redisbloom.io
License: BSD 2-Clause "Simplified" License
Support JedisCluster.
Don't support JedisCluster
cuckoofilter createfilter command CF.INIT
什么时候可以支持以下功能:
I got an Error like this:
java.lang.NoClassDefFoundError: redis/clients/jedis/util/Pool
my jrebloom version is 2.1.0, jedis version is 2.9.3
Client.class in io.rebloom.client like this:
import redis.clients.jedis.util.Pool
. But my jedis folder is redis.clients.util, so it cannot find path(redis.clients.jedis.util.Pool)
should i change my jrebloom or jedis to a suitable version?
please implements Client.bfinfo() method!
Hello,
I am following the example on how to create a filter, but I am running into the error below:
redis.clients.jedis.exceptions.JedisDataException: ERR unknown command `BF.RESERVE`, with args beginning with: `specialBloom`, `0.01`, `500000`,
at redis.clients.jedis.Protocol.processError(Protocol.java:132)
at redis.clients.jedis.Protocol.process(Protocol.java:166)
at redis.clients.jedis.Protocol.read(Protocol.java:220)
Looking at the documentation here: https://oss.redislabs.com/redisbloom/Bloom_Commands/
it seems that it should work with those args --> BF.RESERVE {key} {error_rate} {capacity}
Here is how I am initializing it (I have my local redis instance on port 6379):
redisClient = new Client("localhost", 6379);
redisClient.createFilter("specialBloom", 500000, 0.01);
Any help would be appreciated!
Given RedisBloom/RedisBloom#285 there is the following set of commands we should enable:
TDIGEST.CREATE
: Allocate a new histogramTDIGEST.RESET
: Empty out a histogram and re-initialize itTDIGEST.ADD
: Add a value to the t-Digest with the specified countTDIGEST.MERGE
: Merge one t-Digest into anotherTDIGEST.CDF
: Returns the fraction of all points added which are ≤ x.TDIGEST.QUANTILE
: Returns an estimate of the cutoff such that a specified fraction of the data added to the t-Digest would be less than or equal to the cutoff.TDIGEST.MIN
: Get the minimum value from the histogram. Will return DBL_MAX if the histogram is emptyTDIGEST.MAX
: Get the maximum value from the histogram. Will return DBL_MIN if the histogram is emptyTDIGEST.INFO
: Returns compression, capacity, total merged and unmerged nodes, the total compressionsWith the in-depth params in https://oss.redislabs.com/redisbloom/master/TDigest_Commands/
Hello, how can I connect if redis has a password?
package com.ghy.www.test9;
import com.ghy.www.f.F;
import io.rebloom.client.Client;
import io.rebloom.client.ReserveParams;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class Bloom_6 {
private static JedisPool pool = new JedisPool(new JedisPoolConfig(), F.IP_1, F.PORT_1, F.TIMEOUT_1, F.PASSWORD_1);
public static void main(String[] args) {
Jedis jedis = null;
Client client = null;
try {
jedis = pool.getResource();
jedis.flushDB();
client = new Client(pool);
ReserveParams params = new ReserveParams();
client.bfReserve("mykey", 0.001, 10, params);
client.add("mykey", "a");
client.add("mykey", "b");
client.add("mykey", "c");
client.add("mykey", "d");
client.add("mykey", "e");
Map backupMap = new HashMap();
Map.Entry<Long, byte[]> mykey = client.cfScanDump("mykey", 0);
while (mykey.getKey() != 0) {
long cursor = mykey.getKey();
byte[] dataArray = mykey.getValue();
backupMap.put(cursor, dataArray);
mykey = client.cfScanDump("mykey", cursor);
}
jedis.flushDB();
Set<Map.Entry> set = backupMap.entrySet();
Iterator<Map.Entry> iterator = set.iterator();
while (iterator.hasNext()) {
client.cfLoadChunk("mykey", iterator.next());
}
System.out.println();
Map<String, Object> mykeyInfo = client.info("mykey");
for (String eachKey : mykeyInfo.keySet()) {
System.out.println("key=" + eachKey + " value=" + mykeyInfo.get(eachKey));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
if (client != null) {
client.close();
}
}
}
}
redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value
Is there cuckoo filter implements in cluster mode? I saw ClusterClient didn't include cf func.
Hi,
We are interested in using this library in order to insert and retrieve key from redis bloomfilter. Do you have any plans to host the jar in maven repository ?
Thanks,
Chathuri
need for speed !
thank you !
There is no function to check if a filter already exists with a given key.
bfScanDump
thank you !
package com.ghy.www.test9;
import com.ghy.www.f.F;
import io.rebloom.client.Client;
import io.rebloom.client.InsertOptions;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import java.util.Map;
public class Bloom_3 {
private static JedisPool pool = new JedisPool(new JedisPoolConfig(), F.IP_1, F.PORT_1, F.TIMEOUT_1, F.PASSWORD_1);
public static void main(String[] args) {
Jedis jedis = null;
Client client = null;
try {
jedis = pool.getResource();
jedis.flushDB();
client = new Client(pool);
{
InsertOptions insertOptions = new InsertOptions();
boolean[] insert = client.insert("mykey", insertOptions, "a", "b", "c");
for (int i = 0; i < insert.length; i++) {
System.out.println(insert[i]);
}
System.out.println();
Map<String, Object> mykey = client.info("mykey");
for (String eachKey : mykey.keySet()) {
System.out.println("key=" + eachKey + " value=" + mykey.get(eachKey));
}
}
System.out.println();
System.out.println();
{
InsertOptions insertOptions = new InsertOptions();
boolean[] insert = client.insert("mykey", insertOptions, "x", "y", "z");
for (int i = 0; i < insert.length; i++) {
System.out.println(insert[i]);
}
System.out.println();
Map<String, Object> mykey = client.info("mykey");
for (String eachKey : mykey.keySet()) {
System.out.println("key=" + eachKey + " value=" + mykey.get(eachKey));
}
}
System.out.println();
System.out.println();
{
InsertOptions insertOptions = new InsertOptions();
insertOptions.nocreate();
client.insert("nononokey", insertOptions, "x", "y", "z");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
if (client != null) {
client.close();
}
}
}
}
true
true
true
false
key=Expansion rate value=2
key=Number of filters value=1
key=Capacity value=100
key=Number of items inserted value=3
key=Size value=290
true
true
true
false
key=Expansion rate value=2
key=Number of filters value=1
key=Capacity value=100
key=Number of items inserted value=6
key=Size value=290
redis.clients.jedis.exceptions.JedisDataException: ERR not found
please implements Client.createFilter() method NONSCALING param !
thank you very much !
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Failed connecting to host
Lettuce is yet another redis client library beside jedis.
Lettuce is different by supporting custom commands for redis4.0 modules.
so your don't really need hardcode your jrebloom library.
In the Client
class, i get that you import redis.clients.jedis.util.Pool;
but my project occour this Exception:java.lang.ClassNotFoundException: redis.clients.jedis.util.Pool
;I am sure it's the version of jedis(2.9.0) in my project cause this problem .So,what is your version of jedis? Thx.
String rep = sendCommand(conn, Command.RESERVE, name, errorRate + "", initCapacity + "").getStatusCodeReply();
will casue Byte caste long error
I am building a daily bloom filter where I make a new bloom-filter and remove the old filter via scheduler, but the delete command doesn't seem to be able to remove key.
Eg:
Client client1 = new Client("127.0.0.1", 6379);
String[] bloomFilterKeyList = {"a", "b"};
client1.addMulti("testBloom", bloomFilterKeyList);
client1.delete("testBloom");
Even after running the command testBloom key/filter still doesn't get deleted.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.