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

Posted May 24, 2021 315 views

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.

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

. . .
# network interfaces
  port: 27017

. . .

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 ** ** 27017

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

i run my spring boot project in ntellij idea

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

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