§2023-07-26

orgpi5Arch.yushei.net was install with mongodb-5.0.0-1-aarch64.pkg.tar.xz

  1. remove 5.0.0 version
$ sudo pacman -Rns mongodb
[sudo] password for alexlai: 
checking dependencies...

Packages (2) lsb-release-2.0.r48.3cf5103-1  mongodb-5.0.0-1

Total Removed Size:  164.81 MiB

:: Do you want to remove these packages? [Y/n] 
  1. but, these setup is still there
$ grep mongodb /etc/passwd
mongodb:x:960:960::/var/lib/mongodb:/usr/bin/nologin
$ sudo ls /opt/var/lib/mongodb/
mongod.log
  1. Set up mongod-7.0.0-rc8
$ sudo cp -v mongod-7.0.0-rc8 /usr/local/bin/mongod
[sudo] password for alexlai: 
'mongod-7.0.0-rc8' -> '/usr/local/bin/mongod'
[alexlai@orpi5Arch src]$ mongod --version
db version v7.0.0-rc8
Build Info: {
    "version": "7.0.0-rc8",
    "gitVersion": "27da922959c12df48ae2ecf8aad0f37f42f71451",
    "openSSLVersion": "OpenSSL 3.0.8 7 Feb 2023",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distarch": "aarch64",
        "target_arch": "aarch64"
    }
}
  1. /etc/mongodb.conf as,
# mongodb.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: //opt/xfs/mongodb/log/mongod.log

# Where and how to store data.
storage:
  dbPath: /opt/xfs/mongodb/data
  
  # if your MongoDB version is 4.0 or newer, you can safely remove the "storage.journal.enabled" 
  # option from your configuration file.
  # journal:
    # enabled: true
#  engine:
#  wiredTiger:

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

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:
  1. /usr/lib/systemd/system/mongodb.service
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target

[Service]
TimeoutStartSec=infinity
User=mongodb
Group=mongodb
Environment="OPTIONS=-f /etc/mongodb.conf"
Environment="MONGODB_CONFIG_OVERRIDE_NOFORK=1"
ExecStart=/usr/local/bin/mongod $OPTIONS
RuntimeDirectory=mongodb
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings

[Install]
WantedBy=multi-user.target
  1. create
$ sudo touch /var/log/mongod.log
$ sudo chown mongodb:mongodb /var/log/mongod.log 
  1. start
$ sudo systemctl start mongodb
$ sudo systemctl status  mongodb
● mongodb.service - MongoDB Database Server
     Loaded: loaded (/usr/lib/systemd/system/mongodb.service; disabled; preset: disabled)
     Active: active (running) since Wed 2023-07-26 09:40:15 CST; 6s ago
       Docs: https://docs.mongodb.org/manual
   Main PID: 2189 (mongod)
     Memory: 80.4M
        CPU: 1.142s
     CGroup: /system.slice/mongodb.service
             └─2189 /usr/local/bin/mongod -f /etc/mongodb.conf

 7月 26 09:40:15 orpi5Arch systemd[1]: Started MongoDB Database Server.
 7月 26 09:40:15 orpi5Arch mongod[2189]: {"t":{"$date":"2023-07-26T01:40:15.644Z"},"s":"I",  "c":"CONTROL",  "id":7484500, "ctx":"main","msg":"Environment variable MONGODB_CONFIG_OVER>

$ sudo systemctl enable   mongodb
Created symlink /etc/systemd/system/multi-user.target.wants/mongodb.service → /usr/lib/systemd/system/mongodb.service.