添加依赖
redis.clients
jedis
5.1.2
然后通过
JedisPool pool = new JedisPool(host3, 6379);
Jedis jedis = pool.getResource();
jedis.auth("username","password");
jedis.set("ab","ab");
System.out.println(jedis.get("ab"));
即可链接成功,成功操作阿里云redis
原文链接:https://redis.io/docs/latest/develop/connect/clients/java/jedis/