启动服务时,redisson客户端连不上virtualbox虚拟机上的redis ?

虚拟机使用的Virtual box 的NAT模式

代码配置
图片.png

idea中的报错

org.redisson.client.RedisConnectionException: MasterConnectionPool no available Redis entries.  Disconnected hosts: [/10.200.67.168:6379]
    at org.redisson.connection.pool.ConnectionPool.get(ConnectionPool.java:195) ~[redisson-2.7.0.jar:na]
    at org.redisson.connection.pool.MasterConnectionPool.get(MasterConnectionPool.java:31) ~[redisson-2.7.0.jar:na]
    at org.redisson.connection.MasterSlaveEntry.connectionWriteOp(MasterSlaveEntry.java:392) ~[redisson-2.7.0.jar:na]
    at org.redisson.connection.MasterSlaveConnectionManager.connectionWriteOp(MasterSlaveConnectionManager.java:675) ~[redisson-2.7.0.jar:na]
    at org.redisson.command.CommandAsyncService.async(CommandAsyncService.java:489) ~[redisson-2.7.0.jar:na]
    at org.redisson.command.CommandAsyncService$7.run(CommandAsyncService.java:538) ~[redisson-2.7.0.jar:na]
    at io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
    at io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
    at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
    at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
    at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]

windows的ip:
图片.png

虚拟机的ip:
图片.png

接口转发:
图片.png

阅读 3.1k
1 个回答

看看redis监听的地址是什么,可能要改成0.0.0.0或者10.0.2.15这个地址。
redis.conf

bind 0.0.0.0
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏