|
@@ -10,11 +10,6 @@ import org.springframework.context.annotation.Configuration;
|
|
@Configuration
|
|
@Configuration
|
|
public class RedissonConfig {
|
|
public class RedissonConfig {
|
|
|
|
|
|
- @Value("${spring.data.redis.host:localhost}")
|
|
|
|
- private String host;
|
|
|
|
-
|
|
|
|
- @Value("${spring.data.redis.port:6379}")
|
|
|
|
- private String port;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 对 Redisson 的使用都是通过 RedissonClient 对象
|
|
* 对 Redisson 的使用都是通过 RedissonClient 对象
|
|
@@ -28,6 +23,8 @@ public class RedissonConfig {
|
|
// 2、集群模式
|
|
// 2、集群模式
|
|
// config.useClusterServers().addNodeAddress("192.168.36.128:7004", "192.168.36.128:7001");
|
|
// config.useClusterServers().addNodeAddress("192.168.36.128:7004", "192.168.36.128:7001");
|
|
// 根据 Config 创建出 RedissonClient 示例
|
|
// 根据 Config 创建出 RedissonClient 示例
|
|
|
|
+ String host = "192.168.36.128";
|
|
|
|
+ String port = "26739";
|
|
config.useSingleServer()
|
|
config.useSingleServer()
|
|
.setAddress(String.format("redis://%s:%s", host, port))
|
|
.setAddress(String.format("redis://%s:%s", host, port))
|
|
.setPassword("ZiFiE3JkwCN5S5FF")
|
|
.setPassword("ZiFiE3JkwCN5S5FF")
|