How to start neo4j server from a given data path - neo4j

As the title says out loud.
How to start neo4j server with pure
$ neo4j start
I have trying to edit dbms.directories.data in the conf/neo4j.conf and it didn't work out.
I was using
"neo4j_version" : "3.0.0"

Related

How to remove neo4j COMPLETE?

Installing neo4j at arch with yay -S neo4j-community and starting with systemctl start neo4j I open http://localhost:7474/browser/ and execute the demo command create database movies but I get the error
Neo.ClientError.Statement.NotSystemDatabaseError
Unsupported administration command: CREATE DATABASE movies
because of desperation I tried to remove neo4j completely but he still "remembers" my initial password and also still has a reference to graph.db that I have removed manually in the menubar.
Where are the files neo4j stores and does someone have idea to fix the problem with the database creation?

How to Load Cypher File into Neo4j

I have generated a cypher file and want to load it into neo4j.
The only relevant documentation I could find was about loading csv's.
I also tried the shell but it seems to have no effect
cypher-shell.bat -uneo4j -pne04j < db.cql
Copy paste into localhost:7474/browser makes the browser unresponsive.
In the current Neo4j version you can use Cypher Shell to achieve your goal.
From the docs, Invoke Cypher Shell with a Cypher script from the command line:
$ cat db.cql | bin/cypher-shell -u yourneo4juser -p yourpassword
Note that this example is based in a Linux instalation. If you are using Neo4j with Windows, you will need to adjust this command to your needs.
Not sure when this has been added but in the current version (4.4) an alternative way to load a cypher file to NEO4J (GUI) is by dragging and dropping the cypher file over the web browser, which then offers two options, either to add it to the favorites or to paste it in the editor.

Connect to heroku apps mongodb (compose) on terminal

I have inherited a Ruby on rails app, which runs on Heroku and has a compose mongoDB. To be clear I have never used ruby, mongo or Heroku and its been a massive learning curve.
I essentially want to get a copy running locally, but more importantly I want to pull down and export the data that is in the db at the moment.
I have installed the latest version of Heroku Toolbelt and I have installed the latest version on mongodb, which also included all 4 packages. Im running this locally on Ubuntu 14 lts.
The documentation I do have says to run this command to log into the db
mongodb://heroku:password-string#tempest.mongohq.com:10098/appid
But if I run just the above it says no such file or directory, if I add 'mongo' onto the beginning then it seems to work but throws the following error
E QUERY Error: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']'; heroku:password-string#tempest.mongohq.com:10098
I did try running it wrapped in [] too.
This is just getting in so I can then export the data locally and then try to look at it.
The command-line mongo tool doesn't understand URLs, so try this instead:
mongo -u heroku -p password-string tempest.mongohq.com:10098/appid
Also I'm pretty sure you can leave off the -p password-string and it will prompt you for it, so you can avoid revealing it in ps output etc.

Could not connect to a primary node for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]>

I'm following though with the RailsApp tutorial with Devise and Mongoid (http://railsapps.github.io/tutorial-rails-mongoid-devise.html) and am encountering the following error when I get to 'Rake db:seed' down at the 'Set Up a Database Seed File' section.
Could not connect to a primary node for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]>
I've tried the instructions from nixoncd on this page here but has not fixed the issue. It tells me 'file exists' and 'Already loaded'. 'https://groups.google.com/forum/#!topic/mongodb-user/Hhh8iNCciMk
I get this if I type 'mongod' in terminal.
ERROR: could not read from config file
Any help welcome. I'm on a Mac OSX Mountain Lion with Mongoid installed using homebrew - though MongoDB was installed using the download package mongodb.org.
MongoDB shell version: 2.4.6
Thanks
EDIT: I'm not sure if this issue is related or not. Also having issues launching mongoDB. Also posted issue here:
mongoDB, could not read from config file -- config in different folder / Uninstall it?
First See if your database is running by mongo , If yes
Use this command:
sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongodb start
Your database will work.
Installing MongoDB solved this for me:
sudo apt-get install mongodb-server
The answers above will work for you in the majority of the cases where this error occurs.
However, I would like to note that you can also get the Could not connect to a primary node for replica set error when trying to write exceptionally large batches of records to MongoDB in one request. I have encountered this error when writing more than 200,000 1 KB documents to a remote MongoDB server with in one request. The remote server had 8 GB memory and would handle several requests at once. This error can be avoided by cutting down the batch size of your requests.

How to browse data in MongoDB in Mac OS?

When I am using PostgreSQL, I am accustomed to use terminal for browsing data stored in DB tables.
Is there any similar way to do it for MongoDB? I have used this topic for MongoDB installation on Mac.
Thanks
MongoDB bin directory contains an executable called 'mongo' which is an interactive shell (similar to 'psql' in PostgreSQL)
You can read more about how to use it HERE.
To get started, you can type
> help
To switch to a specific database, just type:
> use db-name
^^^^^^^ replace with your db name.
> db.help()
> db.collectionName.help()
^^^^^^^^^^^^^^ replace with your collection name
You can do this from any machine not just the one mongod is running on but then you connect via:
mongo hostname:port/dbname
for example
mongo myMongoDBserver:27017/foobardb
First start mongod process in a terminal tab. In other terminal tab or window simply start mongo.
mongod is mongo daemon which establishes connections and listens to requests. mongo is the javascript shell where you can have your interactive mongodb queries.
Rest is best explained in the link #Asya Kamsky provided in his answer.
command 'mongo' will open mongo shell for you, there you can use database commands

Resources