While installing Mongodb I am facing error like
Failed to stop mongod.service: Unit mongod.service not loaded.
I tried to stop this service using-
~$ sudo systemctl stop mongodb
but it givs same error, I also check the status for mongodb using command
sudo systemctl status mongodb
this will result following response
● mongodb.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
I can install mongodb only after mongod.service get stoped, please guide how to stop service.
You need to create the mongod.service first. Then enable and stop
https://programmersought.com/article/28701054205/#:~:text=%2Flib%2Fsystemd%2Fsystem%2Fmongod.service
Execute this command in terminal
sudo systemctl enable mongod
After that check the status of service using
sudo service mongodb status
then you will be able to stop the service.
Related
I deployed my app to aws EC2 so I need a way of always having this node app running no matter what if the server restart if the app crashes whatever it always need to restart the app.
the app needs to running always. so I use npm start & is that enough to restart my app?
I've tried to use systemD, but I had error while start the service I've created :
sudo systemctl start nameX.service
Job for nameX.service failed because of unavailable resources or
another system error. See "systemctl status ...service" and
"journalctl -xeu ....service" for details.
sudo systemctl status nameX.service
nameX.service: Scheduled restart job, restart > systemd[1]: Stopped
My Node Server. Failed to load environment file> systemd[1]:
...service: Failed to run 'start' task: No > systemd[1]: ...service:
Failed with result 'resources'. systemd[1]: Failed to start My Node
Server.
When I type 'mongo' in terminal to run the mongo server. it doesn't run. It shows me the eroor : couldn't connect to server. exception: connection failed.
Then I tried to restart mongodb server by
$ sudo systemctl start mongod
$ sudo systemctl status mongod
When I run the status command, I see it is showing
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor prese
Active: failed (Result: exit-code)
N.B - I am running linux mint 20.1. And I have read all the answer and tried. But nothing worked for me.
Oh, I followed this guide to install, uninstall and reinstalling MongoDB. But still it is not working for me.
I've installed mongodb for the very first time on my Debian 8, following this mongodb install guide. The goal is to use mongodb for rocket.chat, for which I follow this guide.
So far, all I did was:
$sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
$echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
$sudo apt-get update
$sudo apt-get install mongodb-org
$sudo systemctl enable mongod
$sudo vi /etc/mongod.conf
<insert>
replication:
oplogSizeMB: 1
replSetName: rs0
$sudo systemctl restart mongod
$export LC_ALL=C
$sudo mongo
MongoDB shell version v3.4.0
connecting to: mongodb://127.0.0.1:27017
2016-12-14T10:21:55.356+0100 W NETWORK [main] Failed to connect to 127.0.0.1:27017 after 5000 milliseconds, giving up.
2016-12-14T10:21:55.356+0100 E QUERY [main] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:234:13
#(connect):1:6
exception: connect failed
I'm monitoring the log file, when attempting to access the mongo shell, but nothing shows up.
The mongod service is running, configured to listen on 127.0.0.1 and I'm working on the server locally.
How do I access the mongo shell from the localhost?
edit Solved. The issue was an iptables rule, that disallowed local connections to the mongodb.
Run the following command :
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod restart
Credit: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
You can access the mongodb shell by changing directory to your MongoDb installation and entering ./bin/mongo. See this guide: enter link description here
To recover from an unclean shutdown run these in a terminal
killall mongod
cd ~
./mongod --repair
rm -rfv data/mongod.lock
./mongod
If you want to remove the --httpinterface warning then run, try this :
echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest --httpinterface "$#"' > mongod
(it only needs running once) before you run
./mongod
I hope this helps. Cheers!
Issue:
sudo service opscenterd start
Failed to start opscenterd.service: Unit opscenterd.service failed to load: No such file or directory.
(ERROR)-(Exit Code 6)-(Unknown error code)
sudo service opscenterd status
opscenterd.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Config
[webserver]
port = 8888
interface = 0.0.0.0
I tried another port and ip (localhost)
Cassandra installed and running (dsc21, cassandra 2.1.10)
no log files been generated in /var/log/opscenter/
opscenter installed via apt-get (5.2)
Please help me to resolve this issue
I have the same issues as you, seems like OpsCenter could not run as service on Ubuntu 15, I went running it as background process and it works,
try:
$ sudo your_opscenter_install_path/bin/opscenter
hope helpping
Just installed a clean version of mongodb on Fedora 17 64-bit, but the Mongo service wont run.
I followed these instructions during installation
Running
service mongod start
results in
Starting mongod (via systemctl): Job failed. See system journal and 'systemctl status' for details. [FAILED]
So I ran
systemctl status mongod.service
which gives me
mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod)
Active: failed (Result: exit-code) since Mon, 18 Jun 2012 13:15:56 +0200; 58s ago
Process: 13584 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/mongod.service
Mongo logs in /var/log/mongo/mongod.log is empty
Thanks
How to install mongodb and mongodb-server on fedora linux (verified on f16 & f17). All commands are intended to be run in a su session.
1) make sure you have no mongodb installation lying around
# yum erase mongodb
# yum erase mongo-10gen (if it is installed)
2) install from fedora yum repository
# yum --disablerepo=* --enablerepo=fedora,updates install mongodb mongodb-server
3) start mongod (mongodb daemon)
# systemctl start mongod.service
4) verify mongod is running
# systemctl status mongod.service
# tail /var/log/mongodb/mongodb.log
# nmap -p27017 localhost
or running client
# mongo
MongoDB shell version: 2.0.2
connecting to: test
> db.test.save( { a: 1 } )
> db.test.find()
{ "_id" : ObjectId("4fdf28f09d16204d66082fa3"), "a" : 1 }
5) customize configuration
# vim /etc/mongodb.conf
# systemctl restart mongod.service
6) make mongodb service automatically start at boot
# systemctl enable mongod.service
Update for Fedora 18
When started for the first time by systemd on a slow or loaded machine, mongod service might timeout before finishing its initialization, with systemd flagging the service as failed.
Symptoms:
# journalctl -xn
-- Unit mongod.service has begun starting up.
10:38:43 local mongod[24558]: forked process: 24560
10:38:43 local mongod[24558]: all output going to: /var/log/mongodb/mongodb.log
10:40:13 local systemd[1]: mongod.service operation timed out. Terminating.
10:40:13 local systemd[1]: Failed to start High-performance, schema-free document-oriented database.
-- Subject: Unit mongod.service has failed
Very easy cure, restart the service:
# systemctl restart mongod.service
this should finish the initialization successfully and leave the daemon in running state.
I just had the same issue and in my case it was caused by installing mongodb following instructions of some websites using non-official repo. If you have the same issue and the answer above are not solving your problem, try uninstalling "mongodb-org" package and reinstalling it following the instructions of the official documentation : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
Remainder to uninstall package in fedora:
sudo dnf remove <package-name>