Important files #
/var/db/mongodb/mongod.log
/usr/local/share/java/unifi/data/system.properties
/usr/local/etc/mongodb.conf
/usr/local/share/java/unifi/logs/server.log
Update mongodb36 to mongodb44 #
You will notice that this is necessary when you get this error message in
/var/db/mongodb/mongod.log
:
"ctx":"initandlisten","msg":"Failed to start up WiredTiger under any
compatibility version. This may be due to an unsupported upgrade or
downgrade."}
If running in a jail add allow.mlock
to the jail.conf
, because it is
required since mongodb42
and otherwise will log in
/var/db/mongodb/mongod.log
:
Failed to mlock: Cannot allocate locked memory.
A installation of all intermediate versions of mongodb is required for the
update says the internet. But freebsd only keeps the really necessary versions
as packages. So you will use pkg
to install mongodb40
-> mongodb42
->
mongodb44
and with each version:
service mongodbd stop # because we will start/stop it manually (which could mess up permissions, but I think it does not)
pkg install mongodb40
mongod --dbpath /usr/local/share/java/unifi/data/db --port 27117 --unixSocketPrefix /usr/local/share/java/unifi/run --logappend --logpath /usr/local/share/java/unifi/logs/mongod.log --bind_ip 127.0.0.1 &
mongo --port 27017
db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
pkill mongod
pkg install mongodb42
mongod --dbpath /usr/local/share/java/unifi/data/db --port 27117 --unixSocketPrefix /usr/local/share/java/unifi/run --logappend --logpath /usr/local/share/java/unifi/logs/mongod.log --bind_ip 127.0.0.1 &
# this will fail, if you have it running in a jail and forgot to add allow.mlock in jail.conf
mongo --port 27017
db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
pkill mongod
pkg install mongodb44
mongod --dbpath /usr/local/share/java/unifi/data/db --port 27117 --unixSocketPrefix /usr/local/share/java/unifi/run --logappend --logpath /usr/local/share/java/unifi/logs/mongod.log --bind_ip 127.0.0.1 &
mongo --port 27017
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
pkill mongod
Note that the command mongo --port 27017
does not spawn a new instance of
mongodb, but connects to an existing instance and allows administration.
If you get this error in /var/db/mongodb/mongod.log
:
"ctx":"initandlisten","msg":"Error setting up
listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"Permission
denied"}}}
You will probably be able to fix it with chmod 1777 /tmp
.
The blog of haraschak contained a part of this solution for an earlier version. In appriciation for that I link you here.