Skip to content

Latest commit

 

History

History
75 lines (64 loc) · 2.7 KB

README.md

File metadata and controls

75 lines (64 loc) · 2.7 KB

Java Jedis

  • Library: Jedis
  • Library version : 3.4.0
  • Runtime Version: JDK 12
  • RS version: 6.0.8-32
  • OSS Redis: 6.0.6
Simple Sentinel Cluster
Y Y Y
TLS Y N/A Y
  • N/A : Not Available
  • N/C : Not researched or checked

Comments/Gotchas

  • Simple fast library, documentation can be struggle see tests
  • Does not support TLS with Sentinel. see PR
  • A more comprehensive example from Julien is available in SA repo
  • No auto-reconnect OOTB but using connection pooling gives you some of that. StackOverflow
  • Pipelining with the Cluster API in Jedis is tedious and manual and application has to make sure all commands in pipeline are for the same slot

Prerequisite

Install Java JDK

Setup

cd to jedis directory

./mvnw clean package

Run

Password is optional for all samples

Simple

java -cp  ./target/jedissample-1.0-SNAPSHOT-jar-with-dependencies.jar com.rl.sample.jedis.Simple host port password

Sentinel

java -cp  ./target/jedissample-1.0-SNAPSHOT-jar-with-dependencies.jar com.rl.sample.jedis.Sentinel  host port service password

Cluster

java -cp  ./target/jedissample-1.0-SNAPSHOT-jar-with-dependencies.jar com.rl.sample.jedis.Cluster  host port password

Simple TLS

java -cp ./target/jedissample-1.0-SNAPSHOT-jar-with-dependencies.jar \
    -Djavax.net.ssl.keyStoreType=pkcs12 \
    -Djavax.net.ssl.keyStore=../../testscripts/tls/db_cert.pfx \
    -Djavax.net.ssl.keyStorePassword=${BUNDLE_PASSWORD} \
    -Djavax.net.ssl.trustStoreType=jks \
    -Djavax.net.ssl.trustStore=../../testscripts/tls/sample_ca_truststore.jks \
    -Djavax.net.ssl.trustStorePassword=${BUNDLE_PASSWORD} \
    -Djavax.net.debug=ssl \
    com.rl.sample.jedis.SimpleTLS host port password

Cluster TLS

java -cp ./target/jedissample-1.0-SNAPSHOT-jar-with-dependencies.jar \
    -Djavax.net.ssl.keyStoreType=pkcs12 \
    -Djavax.net.ssl.keyStore=../../testscripts/tls/db_cert.pfx \
    -Djavax.net.ssl.keyStorePassword=${BUNDLE_PASSWORD} \
    -Djavax.net.ssl.trustStoreType=jks \
    -Djavax.net.ssl.trustStore=../../testscripts/tls/sample_ca_truststore.jks \
    -Djavax.net.ssl.trustStorePassword=${BUNDLE_PASSWORD} \
    -Djavax.net.debug=ssl \
    com.rl.sample.jedis.ClusterTLS host port password