在Ubuntu14.04安装Redis后,主机连接虚拟机上的Redis时,报异常
redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused。但是在虚拟机里面,用redis-cli命令连接redis-server是没问题的。最后发现需要修改redis.conf才能连接,修改如下。

# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1

必须注释掉“bind 127.0.0.1”,否则只能在本机上连接Redis,远端不能连接Redis