Question

How To connect Digitalocean droplet mongodb server from spring boot project.

Hi, Please Read my Question explanation, 2 days back i asked a question about my spring boot+mongodb project deploye problem, i can’t connect remotly with mongodb server that i installed digitalocean droplet.

https://www.digitalocean.com/community/questions/how-to-deploy-spring-boot-project-with-mongodb-database-in-digitalocean-2

then i follow the answer. then i stuck with another problem:

i logged into by ssh root@206.189.1@8.1@@ i run command sudo ufw status it shows

Status: active

To Action From

OpenSSH ALLOW Anywhere

27017 ALLOW *206.189.1@8.1@@ *

OpenSSH (v6) ALLOW Anywhere (v6)

then i edit mongod.conf by sudo nano /etc/mongod.conf output:

. . .
# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1,**206.189.1@8.1@@**

. . .

after that, when i run this nc -zv **206.189.1@8.1@@ ** 27017 it says:

it says nc: connect to 206.189.1@8.1@@ port 27017 (tcp) failed: Connection refused

but when i run this nc -zv **127.0.0.1@@ ** 27017

it says Connection to 127.0.0.1 27017 port [tcp/*] succeeded!

i run my spring boot project in ntellij idea

spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=MultiVendor

it gives this error here

*please note *that, i start my mongo server in local pc, when run project, local mongo server stop autometically and project through an error in console.

may be local mongodb server and droplet mongo server conflict.

please help me, i stucked last few days.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer