klov icon indicating copy to clipboard operation
klov copied to clipboard

Not connecting to local mongo db

Open bhiwagade-rahul opened this issue 4 years ago • 9 comments

After docker-compose up command, I am getting this error

Exception in monitor thread while connecting to server localhost:27017 klov | com.mongodb.MongoSocketOpenException: Exception opening socket klov | at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) klov | at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128)

I checked /usr/local/var/log/mongodb/mongo.log and mongo server I don't see any connection request. Can you please tell me what I am doing wrong?

Mac - Catalina 10.15.6 mongo - [email protected]

bhiwagade-rahul avatar Aug 26 '20 10:08 bhiwagade-rahul

docker-compose file

version: '2' services: klov: image: anshooarora/klov:1.0.1 container_name: klov environment: - SPRING_DATA_MONGODB_URI=mongodb://127.0.0.1:27017 ports: - 80:80

bhiwagade-rahul avatar Aug 26 '20 10:08 bhiwagade-rahul

I got a similar problem on MacOS. My workaround : fix docker-compose file: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 Hope it can help you.

chipheolm avatar Oct 20 '20 04:10 chipheolm

@chipheolm ur code worked, thank you so much, i made mistake not providing "host.docker.internal", provided as localhost and finally its working, extremely happy- thank you for the help bro 👍

Naga911 avatar Oct 21 '20 07:10 Naga911

i was facing problem , klov page was displaying blank, i changed in my docker file as "host.docker.internal", and to my surprise it worked :D . thanks a ton

akiladevraj avatar Feb 03 '21 10:02 akiladevraj

Hi @anshooarora,

I tried the above approach but still while running the docker-compose file I am getting issue as below : -

`host.docker.internal:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Exception in monitor thread while connecting to server host.docker.internal:27017

com.mongodb.MongoSocketOpenException: Exception opening socket

at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)

at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128)

at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.net.ConnectException: Connection refused (Connection refused)

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64)

at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79)

at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65)

... 3 common frames omitted`

Can you please help me out.

Also need to ask if we need to download mongodb seperately or will your docker compose yml will take care of that ?

Docker Compose YML as : -

version: '2' services: klov: image: anshooarora/klov:1.0.1 container_name: klov environment: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 ports: - 80:80

Kislaya1 avatar Dec 17 '21 10:12 Kislaya1

Had tried with below Docker Compose File as well as thought to install mongodb seperately, but no luck with that. Same error log , @anshooarora can please help me.

version: '2' services: db: image: mongo:3.2.0 container_name: mongo-db3 environment: - PUID=1000 - PGID=1000 ports: - "27017:27017" restart: on-failure

klov: image: anshooarora/klov:1.0.1 container_name: klov expose: - "80" ports: - "80:80" depends_on: - db environment: - SPRING_DATA_MONGODB_URI=mongodb://mongo-db3:27017

Kislaya1 avatar Dec 17 '21 10:12 Kislaya1

hi

  1. u need to download mongodb separately 2.yml/.yaml file takes image from dockerhub and checks for connection between klov and mongodb

version: '2'

services: klov: image: anshooarora/klov:1.0.1 container_name: klov environment: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 ports: - 85:80

Regards, Nagaraj

On Fri, Dec 17, 2021 at 3:39 PM Kislaya Pant @.***> wrote:

Had tried with below Docker Compose File as well, but no luck with that. @anshooarora https://github.com/anshooarora can please help me.

version: '2' services: db: image: mongo:3.2.0 container_name: mongo-db3 environment:

  • PUID=1000
  • PGID=1000 ports:
  • "27017:27017" restart: on-failure

klov: image: anshooarora/klov:1.0.1 container_name: klov expose:

  • "80" ports:
  • "80:80" depends_on:
  • db environment:
  • SPRING_DATA_MONGODB_URI=mongodb://mongo-db3:27017

— Reply to this email directly, view it on GitHub https://github.com/extent-framework/klov/issues/66#issuecomment-996594017, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK2UZRJ3BO6KRO67WRNHN3URMD6LANCNFSM4QLV5QAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Naga911 avatar Dec 17 '21 10:12 Naga911

hi 1. u need to download mongodb separately 2.yml/.yaml file takes image from dockerhub and checks for connection between klov and mongodb version: '2' services: klov: image: anshooarora/klov:1.0.1 container_name: klov environment: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 ports: - 85:80 Regards, Nagaraj On Fri, Dec 17, 2021 at 3:39 PM Kislaya Pant @.> wrote: Had tried with below Docker Compose File as well, but no luck with that. @anshooarora https://github.com/anshooarora can please help me. version: '2' services: db: image: mongo:3.2.0 container_name: mongo-db3 environment: - PUID=1000 - PGID=1000 ports: - "27017:27017" restart: on-failure klov: image: anshooarora/klov:1.0.1 container_name: klov expose: - "80" ports: - "80:80" depends_on: - db environment: - SPRING_DATA_MONGODB_URI=mongodb://mongo-db3:27017 — Reply to this email directly, view it on GitHub <#66 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK2UZRJ3BO6KRO67WRNHN3URMD6LANCNFSM4QLV5QAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.>

Hi Nagaraj

I had tried to use docker-compose yml file and tried to in-cooperate both mongo db and Klov server there. But was facing same issue again. Can you please help me here ?

My Docker Compose YML file

version: '2' services: mymongo: image: mongo:3.2.0 volumes: - ./_data:/data/db ports: - "27017:27017" restart: on-failure

klov: image: anshooarora/klov:1.0.1 container_name: klov depends_on: - mymongo environment: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 ports: - 80:80

Can you please help me.

Thanks Kislaya

Kislaya1 avatar Dec 17 '21 11:12 Kislaya1

hi 1. u need to download mongodb separately 2.yml/.yaml file takes image from dockerhub and checks for connection between klov and mongodb version: '2' services: klov: image: anshooarora/klov:1.0.1 container_name: klov environment: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 ports: - 85:80 Regards, Nagaraj On Fri, Dec 17, 2021 at 3:39 PM Kislaya Pant @.> wrote: Had tried with below Docker Compose File as well, but no luck with that. @anshooarora https://github.com/anshooarora can please help me. version: '2' services: db: image: mongo:3.2.0 container_name: mongo-db3 environment: - PUID=1000 - PGID=1000 ports: - "27017:27017" restart: on-failure klov: image: anshooarora/klov:1.0.1 container_name: klov expose: - "80" ports: - "80:80" depends_on: - db environment: - SPRING_DATA_MONGODB_URI=mongodb://mongo-db3:27017 — Reply to this email directly, view it on GitHub <#66 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK2UZRJ3BO6KRO67WRNHN3URMD6LANCNFSM4QLV5QAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: _@**.**_>

Hi Nagaraj

I had tried to use docker-compose yml file and tried to in-cooperate both mongo db and Klov server there. But was facing same issue again. Can you please help me here ?

My Docker Compose YML file

version: '2' services: mymongo: image: mongo:3.2.0 volumes: - ./_data:/data/db ports: - "27017:27017" restart: on-failure

klov: image: anshooarora/klov:1.0.1 container_name: klov depends_on: - mymongo environment: - SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017 ports: - 80:80

Can you please help me.

Thanks Kislaya

Hi Kislaya1! I would really appreciate if you could tell how you solved this problem.

RomanRD avatar Aug 13 '23 21:08 RomanRD