云数据库 GAUSSDB NOSQL-通过Redisson连接实例:使用SingleServer模式连接实例

时间:2023-11-10 12:13:53

使用SingleServer模式连接实例

样例代码

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;

public class SingleServerTests {

  private static void testSingleServer() {
    Config config = new Config();
    config.useSingleServer().setAddress("redis://172.xx.xx.xx:8635")
                            .setPassword(password);
    RedissonClient redisson = Redisson.create(config);
    execute(redisson);   // send requests to database
    redisson.shutdown();
  }

  public static void main(String[] args) {
    testSingleServer();
  }
}
support.huaweicloud.com/productdesc-nosql/nosql_11_0202.html