Repair-UniFi-mongodb-database

Repair UniFi mongodb database

Suddenly got an error today, the UniFi portal can’t be accessed even though i check at the server the service is running. Have tried to restart both the service and the server itself but still nothing, checking the error log on server show nothing suspicious.

Checking the netstat also show java indeed is running on port 8443

sudo netstat -ntulp | grep -P "java|mongod|8443"

Before you tried to reinstall the unifi, try some other way which is to repair the mongodb database, seems like the culprit is database gets corrupted due to an unclean shutdown:

service unifi stop
mongod --dbpath /usr/lib/unifi/data/db --repair