[英]Jedis connection refused
I'm trying to connect to my virtual machine Redis 我正在尝试连接到我的虚拟机Redis
package nosql;
import redis.clients.jedis.Jedis;
public class NoSQL {
public static void main(String[] args) {
//I try port: ("127.0.0.1",6379)
Jedis jedis = new Jedis("127.0.0.1",60448);
if(jedis.isConnected())
System.out.println("connected");
jedis.ping();
jedis.set("key1", "value1");
System.out.println(jedis.get("key1"));
}
}
My Redis configuration: 我的Redis配置:
I have already put the virtual machine in bridge mode (I do not know if there has). 我已经将虚拟机设置为桥接模式(我不知道是否有)。
I am researching the hours and not getting answers. 我正在研究时间,但没有得到答案。
Does anyone know what the error? 有人知道错误吗?
只需在主redis文件夹中运行服务器“ redis-server”,然后运行上述程序即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.