The mongo shell that I started while I was remoteing Powershell ends quickly.

Asked 2 years ago, Updated 2 years ago, 124 views

I'm a beginner at Mongodb.
If you start the mongo shell on the powershell of the window server (2016 Standard) where Mongodb is installed, you can use it without any problems as follows.

PSC:\Users\Administrator>mongo
MongoDB shell version v4.0.11
connecting to:mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session {"id": UUID("292078ce-619a-496c-aa8e-cd898b40e75c")}
MongoDB server version: 4.0.11
Server has startup warnings:
2020-02-18 T17:15:22.645 + 0900 I CONTROL [initandlisten]
2020-02-18 T17:15:22.645+0900 I CONTROL [initandlisten]** WARNING: Access control is not enabled for the database.
2020-02-18 T17:15:22.645+0900 I CONTROL [initandlisten]** Read and write access to data and configuration is unlimited.
2020-02-18 T17:15:22.645 + 0900 I CONTROL [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc.).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with.MongoDB may use this information to make product
improvements and to Suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring() 
---

A warning is displayed, but shell is available successfully.

However, if you try to start the mongo shell after connecting to this server from another PC (windows10 enterprise) remotely via powershell...

[xxx.xxx.xx.xx]:PSC:\Users\Administrator\Documents>mongo
MongoDB shell version v4.0.11 
connecting to:mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session {"id": UUID("30e82d49-14af-462f-8b26-404c25ddefc6")}
MongoDB server version: 4.0.11
bye

This is how it ends as soon as it starts.
Where is the problem?

powershell mongodb

2022-09-30 19:28

1 Answers

The IP address 127.0.0.1 is a special IP address called the local loopback address, which means the machine it is accessing (called loopback because it returns data without going out to the network).
If you access 127.0.0.1:27017 on the window server where Mongodb is installed, Mongodb will reply because port 27017 is accessed on that Windows server.

If you access the same 127.0.0.1:27017 on a Windows 10 PC, you will access port 27017 on the Windows 10 PC, but the Windows 10 PC does not run Mongodb, so there is no response from Mongodb.

If you access port 27017 Mongodb of the IP address of Windows Server from your Windows 10 PC, you will get a proper response.


2022-09-30 19:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.