Neo4J web console has stats for my embedded data, but cannot query it - neo4j

I'm currently evaluating Neo4J (2.0M3), and in an attempt to get some kind of visualisation and query-exploration (I haven't succeeded yet!), I switched from using the Test DB to an Embedded DB, and have a Server that I can start up when required.
I understand how to get my node and relationship data written to the data directory of my choice (via How to explore databases created by an embedded-Neo4j Java application and stored outside the /data directory?), and how to configure the Server/web console to point to that directory. Sure enough, the Dashboard does show the data counts I expect, but no Cypher query I try - not even the ones that work fine in my unit tests - return any nodes. Simple lookups by name and Id all fail.
Can anyone explain the inconsistency? This happens with a vanilla Server install, with data written to the default graph.db directory, as well as with different directories. The paths under 'Server Info' are all what I expetc to see.
Another thing I don't understand: why can I not have my own Server running, and create a GraphDatabaseFactory/GraphDatabaseService in code that will accept a server URI, which will allow me to use the standard Java API and see live updates in the web console without having to stop/start the server each time?

You can set up your embedded java project to even start a server, see http://www.cakesolutions.net/teamblogs/2012/05/23/enabling-neo4j-web-admin-tool-on-the-embedded-server-using-spring-data/

Related

Neo4J Connection issues to local project

I am really sorry to ask a simple question like this, but it is getting frustrating. I installed neo4j 4.0.4 on my Windows machine, created a new project as shown in the official tutorial video and set a password for my local graph. Funnily, the tutorial video ends after setting the password and opening the browser not showing how to perform Cypher queries on this newly created database. In neo4j Desktop my database is shown correctly and it seems to be up and running.
However, when I try to connect to this database via the browser, I do not see the database at all. It is so confusing when connecting to the server to specify a username and password, if you only need to set a password for your database?! The default neo4j user can see the system and default database but not my project database. In addition, I cannot link files from the project directory in Cypher queries. I tried to disable authentication, but it did not help at all.
When I issue SHOW DATABASES command, it does not list my database as well.
Update / Edit:
Seems I misunderstood the concept of projects. Every database is named neo4j - default, regardless of the name specified in the project ?!. However, I still cannot access project files. So far, I copied the files manually in the database directory under "imports". But I guess that is not the intended way.
After importing data to this default database, it still shows no data in the project itself.
Data files in the imports directory are not automatically imported into the DB. That is because neo4j has no idea how you want to store that data as nodes and relationships.
So, it is up to you to determine your desired data model, and then write the appropriate code to enforce that data model.
You can take a look at this page to learn about how to import CSV data (probably the most commonly used import data format).

Cosmos DB and Azure.iOS data query issues

I'm fairly new to Cosmos DB so for starters I created a MongoDB based instance. I then wanted to add a document to it, just as a "Hello World" test. I'm using a self made iOS app for this which uses the official Azure.iOS library from GitHub.
Once I run the "create" command (with the proper collection id set) on AzureData the framework returns me a "success" inside the response with a resource id etc. However once I use an external tool such as Robo3T or the mongo shell the given collection is said to be empty, or returns this error:
{"code":400,"body":"Command find failed: Unknown server error occurred when processing this request.."}
The connection to the DB however is successful since I can display the collection stats and so on.
Now if I open my app again and query the collection documents through the Azure.iOS framework it returns me the result I just saved. This makes me feel a bit puzzled. Did I miss doing something inside the app, or do all MongoDB tools fail listing the documents? The documentation for the framework is rather sparse so any help would be appreciated.
Actually the issue that happened for me is very hard to debug. Since the error messages don't tell anything.
My Cosmos DB is using the MongoDB backend which seems to create issues together with the mentioned Azure.iOS framework.
The issue is further described here:
Cosmos Mongodb query fails but azure storage explorer works fine?
TL;DR what happened is that the iOS framework was not creating a "_id" which is necessary for MongoDB and that lead to corrupted data. I had to switch from MongoDB to the SQL backend. This solved my issue and now everything works fine.

How to make documents added to an embedded Solr Server with SolrJ visible to a http Solr query

We have a GRAILS / SOLR application that uses a SOLRJ EmbeddedSolrServer to add / retrieve data. The application is also set up to be accessible by http.
When I index documents by http I can reload the SOLR core and the changes are now visible to the Embedded Server.
However when I add documents by using the EmbeddedSolrServer the records are not visible using http unless I restart SOLR itself.
The records are visible to queries using the Embedded Server at this point.
I've tried running reload core commands via curl and the SOLR admin interface but the docs remain hidden until I restart.
Has anyone any idea how I can make these records visible via http without restarting SOLR?
Thanks for your help.
SOLR is 2.1.0
Grails is 2.4.2
We're running on OS X 10.10.5
There's no difference between getting results via http or directly from the embedded server.
When you restart solr, you trigger a hard commit so the cache is flushed and the reader picks up the updated index. So I believe you have 2 options:
Change the solrconfig.xml to trigger a hard commit after a given period of time or after a given number of documents;
Trigger the hard commit using SolrJ.
You can find more info about differences between hard and soft commit here.
Please check this answer for a concrete example including SolrJ and config.

browsing distinct Neo4j databases in the same machine

I am experimenting with several Neo4j databases in my machine. The databases have been generated and populated from Java programs.
Now I would like to inspect them.
It seems that the recommended way is to open the web console so it points to a specific database by means of configuring the property:
org.neo4j.server.database.location=<database location path>
in the neo4j configuration file: conf/neo4j-server.properties
This if fine if I am only interested in one database. But it does not look like a good idea if I am switching often between databases or if I want to explore more than one at the same time.
Is it possible to configure distinct web consoles (maybe using distinct ports) so they refer to my distinct databases?
And is it possible to do this without installing several instances (binaries) of Neo4j in my machine and having to modify lots of configuration files?
Yes! If you edit that same conf/neo4j-server.properties file you can change the org.neo4j.server.webserver.port and org.neo4j.server.webserver.https.port values (I normally set the https port to one less than the http port).
Once you've done that you run ./bin/neo4j start (make sure you shut down your Java app which is accessing the database first) to start the server on that port and then simply visit http://localhost:<port>
I'm not 100% sure if generating the database from Java will generate everything that you need for running a server. If not you can download Neo4j from http://neo4j.com/download/, make multiple copies of it, and replace the graph.db folder with yours one (make sure you shut down any processes which are accessing those databases before copying the directory). Also if you've downloaded a newer version you might need to set allow_store_upgrade=true (see: http://neo4j.com/docs/stable/deployment-upgrading.html)
You can have multiple Embedded Neo4j databases without installing separate binaries. You just need to be configure the different database path for each instance of the database.

Migrating .NET Database to Shared Hosting

Built an app locally with an EF code-first database - not sure how to upload it to a shared hosting environment such as GoDaddy. It makes sense that something would be amiss because on the shared hosting your code can't just go create a database, but on the flip side I can't find anything to copy the CREATE sql and create it on the server like you would with MySQL
Feel a little silly because I've been using .NET for over a year now but at work the databases are already set up and we have full control over our environments.
If the database has no data that you need to preserve the easiest method is just to install the app on the new host and set the connection string to your new database on the host. On the first attempt to load a page accessing the database, the database will automatically be created (note that you need to load a page which hits the database - sometimes the home page is not sufficient).
This method is a lot more straightforward than generating SQL and then executing it on the production database.
If there is data that you need to preserve then the best method will be taking a backup and installing the backup on the host. In SSMS simply right-click the database in the left pane, then Tools > Backup... To restore on the server connect to the server in SSMS and right-click the 'Database' node in the left panel and select 'Restore Database...' I'm not sure if the host provides a direct connection from SSMS but they should at a minimum have a mechanism to restore a .bak file.
Going forward you should ensure that you can execute SQL on your database as a very convenient method for deploying EF Migrations is to generate the SQL update script on the development server and then deploy this by executing it in production.
Depending on your web host, you may be able to restore the database. If this is an option, simply back up your database on your local machine and restore it on the server via the management console.
You can back up your local database using SQL Server Management Console. This works well even for larger databases as you can directly restore all your data, your schema, etc.
I've had experience with three different hosts so far and all of them have this as an option. You'll usually find this under the Database tab for the web site. The rest from there is up to you because it's usually different across the various hosts.

Resources