WebDB-App / app

Efficient Database IDE
https://webdb.app
GNU Affero General Public License v3.0
175 stars 6 forks source link

connect ECONNREFUSED 127.0.0.1:27017 on MongoDB #43

Closed kilian-v closed 1 month ago

kilian-v commented 1 month ago

Hello, when I try to connect to mongodb it gives me an error, whereas with mongo compass everything works fine.

Screenshot 2024-09-12 at 15 48 44

Here is some logs from mongo.log

{"t":{"$date":"2024-09-12T15:28:03.237+01:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:52345","uuid":{"uuid":{"$uuid":"4a2b8296-b0a1-4957-8e4d-68b6a5929efe"}},"connectionId":782,"connectionCount":25}}
{"t":{"$date":"2024-09-12T15:28:03.238+01:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn781","msg":"client metadata","attr":{"remote":"127.0.0.1:52344","client":"conn781","negotiatedCompressors":[],"doc":{"application":{"name":"MongoDB Compass"},"driver":{"name":"nodejs","version":"6.8.0"},"platform":"Node.js v20.15.1, LE","os":{"name":"darwin","architecture":"arm64","version":"23.6.0","type":"Darwin"}}}}
{"t":{"$date":"2024-09-12T15:28:03.238+01:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn782","msg":"client metadata","attr":{"remote":"127.0.0.1:52345","client":"conn782","negotiatedCompressors":[],"doc":{"application":{"name":"MongoDB Compass"},"driver":{"name":"nodejs","version":"6.8.0"},"platform":"Node.js v20.15.1, LE","os":{"name":"darwin","architecture":"arm64","version":"23.6.0","type":"Darwin"}}}}
{"t":{"$date":"2024-09-12T15:28:03.241+01:00"},"s":"I",  "c":"NETWORK",  "id":6788700, "ctx":"conn781","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":3}}
{"t":{"$date":"2024-09-12T15:28:03.241+01:00"},"s":"I",  "c":"NETWORK",  "id":6788700, "ctx":"conn782","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":3}}
{"t":{"$date":"2024-09-12T15:28:12.358+01:00"},"s":"I",  "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1726151292,"ts_usec":358024,"thread":"583:0x17005b000","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 320, snapshot max: 320 snapshot count: 0, oldest timestamp: (1726150991, 7) , meta checkpoint timestamp: (1726151291, 7) base write gen: 6732989"}}}
{"t":{"$date":"2024-09-12T15:28:13.708+01:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:52351","uuid":{"uuid":{"$uuid":"24b27bf5-f43b-4b26-8ca0-7c1e0572966d"}},"connectionId":783,"connectionCount":26}}
{"t":{"$date":"2024-09-12T15:28:13.709+01:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn783","msg":"client metadata","attr":{"remote":"127.0.0.1:52351","client":"conn783","negotiatedCompressors":[],"doc":{"application":{"name":"MongoDB Compass"},"driver":{"name":"nodejs","version":"6.8.0"},"platform":"Node.js v20.15.1, LE","os":{"name":"darwin","architecture":"arm64","version":"23.6.0","type":"Darwin"}}}}
{"t":{"$date":"2024-09-12T15:29:12.414+01:00"},"s":"I",  "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1726151352,"ts_usec":414579,"thread":"583:0x17005b000","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 332, snapshot max: 332 snapshot count: 0, oldest timestamp: (1726151048, 1) , meta checkpoint timestamp: (1726151348, 1) base write gen: 6732989"}}}
{"t":{"$date":"2024-09-12T15:30:12.524+01:00"},"s":"I",  "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1726151412,"ts_usec":524747,"thread":"583:0x17005b000","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 346, snapshot max: 346 snapshot count: 0, oldest timestamp: (1726151109, 1) , meta checkpoint timestamp: (1726151409, 1) base write gen: 6732989"}}}

{"t":{"$date":"2024-09-12T15:30:41.919+01:00"},"s":"I",  "c":"CONTROL",  "id":20698,   "ctx":"thread1","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2024-09-12T15:30:41.921+01:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2024-09-12T15:30:41.947+01:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":21},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":21},"outgoing":{"minWireVersion":6,"maxWireVersion":21},"isInternalClient":true}}}
{"t":{"$date":"2024-09-12T15:30:41.948+01:00"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2024-09-12T15:30:41.952+01:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2024-09-12T15:30:41.952+01:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2024-09-12T15:30:41.953+01:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2024-09-12T15:30:41.953+01:00"},"s":"I",  "c":"TENANT_M", "id":7091600, "ctx":"thread1","msg":"Starting TenantMigrationAccessBlockerRegistry"}
{"t":{"$date":"2024-09-12T15:30:41.953+01:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":19593,"port":27017,"dbPath":"/opt/homebrew/var/mongodb","architecture":"64-bit","host":"Kilians-MacBook-Pro.local"}}
{"t":{"$date":"2024-09-12T15:30:41.953+01:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"7.0.14","gitVersion":"ce59cfc6a3c5e5c067dca0d30697edd68d4f5188","modules":[],"allocator":"system","environment":{"distarch":"aarch64","target_arch":"aarch64"}}}}
{"t":{"$date":"2024-09-12T15:30:41.953+01:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"23.6.0"}}}
{"t":{"$date":"2024-09-12T15:30:41.953+01:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/opt/homebrew/etc/mongod.conf","net":{"bindIp":"127.0.0.1, ::1","ipv6":true},"replication":{"replSetName":"rs0"},"storage":{"dbPath":"/opt/homebrew/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/opt/homebrew/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2024-09-12T15:30:41.954+01:00"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
{"t":{"$date":"2024-09-12T15:30:41.954+01:00"},"s":"F",  "c":"ASSERT",   "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/asio/asio_transport_layer.cpp","line":1203}}
{"t":{"$date":"2024-09-12T15:30:41.954+01:00"},"s":"F",  "c":"ASSERT",   "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
{"t":{"$date":"2024-09-12T15:31:12.621+01:00"},"s":"I",  "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1726151472,"ts_usec":621102,"thread":"583:0x17005b000","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 360, snapshot max: 360 snapshot count: 0, oldest timestamp: (1726151169, 1) , meta checkpoint timestamp: (1726151469, 1) base write gen: 6732989"}}}
{"t":{"$date":"2024-09-12T15:32:12.672+01:00"},"s":"I",  "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1726151532,"ts_usec":672279,"thread":"583:0x17005b000","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 374, snapshot max: 374 snapshot count: 0, oldest timestamp: (1726151229, 1) , meta checkpoint timestamp: (1726151529, 1) base write gen: 6732989"}}}
aleluff commented 1 month ago

Hello, you connected with no credentials ?

kilian-v commented 1 month ago

Yes, usually I don't need credentials to connect to mongo db.

aleluff commented 1 month ago

What's your setup ? docker-compose ? native ?

Can you give me all the steps to reproduce the bug please

kilian-v commented 1 month ago

I am working on Mac OS, i installd MongoDB with homebrew and WebDB via this command

docker pull webdb/app && \
docker rm -f $(docker ps -a -q --filter ancestor=webdb/app) webdb 2> /dev/null ; \
docker run --name webdb -d \
    --restart=always \
    --add-host="host.docker.internal:host-gateway" \
    -v $HOME/.webdb:/usr/src/app/static/version \

after that i go to the link http://localhost:22071/

it all my databases, psql conection and mysql connection work correctly

aleluff commented 1 month ago

Strange, I just redo everything from scratch and it works perfectly Can you try using docker please https://docs.webdb.app/installation/compose

kilian-v commented 1 month ago

I forgot to precise that i use a replica set

systemLog:
  destination: file
  path: /opt/homebrew/var/log/mongodb/mongo.log
  logAppend: true
storage:
  dbPath: /opt/homebrew/var/mongodb
net:
  bindIp: 127.0.0.1, ::1
  ipv6: true
replication:
   replSetName: rs0

but okay i will try to use docker compose

aleluff commented 1 month ago

I tried with replica and I can't even connect to it through Compas ... Can you give me the uri you use please

kilian-v commented 1 month ago

mongodb://localhost:27017

i think you have to connect into mongosh console and do rs.initiate()

aleluff commented 1 month ago

Oh, after that everything works fine : compass and webdb Try to update WebDB before trying again, I just updated it

Le jeu. 12 sept. 2024 à 19:35, Kilian Vitou @.***> a écrit :

mongodb://localhost:27017

i think you have to connect into mongosh console and do rs.initiate()

— Reply to this email directly, view it on GitHub https://github.com/WebDB-App/app/issues/43#issuecomment-2346871187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ56RYUSLS6ZDINRUOEZU3ZWHGF3AVCNFSM6AAAAABODOQ3S6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBWHA3TCMJYG4 . You are receiving this because you commented.Message ID: @.***>

-- Alexandre Biche

kilian-v commented 1 month ago

Weird i rerun this command to update

 docker pull webdb/app && \
docker rm -f $(docker ps -a -q --filter ancestor=webdb/app) webdb 2> /dev/null ; \
docker run --name webdb -d \
    --restart=always \
    --add-host="host.docker.internal:host-gateway" \
    -v $HOME/.webdb:/usr/src/app/static/version \
    -p 127.0.0.1:22071:22071 webdb/app

but same error How do.i have to install WebDB ?

aleluff commented 1 month ago

You installed it the right way Found it ... Add "directConnection": "true" to params You can remove replicaSet param if you want

kilian-v commented 1 month ago

image

I did the update but the problem persists at my level, I may not have understood what to do.

aleluff commented 1 month ago

With "docker.internal.host" instead of 127.0.0.1

kilian-v commented 1 month ago

image

you mean here don't you ?, or where please

kilian-v commented 1 month ago

Hello finally it worked thank you very much for your help I think I was putting the wrong address "127.0.0.1"/ "docker.internal.host" instead of "host.docker.internal"

aleluff commented 1 month ago

Your welcome =) Don't hesitate to give feedback