Spring Data Redis unable to connect to VirtualBox Ubuntu Redis Server

一曲冷凌霜 提交于 2021-01-29 16:02:03

问题


I'm currently attempting to follow a pretty simplistic tutorial from Spring Guides. Hopefully, because of its simplistic nature, it will be very easy to resolve.

Goal

Currently, I've completed the whole tutorial. I was having issues installing Redis on my windows machine, so I went ahead and installed VirtualBox to attempt to create a ubuntu server with Redis on it. I was hoping to have my project just connect to the Redis server running on the VirtualMachine. So far, I've set up the Ubuntu operating system and installed Redis.

Problem

When I attempt to run my program, I get these error messages. I attempted to discover what IP my VirtualBox would be using by typing ipconfig into my command prompt.

   Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::a508:43f6:67cf:a588%42
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

I thought that 192.168.56.1 would be the IP I needed. And when running the Redis server, it showed me that the port it was running on was 6379.

So, inside of my application.properties file, I added these lines:

spring.redis.host=192.168.56.1
spring.redis.port=6379

And yet the same errors occurred.

I read a StackOverflow answer suggesting that the redis.conf file by default didn't allow any connections except from local host. It recommended that I should comment out the bound: 127.0.0.1 to enable connections from anywhere. I did so (even changing it to 0.0.0.0 as well) with no luck.

Question

I am wanting to know how I would successfully setup a connection between my host windows computer and my Ubuntu Redis VirtualMachine. Any help is greatly appreciated!

来源:https://stackoverflow.com/questions/61589940/spring-data-redis-unable-to-connect-to-virtualbox-ubuntu-redis-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!