为什么我在不写jedis的host就能运行成功,反而一加自己本机ip就连接不上了
Jedis jedis = new Jedis("",6379);这个成功 Jedis jedis = new Jedis("本机ip",6379);连接失败redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
Jedis jedis = new Jedis("",6379);这个成功 Jedis jedis = new Jedis("本机ip",6379);连接失败redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
2018-07-05
第一个连接的是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;
```
举报