曾记星光闪耀时
2018-07-05 18:49
Jedis jedis = new Jedis("",6379);这个成功 Jedis jedis = new Jedis("本机ip",6379);连接失败redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
第一个连接的是localhost本地回环,第二个是TCP/IP协议连接。
初始化:new Jedis(host, port)->new BinaryJedis(host, port)->new Client(host, port)->new BinaryClient(host, port)->new Connection(host, port),其中Connection参数默认如下
```java
private static final byte[][] EMPTY_ARGS = new byte[0][]; private String host = "localhost"; private int port = 6379; private Socket socket; private RedisOutputStream outputStream; private RedisInputStream inputStream; private int pipelinedCommands = 0; private int connectionTimeout = 2000; private int soTimeout = 2000; private boolean broken = false; private boolean ssl; private SSLSocketFactory sslSocketFactory; private SSLParameters sslParameters; private HostnameVerifier hostnameVerifier;
```
Redis入门
107131 学习 · 154 问题
相似问题
回答 2