Deployd :: Failed To Start MongoDB - mongodb

Am a newbie in Deployd and MongoDB. I have installed Deployd (www.deployd.com) 0.6.9 on my Windows-XP system. I executed the following command at the prompt as instructed by the book am studying
>dpd create sportsstore
Now, when i run the following command
> dpd –p 5500 sportsstore/app.dpd
to start the Deployd server, i get the following error::
starting deployd v0.6.9...
Failed to start MongoDB
It states that MongoDb has failed to start. I went into the directory "C:\Program Files\Deployd\tools" and found that there is a file called "mongod".
I have never installed MongoDB before on my computer. It is my first time working with Deployd so i don't know whether the "Mongod" file in the tools folder is the same as MongoDB or i have to install MongoDB separately on the computer.
Can someone point me to the right direction.
Thanks.

First of all, you have to install mongodb in your computer. You can do it from the official site for MongoDB. The standard option would be to install the Community version.
After that, you can check if mongodb was properly installed and can be used with Deployd:
If you are in iOS or Linux you can try:
sudo dpd
If you are in Windows try opening a command window with "Run as Administrator" and try:
dpd

For Windows Installation.
1) Run npm install deployd -g
2) Install Mongo DB separatetly using windows installer available on
https://www.mongodb.com/download-center#community
and configure to run it as service as mentioned on below url.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
Service option is convenient to start and stop database using net start and net stop command
3) create a deployd module using 'dpd create abcd'.
4) navigate to deployd module you have created (using cd abcd) to run dpd -d command. Before you run dpd -d command you need to ensure the you start the mongodb service from same command prompt running in elevated mode or admin mode.( use the command : 'net start MongoDB')
In case It is still giving path error then try below command:
set path=%PATH%; "C:\Program Files\MongoDB\Server\3.4.1\bin"
this command is alternative for setting path in environment variable (in case user doesn't have permissions to modify environment variable)
Still not working, same path issue ??
run using command --mongod as mentioned below
dpd -m "C:\Program Files\MongoDB\Server\3.4.1\bin\mongod.exe"

After installed the depolyd run:
dpd -e production

To solve the problem of "failed to start mongoDB"
1- I installed mongoDB for windows from this web page (https://docs.mongodb.com/manual/installation/).
2- Then I created a path as shown below
path
3 - I installed the deployd and I run:
dpd -e production

Related

installing MongoDB to Mac

I need help to solve an error that happened while installing MongoDB into Macbook.
I run this command to kick off installing.
brew install mongosh
ALthough I got a warning msg, it seemed like fine.
I waited so long, and the installation got finally done.
Here is the screenshot of the end.
As you can see, I typed below to check if it was successfully installed.
mongosh --version
1.2.2
Finally I tried to run MongoDB, so typed "mongosh". And I got an error to run it and connect to db called cluster0.
mongosh
Current Mongosh Log ID: 621d2adedeee61396fddb367
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.2.2
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
takeichimasahironoMacBook-Air:~ masa$ mongosh "mongodb+srv://cluster0.8tjjn.mongodb.net/myFirstDatabase" --apiVersion 1 --username mongo
Enter password: *****
Current Mongosh Log ID: 621d2b0f5a5370a82628edcc
Connecting to: mongodb+srv://cluster0.8tjjn.mongodb.net/myFirstDatabase?appName=mongosh+1.2.2
MongoServerSelectionError: read ECONNRESET
Any idea to solve this issue?? Thanks for your effort in advance.
In addition to the good answer above -- On newer versions mac os x the root directory is read only so you will need place your mongo data directory somewhere else, see this thread:
Read-only file system when attempting mkdir /data/db on Mac
I also needed to separately install the mongo command line tool from the cask:
$ brew install mongodb-community-shell
I recommend Homebrew for installing and managing applications on macOS. It is installed using the following command in the macOS terminal. Open up the terminal and paste the command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The terminal runs through a series of installation operations, and will probably create folders in your local machine to accommodate Homebrews storage requirements. You can find more detailed instructions here. After it's installed, update the Homebrew dependencies and install MongoDB on the command line:
brew update
brew tap mongodb/brew
brew install mongodb-community
It will take a few seconds. Once it's done, create a directory so MongoDB can store its data.
sudo mkdir -p /data/db
Now to make sure this data directory have the right permissions, you'll run this command:
sudo chown -R `id -un` /data/db
Now our data directory is ready with the right permissions. Next run mongo daemon. Which is a service which runs in the background and listens for connections on a given port. Run this command:
mongod
Now mongo daemon will be running in the background and can be used by your applications. Next, check your MongoDB version:
mongo --version
MongoDB shell version v4.2.6
The command-line results will show the version you have installed on your local machine. I recommend using the latest version of libraries and software whenever possible to avoid compatibility issues with client-side applications.

Switching between or adding multiple VOLTTRON Historian Framework

I have below agent installed in my Volttron platform:
AGENT - IDENTITY - TAG
sqlhistorianagent-3.6.1 - platform.historian - platform_historian
Following the documentation: http://volttron.readthedocs.io/en/4.1/core_services/historians/index.html
I tried to install another Historian -(Mongo Historian) following this doc.:http://volttron.readthedocs.io/en/4.1/core_services/historians/Mongo-Historian.html#prerequisites
Below the steps followed to install mongodb on Ubuntu:
Prerequisites
1.Mongodb
cd volttron
. env/bin/activate
sudo scripts/historian-scripts/root_install_mongo_ubuntu.sh
2.Mongodb connector
pip install pymongo
The installation done successfully. However, I am using below commands to check the status of the installed agent.
volttron -l log1&
volttron-ctl status
For some reason, it is not showing up under my agents.
Question:
Is it possible to have both agents in the same Volttron? if it is not,
please let me know how to switch between the historian agents (i.e replace Sqlhistorianagent with Mongodbagent) or enable Mongodbagent agent?
It is worth-mentioning that I have "Crate Historian" installed.
pymongo is required for connecting to the mongo database. You still need to install the MongodbHistorian.
You can look at https://github.com/VOLTTRON/volttron/blob/master/scripts/historian-scripts/start-historian-mysql.sh for an example of what you will need to do to install the agent itself. The following assumes that you are running it from the root of the volttron directory and that you have modified the config file in the mongodbhistorian directory to connect to your mongodb instance.
#!/usr/bin/env bash
if [ ! -e "./volttron/platform" ]; then
echo "Please execute from root of volttron repository."
exit 0
fi
export HIST="services/core/MongodbHistorian"
export HIST_CONFIG="$HIST/config.mongodb"
SCRIPTS_CORE="./scripts/core"
$SCRIPTS_CORE/start_historian.sh $1
One thing also to note is that shortly we will be updating master to releases/5.0rc so the methodology for installations will have changed.

How to start mongdb in Linux mint?

I would like to ask on how to start mongodb in linux mint. I tried sudo service mongod start but it shows the error mongod: unrecognized service. Why is this happen. When I run the sudo service in ubuntu Linux there is no problem like this. BUt why its not work in Linux mint? Is there a solution for this?
I just installed Mongo DB in LinuxMint Sarah (18) and for me, the following command worked:
sudo service mongodb start.
Checking that it works can be done either by executing 'top' command or checking the log file in mongodb folder (instructions in the following link ---> https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#run-mongodb-community-edition)
For stopping mongodb, the same command but typing stop 'sudo service mongodb stop'
In the previous link, both commands are included but without the 'b', maybe they just made a typing mistake :)

install mongodb on window 8

I try to install mongodb on window 8 .
problem is when i want to install mongodb service
C:\mongodb\bin\mongod.exe --auth --config C:\mongodb\mongod.cfg --install
below error accord
Wed Mar 13 19:13:23 Trying to install Windows service 'MongoDB'
Wed Mar 13 19:13:23 Error connecting to the Service Control Manager: Access is denied. (5)
how Can I Install Mongodb Service?
Open Command with "Run as Administrator",that solved my problem
For anyone that happens to try to create a mongodb service on Windows 8 and follows the instructions on MongoDB's website AND still is unable to create the service successfully - I've written this post that explains how I got it to work after experiencing problems trying to set the mongo service on my Windows 8 laptop. Hope it helps!
Here are the steps that you really need to follow to create a Windows service for MongoDB in Windows 8:
Installing MongoDB on Windows 8
Download and install MongoDB. You can download the 32 or 64-bit version from here.
Make sure you install MongoDB in a folder that you can easily remember, for example: c:\mongodb\
Add directories c:\mongodb\log and c:\mongodb\data
Add log file c:\mongodb\log\mongo.log
Creating a Windows service for MongoDB
Open your command window and type the following:
cd c:\mongodb\bin\mongod.exe --install --rest -master -logpath=c:\mongodb\log\mongo.log
Open the registry settings, press the Windows key and R at the same time and then type regedit in the Run command window.
Go to HKEY_LOCAL_MACHINE >> SYSTEM >> CurrentControlSet >> services
Find out MongoDB directory & edit ImagePath key
Set key value as:
C:\mongodb\bin\mongod --service --rest --master --logpath=C:\mongodb\logs\mongo.log --dbpath=C:\mongodb\data
Save and exit registry editor.
Open Services by pressing the Windows key and R at the same time and then type services.msc in the Run command window and click OK.
Find the MongoDB service and right-click on it, select Properties
Make sure the service is set to start automatically and start the service as shown below.
Open your browser and go to http://localhost:28017/ to see if MongoDB is running correctly, you should see a page full of MongoDB details.
Link to this blog post:
http://ricardodsanchez.com/2014/09/03/install-mongodb-service-on-windows-8/
error message suggest you don't have admin privileges.
"Run all of the following commands in Command Prompt with “Administrative Privileges:”"
Ref: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#install-and-run-the-mongodb-service
Regards,
Moacy
thanks for answer Moacy Barros but problem was not for this because i run all commands in Command Prompt with “Administrative Privileges:”" problem was for mongod.cfg if mongod.cfg config by manual in editor this problem solve that we didn't need to do this in window 7 or server 2008
Edit::
in older windows when installing MongoDB < 2.2 that i was tested. in Configure directories and files step
echo logpath="C:\Program Files\MongoDB\log\mongo.log" > "C:\Program Files\MongoDB\mongod.cfg"
it make mongod.cfg for your mongodb but it wasn't make for me in window 8 for that i make it by manual like
logpath=C:\mongodb\log\mongo.log
logappend=true
dbpath = E:\data

How to check if Mongodb is properly installed

I installed MongoDb yesterday on a Mac Snow Leopard and got the following error message
Mongo::ConnectionFailure: Failed to connect to a master node at localhost:27017
when trying to run some tests in Rails that used a mongodb.
Another SO question mongo - ruby connection problem about the same error message had an answer that recommended removing the lock file
sudo rm /var/lib/mongodb/mongod.lock
but when I run that command i'm getting
No such file or directory
Any ideas how I can figure out how to get it working or see if it's properly installed?
The easiest way to run mongodb on Mac OS is:
Download binary package from http://www.mongodb.org/downloads, for me, I am using lastest 64 bit version (http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.2.tgz)
mkdir -p $HOME/opt
cd $HOME/opt
wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.2.tgz to download the latest (2.0.2 for now) 64 bit binary package for Mac OS
tar xf mongodb-osx-x86_64-2.0.2.tgz -C $HOME/opt to unpack the package, and it will be unpacked to $HOME/opt/mongodb-osx-x86_64-2.0.2
mkdir -p $HOME/opt/mongodata to create the data directory for mongodb
$HOME/opt/mongodb-osx-x86_64-2.0.2/bin/mongod --dbpath=$HOME/opt/mongodata --logpath=$HOME/opt/mongod.log to start the mongodb daemon
Then you can run $HOME/opt/mongodb-osx-x86_64-2.0.2/bin/mongo to connect to your local mongodb service
You can also have http://www.mongodb.org/display/DOCS/Quickstart+OS+X as additional reference
It's not running mongod. You need to start it, probably with a script so you can control how it starts. The script I use on my mac looks like: mongod -f /etc/mongodb.conf &.
At this point I can't remember if the install came with /etc/mongodb.conf, or if I put it there myself. It's fairly simple. I store my data/log in my user folder (this is obviously a development environment):
dbpath = /Users/me/data/
logpath = /Users/me/mongo.log
# Only accept local connections
bind_ip = 127.0.0.1
You'll also need to create your data folder, if it doesn't exist.