Lab: Change the Default DB Path issues with connecting to port 27000

Having a tough time with this one.

I started by using this command:

mkdir -p /var/mongodb/db

Then I make sure everything matches

storage:
dbPath: /var/mongodb/db
net:
bindIp: localhost
port: 27000
security:
authorization: enabled

Then I use this command

mongod --config mongod.conf

And this is what I get…

2022-08-24T09:17:59.854+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] MongoDB starting : pid=435 port=27000 dbpath=/var/mongodb/db 64-bit host=TF04Vc4VhAJQ92ZdOk
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] db version v4.0.5
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] allocator: system
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] modules: none
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] build environment:
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten]     distarch: x86_64
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2022-08-24T09:17:59.861+0000 I CONTROL  [initandlisten] options: { config: "mongod.conf", net: { bindIp: "localhost", port: 27000 }, security: { authorization: "enabled" }, storage: { dbPath: "/var/mongodb/db" } }
2022-08-24T09:17:59.861+0000 I STORAGE  [initandlisten] Detected data files in /var/mongodb/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2022-08-24T09:17:59.884+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2022-08-24T09:18:01.239+0000 I STORAGE  [initandlisten] WiredTiger message [1661332681:239675][435:0x7f65b4ceaca8], txn-recover: Main recovery loop: starting at 3/5888 to 4/256
2022-08-24T09:18:01.631+0000 I STORAGE  [initandlisten] WiredTiger message [1661332681:631486][435:0x7f65b4ceaca8], txn-recover: Recovering log 3 through 4
2022-08-24T09:18:01.828+0000 I STORAGE  [initandlisten] WiredTiger message [1661332681:828224][435:0x7f65b4ceaca8], txn-recover: Recovering log 4 through 4
2022-08-24T09:18:02.023+0000 I STORAGE  [initandlisten] WiredTiger message [1661332682:23894][435:0x7f65b4ceaca8], txn-recover: Set global recovery timestamp: 0
2022-08-24T09:18:02.099+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2022-08-24T09:18:02.111+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2022-08-24T09:18:02.111+0000 I CONTROL  [initandlisten] 
2022-08-24T09:18:02.132+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/var/mongodb/db/diagnostic.data'
2022-08-24T09:18:02.133+0000 I NETWORK  [initandlisten] waiting for connections on port 27000
^C2022-08-24T09:19:14.760+0000 I CONTROL  [signalProcessingThread] got signal 2 (Interrupt), will terminate after current cmd ends
2022-08-24T09:19:14.760+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2022-08-24T09:19:14.760+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27000.sock
2022-08-24T09:19:14.760+0000 I CONTROL  [signalProcessingThread] Shutting down free monitoring
2022-08-24T09:19:14.760+0000 I FTDC     [signalProcessingThread] Shutting down full-time diagnostic data capture
2022-08-24T09:19:14.762+0000 I STORAGE  [signalProcessingThread] WiredTigerKVEngine shutting down
2022-08-24T09:19:14.784+0000 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2022-08-24T09:19:14.784+0000 I CONTROL  [signalProcessingThread] now exiting
2022-08-24T09:19:14.784+0000 I CONTROL  [signalProcessingThread] shutting down with code:0

I have no idea how to continue. I’ve spent like an hour on this.

Are you trying this in IDE or your local machine?
mongod actually came up but kill signal received
May be the session where you started was closed
If your mongod is running in foreground you have to keep the session/terminal open
If you CTL+c it gets killed
To avoid this run your mongod in background using fork on Unix systems

1 Like

Hi @Dagger and welcome to the MongoDB community forums.

As Ramachandra states, the process was up and running for a minute or so before it was stopped by <CTRL+C>.

You have two options:

  1. Run as you have done so above, and once you see the Waiting for connections on port 27000 message, open another terminal window and use mongosh --port 27000 to connect to the database server.
  2. Add the processManagement.fork and the systemLog.path options to the config file. This will start the process up in the background and allow you to use your current terminal window.

THANK YOU AND @Ramachandra_Tummala SO SO SO MUCH I LITERALLY SPENT AN HOUR YESTERDAY TRYING TO FIGURE THIS OUT BUT I WAS MISSING INFORMATION. I JUST ADDED IT AND NOW IT WORKS THANK YOU!!!