1.Run the rpm -qa|grep mongo command to check whether MongoDB exists on this server.
[root@localhost ~]# rpm -qa|grep mongo
mongodbconfig-4.0.19-el7.x86_64
2.If it exists, complete the following steps to uninstall it:
1)Run the cd /usr/lib/netbrain/installer/mongodb command to navigate to the mongodb directory.
2)Run the ./uninstall.sh command under the mongodb directory.
[root@localhost ~]# cd /usr/lib/netbrain/installer/
[root@localhost installer]# ./uninstall.sh
Uninstalling MongoDB.
MongoDB service mongodb will be uninstalled, please wait.
MongoDB has been uninstalled successfully.
Note: After the service is uninstalled, all data files are backed up under the MongoDB data folder directory with the timestamp. You can run the ls -al command under the MongoDB data folder directory to check the backup data.
[root@localhost mongodb]# ls -al
total 4
drwxr-xr-x. 3 netbrain netbrain 37 Apr 10 23:37 .
drwxr-xr-x. 4 root root 39 Apr 10 22:16 ..
drwxr-xr-x. 4 netbrain netbrain 4096 Apr 10 23:37 data2019|Apr|11|03:37:16