本机,连接远程redis
iptables关了。
client ping serer OK。
server本地操作ok。
本地操作ok。
====== SET ======
`10000 requests completed in 0.11 seconds
50 parallel clients
3 bytes payload
keep alive: 1
100.00% <= 0 milliseconds
93457.95 requests per second`
====== GET ======
`10000 requests completed in 0.11 seconds
50 parallel clients 3 bytes payload
keep alive: 1
100.00% <= 0 milliseconds
94339.62 requests per second `
`jedis = new Jedis(host, port);
retStr = jedis.set("test123", "lulu"); `
`redis.clients.jedis.exceptions.JedisConnectionException: java.net
.ConnectException: Connection refused: connect `
请问是什么原因?
试试:
String redisAddress = "127.0.0.1";
int redisPort = 6379;
int redisTimeout = 2000;
JedisPool pool = new JedisPool(new JedisPoolConfig(), RedisAddress, RedisPort, RedisTimeout);
Jedis jedis = pool.getResource();
jedis.set("test123", "lulu");
pool.returnResource(jedis);
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。