§2024-05-25

  1. Download mongoDB community version
$ wget https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/7.0/multiverse/binary-arm64/mongodb-org-server_7.0.11_arm64.deb

$ sudo dpkg -i mongodb-org-server_7.0.11_arm64.deb
  1. replace mongod with http://munetaka.me:42101/user/alexlai/files/JupyterHub/Computer/MongoDB/Binary/aarch64-r7.0.0-rc8/mongod-aarch64-7.0.0-rc8-MnJaroN2?_xsrf=2%7C85836a23%7Cce45cccd3ab2f031f87b90798f7dbeb8%7C1715296567
alexlai@opi58G:~/Downloads$ ./mongod-aarch64-7.0.0-rc8-MnJaroN2 --version
db version v7.0.0-rc8
Build Info: {
    "version": "7.0.0-rc8",
    "gitVersion": "27da922959c12df48ae2ecf8aad0f37f42f71451",
    "openSSLVersion": "OpenSSL 3.0.11 19 Sep 2023",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distarch": "aarch64",
        "target_arch": "aarch64"
    }
}

$ sudo mv -v /usr/bin/mongod /usr/bin/mongod.backuo
$ sudo cp -v mongod-aarch64-7.0.0-rc8-MnJaroN2 /usr/bin/mongod
$ sudo chmod a+x /usr/bin/mongod
$ sudo systemctl retart mongod 

alexlai@n2Bookworm:~$ systemctl status mongod
● mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; disabled; preset: enabled)
     Active: active (running) since Tue 2024-05-28 13:47:15 CST; 11min ago
       Docs: https://docs.mongodb.org/manual
   Main PID: 6959 (mongod)
     Memory: 148.6M
        CPU: 5.197s
     CGroup: /system.slice/mongod.service
             └─6959 /usr/bin/mongod --config /etc/mongod.conf

Download ans Install mongosh

$ wget https://downloads.mongodb.com/compass/mongodb-mongosh_2.2.6_arm64.deb
$ sudo dpkg -i mongodb-mongosh_2.2.6_arm64.deb
$ sudo dpkg -L mongodb-mongosh_2.2.6_arm64.deb
alexlai@n2Bookworm:~/build/mongoDB/binary$ mongosh --version
2.2.6
alexlai@n2Bookworm:~/build/mongoDB/binary$ mongosh 
Current Mongosh Log ID:	6655754d10931ebe008db5fa
Connecting to:		mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.6
Using MongoDB:		7.0.0-rc8
Using Mongosh:		2.2.6

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

------
   The server generated these startup warnings when booting
   2024-05-28T13:47:16.475+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2024-05-28T13:47:16.476+08:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
   2024-05-28T13:47:16.476+08:00: vm.max_map_count is too low
------

test> 

mongodb atlas ???

$ wget https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.23.0_linux_arm64.deb
$ sudo dpkg -i mongodb-atlas-cli_1.23.0_linux_arm64.deb
$ dpkg -L mongodb-atlas-cli 
/etc
/etc/atlascli
/etc/atlascli/installer
/usr
/usr/bin
/usr/bin/atlas

¶[mongoDB database tools](https://www.mongodb.com/try/download/database-tools

$ wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-arm64-100.9.4.deb

alexlai@n2Bookworm:~/build/mongoDB/binary$ sudo dpkg -i mongodb-database-tools-ubuntu2204-arm64-100.9.4.deb 
Selecting previously unselected package mongodb-database-tools.
(Reading database ... 152942 files and directories currently installed.)
Preparing to unpack mongodb-database-tools-ubuntu2204-arm64-100.9.4.deb ...
Unpacking mongodb-database-tools (100.9.4) ...
Setting up mongodb-database-tools (100.9.4) ...
alexlai@n2Bookworm:~/build/mongoDB/binary$ sudo dpkg -L  mongodb-database-tools
/.
/usr
/usr/bin
/usr/bin/bsondump
/usr/bin/mongodump
/usr/bin/mongoexport
/usr/bin/mongofiles
/usr/bin/mongoimport
/usr/bin/mongorestore
/usr/bin/mongostat
/usr/bin/mongotop
/usr/share
/usr/share/doc
/usr/share/doc/mongodb-database-tools
/usr/share/doc/mongodb-database-tools/LICENSE.md
/usr/share/doc/mongodb-database-tools/README.md
/usr/share/doc/mongodb-database-tools/THIRD-PARTY-NOTICES

¶ /etc/mongod.conf.backup

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
#  engine:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

¶ Fine tune, no security Yes,

alexlai@n2Bookworm:~$ mongosh
Current Mongosh Log ID: 6655ad2bab340abc4c8db5fa
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.6
Using MongoDB:          7.0.0-rc8
Using Mongosh:          2.2.6

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

------
   The server generated these startup warnings when booting
   2024-05-28T18:08:40.440+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2024-05-28T18:08:40.441+08:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
   2024-05-28T18:08:40.441+08:00: vm.max_map_count is too low
------

test> 

¶ Fine Tune `/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'

[Unit]
Description=Disable Transparent Huge Pages

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'
ExecStart=/bin/sh -c 'echo never > /sys/kernel/mm/transparent_hugepage/defrag'
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

Then,

$ sudo systemctl start disable-thp
$ sudo systemctl restart mongod
alexlai@n2Bookworm:~$ mongosh
Current Mongosh Log ID: 6655b0542bdbb5a1a28db5fa
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.6
Using MongoDB:          7.0.0-rc8
Using Mongosh:          2.2.6

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

------
   The server generated these startup warnings when booting
   2024-05-28T18:22:11.775+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2024-05-28T18:22:11.775+08:00: vm.max_map_count is too low
------

$ sudo systemctl enable disable-thp

¶ vm.max_map_count is too low

Add the following line to set the vm.max_map_count value permanently:

sudo nano /etc/sysctl.conf


¶ Before turn on security add

db.createUser( {
user: "siteRootAdmin",
pwd: "b23258585",
roles: [ { role: "root", db: "admin" } ]
});
alexlai@n2Bookworm:~$ mongosh
Current Mongosh Log ID: 6655b2a4672499c9b68db5fa
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.6
Using MongoDB:          7.0.0-rc8
Using Mongosh:          2.2.6

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

------
   The server generated these startup warnings when booting
   2024-05-28T18:31:56.773+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
------

test> use admin
switched to db admin
admin> db.createUser( {
... user: "siteRootAdmin",
... pwd: "b23258585",
... roles: [ { role: "root", db: "admin" } ]
... });
{ ok: 1 }
admin> 

¶ turn on security

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
#  engine:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

security:
  authorization: "enabled"

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

suspend I fixed it by editing /etc/gdm3/greeter.dconf-defaults, uncommenting the line, changing suspend to blank: sleep-inactiva-ac-type="nothing" --> seems not working

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target and reboot


¶ - install mongosh

$ wget https://downloads.mongodb.com/compass/mongodb-mongosh_2.2.6_arm64.deb
$ sudo dpkg -i mongodb-mongosh_2.2.6_arm64.deb

¶join replSetName: "odroid01"

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb/
  #journal:
    #enabled: true

#  engine:  wiredTiger
#  mmapv1:
#  wiredTiger:

# how the process runs
# processManagement:
#  fork: true  # fork and run in background
#  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile

# network interfaces
net:
  port: 27017
  # bindIp: ysubutun.chingyen.com.tw
  bindIpAll: true   # default is Flase, and mutual exclusive with bindIP.
  # ssl param is inside net:
  # ssl:

# security
security:
  # authorization: enabled
  keyFile: /home/mongoDbKey/odroid01-keyfile
  # clusterAuthMode: x509

#operationProfiling:


#replicationSet
replication:
  replSetName: "odroid01"

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp: