§2023-07-24

$ ./mongosh --version
1.10.1
[alexlai@orpi5Arch bin]$ mongosh
Current Mongosh Log ID: 64c08abb5692f47d7a4000a0
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.10.1
Using MongoDB:          7.0.0-rc8
Using Mongosh:          1.10.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting
   2023-07-26T10:53:09.344+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2023-07-26T10:53:09.344+08:00: vm.max_map_count is too low
------

Error while running ~/.mongoshrc.js:
MongoServerError: Authentication failed.
test> 


  1. First time started up
$ mongosh 
Current Mongosh Log ID: 64bdfebc1ab500d88f1346d7
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.10.1
Using MongoDB:          7.0.0-rc8
Using Mongosh:          1.10.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting
   2023-07-24T11:11:16.323+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2023-07-24T11:11:16.324+08:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
   2023-07-24T11:11:16.324+08:00: vm.max_map_count is too low
------

test> 

  1. `[/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never(https://www.mongodb.com/docs/manual/tutorial/transparent-huge-pages/#create-t/etc/systemd/system/disable-transparent-huge-pages.servicehe-systemd-unit-file)'
[Unit]
Description=Disable Transparent Huge Pages (THP)
DefaultDependencies=no
After=sysinit.target local-fs.target
# ubuntu use mongod.service while arch use mongodb.service
Before=mongodb.service

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/enabled > /dev/null'

[Install]
WantedBy=basic.target
  1. retry
# sudo systemctl daemon-reload
root@hc4Jammy:/home/alexlai/build/mongo/build/install/bin# sudo systemctl stop mongodb
root@hc4Jammy:/home/alexlai/build/mongo/build/install/bin# systemctl start disable-transparent-huge-pages.service
root@hc4Jammy:/home/alexlai/build/mongo/build/install/bin# systemctl status  disable-transparent-huge-pages.service
○ disable-transparent-huge-pages.service - Disable Transparent Huge Pages (THP)
     Loaded: loaded (/etc/systemd/system/disable-transparent-huge-pages.service; disabled; vendor preset: enabled)
     Active: inactive (dead)

Jul 24 12:50:33 hc4Jammy systemd[1]: Starting Disable Transparent Huge Pages (THP)...
Jul 24 12:50:33 hc4Jammy systemd[1]: disable-transparent-huge-pages.service: Deactivated successfully.
Jul 24 12:50:33 hc4Jammy systemd[1]: Finished Disable Transparent Huge Pages (THP).
root@hc4Jammy:/home/alexlai/build/mongo/build/install/bin# systemctl start mongodb.service
root@hc4Jammy:/home/alexlai/build/mongo/build/install/bin# systemctl status mongodb.service
● mongodb.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongodb.service; disabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-07-24 12:51:03 CST; 5s ago
       Docs: https://docs.mongodb.org/manual
   Main PID: 2081 (mongod)
     Memory: 169.9M
        CPU: 2.715s
     CGroup: /system.slice/mongodb.service
             └─2081 /usr/local/bin/mongod -f /etc/mongodb.conf

Jul 24 12:51:03 hc4Jammy systemd[1]: Started MongoDB Database Server.
Jul 24 12:51:03 hc4Jammy mongod[2081]: {"t":{"$date":"2023-07-24T04:51:03.942Z"},"s":"I",  "c":"CONTROL",  "id":7484500, "ctx":"main","msg":"Environment variable MONGODB_CONFIG_OVERRIDE_NOFORK == 1, overriding \"processManagement.fork\" to false"}
root@hc4Jammy:/home/alexlai/build/mongo/build/install/bin# 
  1. try `mongosh
$ mongosh
Current Mongosh Log ID: 64be03831f8559897ecafba9
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.10.1
Using MongoDB:          7.0.0-rc8
Using Mongosh:          1.10.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting
   2023-07-24T12:51:06.530+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2023-07-24T12:51:06.530+08:00: vm.max_map_count is too low
------

test> 
  1. set vm.max_map_count = 128000
  1. recheck
$ mongosh
Current Mongosh Log ID: 64be0760cac168ff22c93676
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.10.1
Using MongoDB:          7.0.0-rc8
Using Mongosh:          1.10.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting
   2023-07-24T13:05:58.690+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
------

test>