I have installed monogodb with this procedure :
Mongodb on Debian
The service mongod is running.
$ service mongod status
mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled)
Active: active (running) since Fri 2016-11-04 09:29:04 CET; 1 weeks 5 days ago
Main PID: 957 (mongod)
CGroup: /system.slice/mongod.service
└─957 /usr/bin/mongod --quiet --config /etc/mongod.conf
Nov 04 09:29:04 serv01 systemd[1]: Started High-performance, schema-free document-oriented database.
I didn't find the init script of this instance :
$ service --status-all | grep mon
[ + ] smartmontools
and whereis mongod:
mongod: /usr/bin/mongod /etc/mongod.conf /usr/share/man/man1/mongod.1.gz
Where is the mongod init script stored?
Related
I've got a problem with my mongo db (my OS is ubuntu), i tried to restart my mongodb but when i execute the command
systemctl restart mongod
the status of mongodb respond with
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset>
Active: failed (Result: exit-code) since Thu 2023-02-09 10:11:18 CET; 8s a>
Docs: https://docs.mongodb.org/manual
Process: 11215 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=ex>
Main PID: 11215 (code=exited, status=14)
CPU: 29ms
I restarted because i've got a problem with my web app, the path of my database doesn't work when i tried to execute the command :
mongod --dbpath ./db
i executed this command on my server file which contain the file ./db
my question is similar like this
but all the answer of given here are not working for me ? My etc/mongod.conf file like this and start the server
bindIp: 127.0.0.1,<sameserverIP>,<anotherServerIp>
If i run systemctl status mogod i got following response:
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-12-27 14:12:42 +0545; 2min 36s ago
Docs: https://docs.mongodb.org/manual
Process: 5493 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 5493 (code=exited, status=48)
and if i change my etc/mongod.conf file like this and restart server
bindIp: 127.0.0.1,<sameserverIP>
then the mongodb server will work fine here is the output of systemctl status mongod
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-12-27 13:47:45 +0545; 10s ago
Docs: https://docs.mongodb.org/manual
Main PID: 4608 (mongod)
Memory: 211.8M
CGroup: /system.slice/mongod.service
└─4608 /usr/bin/mongod --config /etc/mongod.conf
I tried checking journal also using this command journalctl -u mongod
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: Started MongoDB Database Server.
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: mongod.service: Failed with result 'exit-code'.
This mongo server is installed in linode ubuntu 2020.04 lts from linode marketplace and mongodb version is 5.0.14. i want to give access to only 4 ipaddress in this mongodb can any one help me fix this issue?
root#HangoutRoot:/Bot# sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-06-08 08:57:25 PDT; 5s ago
Docs: https://docs.mongodb.org/manual
Process: 2241 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 2241 (code=exited, status=48)
Jun 08 08:57:25 HangoutRoot systemd[1]: Started MongoDB Database Server.
That's what I get when I check the status of the mongodb server using sudo systemctl status mongod
Try this command : sudo systemctl enable mongod
After this:
run this command
sudo service mongod restart
If this still do not work I think reinstalling mongo would be a better solution.
To re-install mongo follow the the process of accepted answer from this link:
https://askubuntu.com/questions/884541/cant-start-mongodb-service
I am trying to Integrating Jenkins 2 and SonarQube 6.7.3 on centos 7 due to this tutorial:
https://www.youtube.com/watch?v=osc0j_Z1x0w
I install and config all software like: java, PostgreSQL, SonarQube,... I am really confused how to start sonar correctly in order to be able open sonar dashboard on Firefox by http://localhost:9000/ now i can't open it because the sonar service not started correctly and PID keeps on changing rapidly :
[root#localhost ~]# service sonar status
SonarQube is running (36211).
[root#localhost ~]# service sonar status
SonarQube is not running.
[root#localhost ~]# service sonar status
SonarQube is running (36602).
[root#localhost ~]# service sonar status
SonarQube is running (36602).
[root#localhost ~]# service sonar status
SonarQube is not running.
[root#localhost ~]# service sonar status
SonarQube is running (36993).
[root#localhost ~]# service sonar status
SonarQube is running (36993).
[root#localhost ~]#
sonar can't be opened on FireFox
I start and enable PostgreSQL by this commands :
[root#localhost ~]# systemctl start postgresql-9.6
[root#localhost ~]# systemctl enable postgresql-9.6
[root#localhost ~]# systemctl status postgresql-9.6
● postgresql-9.6.service - PostgreSQL 9.6 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.6.service; enabled;
vendor preset: disabled)
Active: active (running) since Mon 2018-05-07 11:44:12 +0430; 1h 26min ago
Docs: https://www.postgresql.org/docs/9.6/static/
***Main PID: 1288 (postmaster)***
CGroup: /system.slice/postgresql-9.6.service
├─1288 /usr/pgsql-9.6/bin/postmaster -D /var/lib/pgsql/9.6/data/
├─1626 postgres: logger process
├─1630 postgres: checkpointer process
├─1631 postgres: writer process
├─1632 postgres: wal writer process
├─1633 postgres: autovacuum launcher process
└─1634 postgres: stats collector process
May 07 11:43:57 localhost.localdomain systemd[1]: Starting PostgreSQL 9.6
database server...
May 07 11:44:11 localhost.localdomain postmaster[1288]: < 2018-05-07
11:44:11.217 +0430 > LOG: redir...ess
May 07 11:44:11 localhost.localdomain postmaster[1288]: < 2018-05-07
11:44:11.217 +0430 > HINT: Futu...g".
May 07 11:44:12 localhost.localdomain systemd[1]: Started PostgreSQL 9.6
database server.
Hint: Some lines were ellipsized, use -l to show in full.
when I run the command again systemctl status postgresql-9.6 the output is the same as last run with Main PID: 1288 (postmaster) :
[root#localhost ~]# systemctl status postgresql-9.6
● postgresql-9.6.service - PostgreSQL 9.6 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.6.service; enabled;
vendor preset: disabled)
Active: active (running) since Mon 2018-05-07 11:44:12 +0430; 1h 29min ago
Docs: https://www.postgresql.org/docs/9.6/static/
***Main PID: 1288 (postmaster)***
CGroup: /system.slice/postgresql-9.6.service
├─1288 /usr/pgsql-9.6/bin/postmaster -D /var/lib/pgsql/9.6/data/
├─1626 postgres: logger process
├─1630 postgres: checkpointer process
├─1631 postgres: writer process
├─1632 postgres: wal writer process
├─1633 postgres: autovacuum launcher process
└─1634 postgres: stats collector process
May 07 11:43:57 localhost.localdomain systemd[1]: Starting PostgreSQL 9.6
database server...
May 07 11:44:11 localhost.localdomain postmaster[1288]: < 2018-05-07
11:44:11.217 +0430 > LOG: redir...ess
May 07 11:44:11 localhost.localdomain postmaster[1288]: < 2018-05-07
11:44:11.217 +0430 > HINT: Futu...g".
May 07 11:44:12 localhost.localdomain systemd[1]: Started PostgreSQL 9.6
database server.
Hint: Some lines were ellipsized, use -l to show in full.
[root#localhost ~]#
but when I start and run sonar, the outputs are different and Main PID keeps on changing rapidly :
[root#localhost ~]# systemctl start sonar
[root#localhost ~]# systemctl enable sonar
[root#localhost ~]# systemctl status sonar
● sonar.service - SonarQube service
Loaded: loaded (/etc/systemd/system/sonar.service; enabled; vendor preset:
disabled)
Active: active (running) since Mon 2018-05-07 13:19:57 +0430; 6s ago
Process: 121807 ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
(code=exited, status=0/SUCCESS)
Process: 121850 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
(code=exited, status=0/SUCCESS)
***Main PID: 121893 (wrapper)***
CGroup: /system.slice/sonar.service
├─121893 /opt/sonarqube/bin/linux-x86-64/./wrapper /opt/sonarqube/bin/linux-x86-64/../../conf...
└─121895 java -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -
Xmx32m -Djava.library.pat...
May 07 13:19:56 localhost.localdomain systemd[1]: sonar.service
holdoff time over, scheduling restart.
May 07 13:19:56 localhost.localdomain systemd[1]: Starting SonarQube
service...
May 07 13:19:56 localhost.localdomain sonar.sh[121850]: Starting
SonarQube...
May 07 13:19:56 localhost.localdomain sonar.sh[121850]: PID:
May 07 13:19:56 localhost.localdomain sonar.sh[121850]:
"/opt/sonarqube/bin/linux-x86-64/./wrapper" "...be"
May 07 13:19:57 localhost.localdomain sonar.sh[121850]: Started
SonarQube.
May 07 13:19:57 localhost.localdomain systemd[1]: Started SonarQube
service.
Hint: Some lines were ellipsized, use -l to show in full.
[root#localhost ~]#
the previous command Main PID: 121893 (wrapper) and the other command is Main PID: 123382 (wrapper)
[root#localhost ~]# systemctl status sonar
● sonar.service - SonarQube service
Loaded: loaded (/etc/systemd/system/sonar.service; enabled; vendor preset:
disabled)
Active: active (running) since Mon 2018-05-07 13:21:11 +0430; 3s ago
Process: 123296 ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
(code=exited, status=0/SUCCESS)
Process: 123339 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
(code=exited, status=0/SUCCESS)
***Main PID: 123382 (wrapper)***
CGroup: /system.slice/sonar.service
├─123382 /opt/sonarqube/bin/linux-x86-64/./wrapper
/opt/sonarqube/bin/linux-x86-64/../../conf...
├─123384 java -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -
Xmx32m -Djava.library.pat...
└─123411 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-
0.b14.el7_4.x86_64/jre/bin/java -XX:+UseCo...
May 07 13:21:10 localhost.localdomain systemd[1]: sonar.service
holdoff time over, scheduling restart.
May 07 13:21:10 localhost.localdomain systemd[1]: Starting SonarQube
service...
May 07 13:21:10 localhost.localdomain sonar.sh[123339]: Starting
SonarQube...
May 07 13:21:10 localhost.localdomain sonar.sh[123339]: PID:
May 07 13:21:10 localhost.localdomain sonar.sh[123339]:
"/opt/sonarqube/bin/linux-x86-64/./wrapper" "...be"
May 07 13:21:11 localhost.localdomain sonar.sh[123339]: Started
SonarQube.
May 07 13:21:11 localhost.localdomain systemd[1]: Started SonarQube
service.
Hint: Some lines were ellipsized, use -l to show in full.
How can I restart mongodb that I just killed in Linux?
Before killing:
$ service mongodb status
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-03 08:41:16 GMT; 4h 5min ago
Docs: man:mongod(1)
Main PID: 1036 (mongod)
Tasks: 10
Memory: 61.0M
CPU: 1min 1.636s
CGroup: /system.slice/mongodb.service
└─1036 /usr/bin/mongod --config /etc/mongodb.conf
So I wanted to stop/ kill it for a while for other programs:
$ sudo kill 1036
$ service mongodb status
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:mongod(1)
But how can I start it again?
I'm on Ubuntu 16.04.
EDIT:
$ systemctl start mongod
Failed to start mongod.service: Unit mongod.service not found.
EDIT 2:
Get this error below when I have the other program running on mondodb. so I killed that program and it works as before.
$ sudo systemctl start mongodb
$ service mongodb status
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-01-03 13:05:19 GMT; 9s ago
Docs: man:mongod(1)
Process: 21732 ExecStart=/usr/bin/mongod --config /etc/mongodb.conf (code=exited, status=48)
Main PID: 21732 (code=exited, status=48)
Ubuntu 16.04 LTS
sudo systemctl start mongodb
Not only for MongoDB, but for any application installed, you can use
sudo systemctl start <app_name>
sudo systemctl restart <app_name>
Seems like you are using systemd
Try:
systemctl start mongod -> Start the service
systemctl status mongod -> Status of service
systemctl restart mongod -> restart the service
systemctl reload mongod -> reload the service
You checked status with :
service mongod status
so this should start mongod:
service mongod start
so this should stop mongod:
sudo service mongod stop
It works at my end.
for missing permissions:
sudo service mongod start