MongoDB service cannot be found in service list - mongodb

I have following the instruction from this link
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
And when I'm going to
sudo service mongod start
it's shown as unrecognized service
I have known that I may need to use mongodb instead of mongod, but it's the same.
Then I have checked all services list by
service --status-all
There's no mongodb-related service in the list
I have reinstall it again and it's the same. I have also searched through the internet and I cannot find the solution. I install on Windows's ubuntu bash. I have reinstall bash once before this issue (14.04 to 16.04). Last time I installed it before I reinstalled bash it work just fine.
Thank you in advance for your answers.

I faced the same issue. I don't know the reason and solution but you can check the status of mongo itself by this command:
sudo service mongod status
You may see something like this output:
root#lab# service mongod status
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2018-04-06 09:47:57 BST; 1min 31s ago
Docs: https://docs.mongodb.org/manual
Main PID: 5973 (mongod)
CGroup: /system.slice/mongod.service
└─5973 /usr/bin/mongod --quiet --config /etc/mongod.conf

Related

Ceph Manual Deployment no ceph -s output after mon installs (Nautilus)

I'm trying to build a cluster to test stuff before i apply them to out production cluster. We're using Ceph Nautilus so i decided to install Nautilus first as well.
Used the docs below:
https://docs.ceph.com/en/latest/install/manual-deployment/
Everything seemed to go fine. I installed 3 monitors, generated the monmap copied keyrings to other monitors, started services and they are all up. But when i type ceph -s to check the cluster status it just gets stuck forever without any output. Any command that uses the word "ceph" in it just gets stuck. As a result i can't continue to build the cluster since i need to be able to use ceph commands after monitor deployments to install other services.
Systemctl outputs are the same for all 3 monitors in the current state:
[root#mon2 ~]# systemctl status ceph-mon#mon2
● ceph-mon#mon2.service - Ceph cluster monitor daemon
Loaded: loaded (/usr/lib/systemd/system/ceph-mon#.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-04-28 09:55:24 +03; 25min ago
Main PID: 4725 (ceph-mon)
CGroup: /system.slice/system-ceph\x2dmon.slice/ceph-mon#mon2.service
└─4725 /usr/bin/ceph-mon -f --cluster ceph --id mon2 --setuser ceph --setgroup ceph
Apr 28 09:55:24 mon2 systemd[1]: Started Ceph cluster monitor daemon.
Resolved, the problem is caused by missing firewalld and selinux configurations. After applying those and restarting the deployment process my issue was solved.

Not able to start PostgreSQL

Have a CentOS7 Linux machine running (not managed by me; have limited rights to/in it).
Have a request to set PostgreSQL up in it.
Just installed PostgreSQL from the CentOS repository:
sudo yum install postgresql-server postgresql-contrib
All good with it.
Then did initialization of the database:
sudo yum install postgresql-server postgresql-contrib
All good with it.
But then the start:
sudo systemctl start postgresql
Fails:
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
I do not have access to systemd-journal so nothing tod with "journalctl -xe", but then the:
systemctl status postgresql.service
returns:
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-04-24 16:41:04 EEST; 33s ago
Process: 30690 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
Process: 30684 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
postgres --version
postgres (PostgreSQL) 9.2.24
Any ideas what could be wrong here? Hot to continue with that?
As the echo $PGDATA shows you have PG9.3 as well. Which means that 9.2 service will not start because the port 5432 might be already occupied by postgres 9.3
Do the following
ps- ef | grep postgres
And get the postgres process id and kill all postgres processes.
Remove the 9.3 data directory using
rm -rf /var/lib/pgsql/9.3
Go to /usr/pgsql-9.2/bin and run the initdb using below command
./postgresql92-setup initdb
After that start the postgresql-9.2 service using
systemctl start postgresql-9.2.service
There must be both PostgreSQL 9.2 and 9.3 installed on your machine. Deinstall them both and install version 12 from the PostgreSQL site. Remove the data directory and create a new one with the v12 installation. Then try again.

How can i deal with this problem while install mongodb on centos 7?

After install mongodb on CentOS, I'm typingthe command systemctl status mongod, but the following problem appears (also see picture):
systemctl status mongod ● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled;
vendor preset: disabled) Active: failed (Result: exit-code) 02-28
20:17:01 CST; Process: 3558 ExecStart=/usr/bin/mongod $OPTIONS
(code=exited, status=2) Process: 3556 ExecStartPre=/usr/bin/chmod 0755
/var/run/mongodb (code=exited, status=0/SUCCESS) Process: 3554
ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
(code=exited, status=0/SUCCESS) Process: 3547
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited,
status=0/SUCCESS)
Thank you so much for reading my problem. If you can help me solve the problem, I will appreciate it very much.
Figure
This happends often when you started the service as a different user.
Follow this:
- try first stoping the service.
sudo systemctl stop mongod
then remove this file:
sudo rm /tmp/mongodb-27017.sock
restart mongodb service
sudo systemctl start mongod
if that doesnt do it, i would suggest to remove mongodb and follow this guide: (it worked for me perfectly on CentOS 7)
try installing mongodb like this:
Create a /etc/yum.repos.d/mongodb-org-4.2.repo file so that you can install MongoDB directly using yum:
sudo vi /etc/yum.repos.d/mongodb-org.repo
Paste this inside the mongodb-org.repo
[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
verify that the MongoDB repository exists
yum repolist
Installing mongodb
sudo yum install mongodb-org
Start the mongodb service:
sudo systemctl start mongod
The reload command requests that the mongod process reads the configuration file, /etc/mongod.conf, and applies any changes without requiring a restart
sudo systemctl reload mongod
try access the database server with the MongoDB Shell:
mongo
this helped me allot on centos7,
let me know if you need anything else.
cheers,
Radi

Failed to start MongoDB (Make sure 'mongod' are in your $PATH or use dpd --mongo

I’m new to AngularJS and new to Deployd. I’m running windows 7.
I ran the following command:
C:\books\ProAngular\TEMP\pro-angularjs-master\Chapter 01>dpd -p 5500 sportsstore
\app.dpd dashboard
Here is my error:
C:\books\ProAngular\TEMP\pro-angularjs-master\Chapter 01>dpd -p 5500 sportsstore
\app.dpd dashboard
deployd CLI version 2.0.2
starting deployd
Failed to start MongoDB (Make sure 'mongod' are in your $PATH or use dpd --mongo
d option. Ref: http://docs.deployd.com/docs/basics/cli.html)
I’ve looked online and at stackoverflow. I still can’t get the app to run.
Any help or hint will be greatly appreciated it.
You should add your MongoDB installation path to the variable PATH.
Go to system properties -> advanced -> in the system variables tab look for the variable PATH and click edit.
Add the MongoDB path at the end of what you already have and save.
This can happen because of 2 reasons.
mongodb path is not available in PATH variable
mongodb might be runnign already. In this case, kill the mongodb process from task manager/processes and run dpd again
This works both on mac and windows
use the command bellow
dpd --mongod "MONGODB_HOME\mongod.exe"
Make sure to replace MONGODB_HOME with the right path.
That should work
My solution was to shutdown (stop) mongod:
I’m running Ubuntu 18.04, by default my mongod is running after boot up. To check the “status” of mongod type: service mongod status
You should see something like this where active (running) is in green:
Active: active (running) since Sat 2019-10-05 19:39:33 CDT; 2min 47s ago
Then type: service mongod stop, this will stop mongod
Now check the “status” again by typing: service mongod status
You should see something like this where inactive (dead) is in green:
Active: inactive (dead) since Sat 2019-10-05 19:45:14 CDT; 1s ago
Now when you type the dpd command you should not get a mongod error.
This might work:
cd sportsstore
dpd --host "127.0.0.1" -P '27017' -n "mongodb" -u " " -s " "

$ systemctl start mongodb returns failed (status=100)

My problem is simple yet the solution isn't easily found.
On my server I've had mongodb running for a few months and suddenly it stopped working. I start mongodb using $ systemctl start mongodb but it doesn't work anymore.
The response I get when I run $ systemctl status mongodb is:
Active: failed
Process: ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
(code=exited, status=100)
What could it be? I've got a back-up of .ns and .0/.1/.2 files.