
This can be changed with: chown -R unifi:unifi /usr/lib/unifi/data/db/Ĭhown -R unifi:unifi /usr/lib/unifi/logs/server.log NOTE:If this process was performed as root the file ownership may have changed. Finally, restart the UniFi service: service unifi start Repair the database with this command: mongod -dbpath /usr/lib/unifi/data/db -smallfiles -logpath /usr/lib/unifi/logs/server.log -repairĤ. In some cases, where the journal is corrupted, it will be helpful to run the following command before repairing the database, to move it to another location: mv -vi /usr/lib/unifi/data/db/journal /usr/lib/unifi/data/db/journal-$(date -I)ģ. Stop the UniFi service service unifi stopĢ.
#MONGODB MAC SHUTDOWN HOW TO#
How to Repair a Database on Debian-based Linuxġ. If you still have database issues please contact Ubiquiti Support. The Cloud Key should now be able to run the Network application.

If you see such an error running the script then you will need to repair the database from the command line once again by running the command in step 3.ħ. It may result in an error if the stats collections have already grown too large to be repaired while the mongo server is running. NOTE:The last command in the CK_repair.js script is "db.repairDatabase()". If the dataset has already grown too large to proceed with the db.repairDatabase() command there are instructions below to work around that.
#MONGODB MAC SHUTDOWN PLUS#
To be able to run a database repair, the Cloud Key will have to have enough free disk space equal to the size of the current data set plus 2 gigabytes. This repair may be needed for those who are suspecting invalid entries, corruption, or collection scaling issues.

Getting back that valuable disk space on a 32-bit MongoDB instance will require a repair of the database. This process does not return useable disk space to the UniFi OS Console (or other Network application host) when the storage engine is MMAPv1. When running a compact command on the MongoDB, the database is rewritten and defragmented without error correction.

While running the MMAPv1 storage engine this can cause issues when trying to shrink the aggregate collection sizes. 32-bit MongoDB Limitationsģ2-bit MongoDB collections are limited to a total size of 2GB. Check this with df -h in an SSH session to see if the partition where UniFi is storing data is running short on space. On 64-bit machines not affected by the MongoDB limitation, there can also be overall space issues on the host that can cause issues when trying to repair the database. ▪Run the service mongodnetbrain start command at the command line.Total data doesn't have to exceed 2GB on the UC-CK, it only needs to be big enough for Mongo to expand. ▪ Run the /etc/init.d/mongodnetbrain start command at the command line. Restarting MongoDB Service Manuallyġ) Run the crontab -e command to show the task script.ģ) Remove the pound sign (#) from the beginning of the auto script and press the ESC key to exit the editing mode.Ģ.Manually restart the MongoDB service by using either of the following methods: ▪Run the service mongodnetbrain stop command at the command line. ▪ Run the /etc/init.d/mongodnetbrain stop command at the command line. # */1 * * * * /bin/bash -c 'if /usr/sbin/service mongodnetbrain status|grep -q -E "(dead)|failed" Ĥ) Type the :wq! command at the command line and press the Enter key to save the changes.Ģ.Manually stop the MongoDB service by using one of the following methods: Then /usr/sbin/service mongodnetbrain start fi' >/dev/null 2>&1Ģ) Press the Insert key to enter the editing mode of the script.ģ) Add a pound sign (#) at the beginning of the auto script to comment it and press the ESC key to exit the editing mode. Stopping MongoDB Service Manuallyġ.Stop the crontab -e task, which is used to check the MongoDB service timely (1 minute by default) and restart the service when it is down.ġ)Open a command prompt and run the crontab -e command to edit the auto script. To stop the MongoDB service, press 1 To restart the MongoDB service, press 2.

Restarting or Stopping MongoDB Service by Scriptġ.Run the stoporstartmongodb.sh command under the NetBrain_Database directory after extracting installation files from the NetBrain_Database.tar file.Ģ.Enter the MongoDB service name and press the Enter Key.ģ. In some particular situations, you may want to manually stop the MongoDB service and then restart it, see the following sections for reference.
#MONGODB MAC SHUTDOWN INSTALL#
The MongoDB service starts automatically after you successfully install it on your machine.
