简体   繁体   中英

Cannot establish connection by Jedis

我使用Jedis,我想建立与Redis服务器的连接,该服务器与运行我的应用程序的服务器不同...即Redis在服务器X上,而我的应用程序在服务器Y上。如何建立连接?

Try with this:

Jedis jedis = new Jedis("23.27.123.100",6379);

Have you tried specifying the IP address when you instantiate Jedis as follows:

Example (replace with actual ip address)

Jedis jedis = new Jedis(IP address);

like this

Jedis jedis = new Jedis(23.27.123.100);

Also, is redis listening on 6379 or some other port? Are firewall/ip tables settings in place to avoid a connection attempt on that port from being blocked? Can you share more details about what happens when you try to connect to the remote host.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM