I download and install the last vesrion of MongoDb which is 4.0.2 and i set the correct path variable.
When i want to start the mondoDb service using mongod command i got the following error:
exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
i know that i should create the directory missing, but that directory is automatically created in the following path: C:\Program Files\MongoDB\Server\4.0
I checked the mongod.cfg file and the correct path is already set : dbPath: C:\Program Files\MongoDB\Server\4.0\data
Now how to tell the mongo to look for the folder he thinks is missing in the correct path ?
I had the same issue but after I create the directory C:\data\db\ it just worked.
I too had the same issue after an Windows update, Mongodb did not start automatically. Creating a new directory C:data/db will not be the right way as Mongodb has already configured the directory C:\Program Files\MongoDB\Server\4.0\data as datapath.
Run the following command in cmd as Administrator.
cd C:\Program Files\MongoDB\Server\4.0\bin
mongod --dbpath="C:\Program Files\MongoDB\Server\4.0\data".
This worked for me.
i tried to open CMD in admin mode and the error was gone. Hope this helps someone.
got to C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg file
update below fields with these values
dbPath: ....\data\db (directory path)
and restart server once
Create the directory/folder like below -
C:\data\db
open cmd at C:\Program Files\MongoDB\Server\6.0\bin and run 'mongod' command like below -
C:\Program Files\MongoDB\Server\6.0\bin>mongod
problem solved!
This solution may solve your problem problem
Make a directory as
sudo mkdir -p /data/db
That will make a directory named as db and than try to start with commands
sudo mongod
If you get another error or problem with starting mongod, You may find problem as
Failed to set up listener: SocketException: Address already in use
If you find that another error than you have to kill the running process of mongod by typing to terminal as
ps ax | grep mongod
Find the mongod running port and kill the process.
sudo kill ps_number
Another way is to make a specefic port when starting mongod as
sudo mongod --port 27018
Related
I really confused by target /path/to/directory is not a directory when i want to copying all files in build/* to the direction in by this rule in gitlab-ci.yml file:
script:
- cp -rf build/* /path/to/directory
I've also check this command by removing/adding / at end and start of the destination but won't help.
Note: it's OK when i manually run the cp command in server terminal and have no problem with it.This command was successful when i run it manually through terminal in ubuntu server.
So what's the problem here?
it's OK when i manually run the cp command in server terminal and have no problem with it.
That is probably because the target folder exists in the server itself, while it might not exist in the context of the GitLab runner.
You should either:
create the target folder:
mkdir -p /path/to/directory
or mount the server target folder as a data volume:
volumes = ["/path/to/bind/from/host:/path/to/bind/in/container:rw"]
I experienced a similar error because one of my files had a space in its name and so the path it was looking for was only reading the string after the space.
I have been trying to start the mongodb server on my local machine but it is NOT working. It used to work earlier without any errors. I am using macOS Big Sur.
I typed the following in my terminal. I have my mongodb database files setup in mongodb-data folder.
sudo mongod --dbpath “/Users/userName/mongodb-data”
but this is giving error and exiting with an exit code of 100. I have made sure mongodb-data folder is present.
Here is a snippet from the error log:
"ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory “/Users/userName/mongodb-data” not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}
The only change I have made is to replace my name by userName for privacy.
Any suggestions?
I would like to transfer file from my local machine to Google cloud instance. Here is my command:
gcloud compute scp "C:\Temp\esim_replication.ipynb" nlp-3:
Here is error message:
pscp: unable to open ./esim_replication.ipynb: permission denied
ERROR: (gcloud.compute.scp) [C:\Program Files (x86)\Google\Cloud SDK\google-clou
d-sdk\bin\sdk\pscp.exe] exited with return code [1].
This is brand new error. Everything worked fine 2 weeks ago. I am on Windows 7 locally and ran cmd as Administrator. I tried the above command with and without quotations.
Any suggestions?
Go to gcloud via ssh:
gcloud beta compute ssh --zone "your_zone" "instance_name" --project "project_name"
Give full access to your file:
sudo chmod 777 esim_replication.ipynb
In case someone finds this like I did: I had a similar error message, and what did the trick for me was using sudo: sudo gcloud compute scp [LOCAL] [REMOTE]. Apparently there was the need for updating the project ssh metadata (even though copying in the other direction worked just fine).
Encountered the same error while transferring from my local Windows desktop to Debian VM in GCP.
Changed the permission of the destination folder to 777.
gcloud compute scp source_folder/File1.txt VM_instance_name:destination_folder
It worked!
What? from a windows machine?
'sudo' is not recognized as an internal or external command,
operable program or batch file.
It turned out that I already had identically named file at destination. This caused the error. But Patrick W comment is very helpful
i was installing postgresql on ubuntu using linuxbrew:
brew install postgresql
it seems to work fine but after that because i was installing PostgreSQL for the first time i tried creating a database:
initdb /usr/local/var/postgres -E utf8
but it returned as:
initdb: command not found
i tried running the command with sudo but that doesn't helped
run locate initdb it should give you the list to chose. smth like:
MacBook-Air:~ vao$ locate initdb
/usr/local/Cellar/postgresql/9.5.3/bin/initdb
/usr/local/Cellar/postgresql/9.5.3/share/doc/postgresql/html/app-initdb.html
/usr/local/Cellar/postgresql/9.5.3/share/man/man1/initdb.1
/usr/local/Cellar/postgresql/9.6.1/bin/initdb
/usr/local/Cellar/postgresql/9.6.1/share/doc/postgresql/html/app-initdb.html
/usr/local/Cellar/postgresql/9.6.1/share/man/man1/initdb.1
/usr/local/bin/initdb
/usr/local/share/man/man1/initdb.1
So in my case I want to run
/usr/local/Cellar/postgresql/9.6.1/bin/initdb
If you don't have mlocate installed, either install it or use
sudo find / -name initdb
There's a good answer to a similar question on SuperUser.
In short:
Postgres groups databases into "clusters", each of which is a named collection of databases sharing a configuration and data location, and running on a single server instance with its own TCP port.
If you only want a single instance of Postgres, the installation includes a cluster named "main", so you don't need to run initdb to create one.
If you do need multiple clusters, then the Postgres packages for Debian and Ubuntu provide a different command pg_createcluster to be used instead of initdb, with the latter not included in PATH so as to discourage end users from using it directly.
And if you're just trying to create a database, not a database cluster, use the createdb command instead.
I had the same problem and found the answer here.
Ubuntu path is
/usr/lib/postgresql/9.6/bin/initdb
Edit: Sorry, Ahmed asked about linuxbrew, I'm talking about Ubuntu.
I Hope this answer helps somebody.
I had a similar issue caused by the brew install postgresql not properly linking postgres. The solve for me was to run:
brew link --overwrite postgresql
you can add the PATH to run from any location
sudo nano ~/.profile
inside nano go to the end and add the following
# set PATH so it includes user's private bin if it exists
if [ -d "/usr/lib/postgresql/14/bin/" ] ; then
PATH="/usr/lib/postgresql/14/bin/:$PATH"
fi
and configure the alternative
sudo update-alternatives --install /usr/bin/initdb initdb /usr/lib/postgresql/14/bin/initdb 1
I'm trying to install postgres on a sun solaris sparc instance in my home directory.
Everything is fine except when I try to start postgres server, I get the following error
FATAL: "/home/reic/var/lib/pgsql/data" is not a valid data directory
DETAIL: File "/home/reic/var/lib/pgsql/data/PG_VERSION" is missing.
I used the command pg_ctl -l logfile start to start the server.
I have followed all the necessary steps for installation on sun solaris.
Any idea as to why is this happening ?
Solution:
All the necessary files are there in the PGDATA directory and I ran it as the same user which is trying to start the server. The problem is with the placement of env variables in the .bashrc instead of .bash_profile file. Apparently the customisations are not propagated to sub shells when the env variables are put in .bashrc.
My bad for not realising this! Thank you all....