graphaware / neo4j-to-elasticsearch

GraphAware Framework Module for Integrating Neo4j with Elasticsearch
261 stars 57 forks source link

Shield Authentication Error #117

Closed jlondrejcka closed 6 years ago

jlondrejcka commented 6 years ago

I have included the username and password for shield, however I am still getting an error when creating the node and relationship index on db startup as follow:

2018-05-11 17:31:36.455+0000 INFO  Starting Elasticsearch Writer...
2018-05-11 17:31:36.459+0000 INFO  Creating Jest Client...
2018-05-11 17:31:36.460+0000 INFO  Enabling Auth for ElasticSearch: neo4j
2018-05-11 17:31:36.662+0000 INFO  Created Jest Client.
2018-05-11 17:31:36.936+0000 INFO  Index neo4j-index-node does not exist in ElasticSearch, creating...
2018-05-11 17:31:36.975+0000 ERROR Failed to create ElasticSearch index. Details: {"root_cause":[{"type":"security_exception","reason":"action [indices:admin/create] requires authentication","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"action [indices:admin/create] requires authentication","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}
2018-05-11 17:31:36.982+0000 INFO  Index neo4j-index-relationship does not exist in ElasticSearch, creating...
2018-05-11 17:31:37.014+0000 ERROR Failed to create ElasticSearch index. Details: {"root_cause":[{"type":"security_exception","reason":"action [indices:admin/create] requires authentication","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"action [indices:admin/create] requires authentication","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}
2018-05-11 17:31:37.014+0000 INFO  Started Elasticsearch Writer.

I have the following added to the config file:

`#optional, specify the Shield user com.graphaware.module.ES.authUser=neo4j

optional, specify the Shield password

com.graphaware.module.ES.authPassword=***`

I am not sure what the issue may be, any help is much appreciated.

ikwattro commented 6 years ago

Hi @jlondrejcka Can you check if this solves your issue :

https://github.com/graphaware/neo4j-to-elasticsearch/issues/106#issuecomment-367941491

jlondrejcka commented 6 years ago

Hi @ikwattro, I believe it is working, however, now I am getting a

Unable to bootstrap module 2 Unable to read json mapping file java.lang.RuntimeException: Unable to read json mapping file

ikwattro commented 6 years ago

Do you have well a mapping.json file in your import directory of Neo4j ?

jlondrejcka commented 6 years ago

@ikwattro no, given a configuration limitation I have, I will need to upload it to my plugins directory. could I reference plugin/mapping.json instead?

ikwattro commented 6 years ago

It was not possible until 2 minutes ago.

Please use this snapshot, I tested locally but please confirm on your side. Thanks.

https://www.dropbox.com/s/ci6xqgzw75fniao/graphaware-neo4j-to-elasticsearch-3.3.3.52.9-SNAPSHOT.jar?dl=0

ikwattro commented 6 years ago
com.graphaware.module.ES.file=plugins/mapping.json

is an example, should be relative to the neo4j home directory

jlondrejcka commented 6 years ago

@ikwattro thank you very much, appears to be working locally as well!

jlondrejcka commented 6 years ago

@ikwattro Quick Question: Where did you update the code for the referenced file? I need to remove an extra 'server' reference to work on my GrapheneDB instance.

Error:

java.io.FileNotFoundException: /srv/neo4j.server/plugins/5af6112ee4b02c2517490a91/mapping.json (No such file or directory)

Actual file location: /srv/neo4j.plugins/5af6112ee4b02c2517490a91/mapping.json

I need to remove the 'server' after '/srv/neo4j.'

Thanks so much!

ikwattro commented 6 years ago

Ok, I think the use case is special because of linkings on the OS. I will make a new modification to the plugin where you can specify the full path. We have another plugin with that use case and we tested it on graphenedb with their support. Gimme a couple of hours and you’ll get it.

On Mon, 14 May 2018 at 17:50, Joe Ondrejcka notifications@github.com wrote:

@ikwattro https://github.com/ikwattro Quick Question: Where did you update the code for the referenced file? I need to remove an extra 'server' reference to work on my GrapheneDB instance.

Error:

java.io.FileNotFoundException: /srv/neo4j.server/plugins/5af6112ee4b02c2517490a91/mapping.json (No such file or directory)

Actual file location: /srv/neo4j.plugins/5af6112ee4b02c2517490a91/mapping.json

I need to remove the 'server' after '/srv/neo4j.'

Thanks so much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/graphaware/neo4j-to-elasticsearch/issues/117#issuecomment-388866433, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKleZdS4aqUYWGXbiQTJnfxuobT1Bhcks5tyaeygaJpZM4T70i5 .

-- Christophe Willemsen | Graph Aware Limited

Phone: +44 (0) 333 444 7274 <javascript:void(0);> | Mobile: +32 (0) 489 687 208 <javascript:void(0);> christophe@graphaware.com | @graph_aware | www.graphaware.com

jlondrejcka commented 6 years ago

@ikwattro thank you for the quick response and support!

ikwattro commented 6 years ago

@jlondrejcka Actually, with the current code, it should work if you provide the full path to the file.

ClassPathResource classPathResource = new ClassPathResource(config.get(FILE_PATH_KEY));
            String file = null; 
            if(classPathResource.exists()){
                file = classPathResource.getFile().getAbsolutePath();
            } else if (config.get(FILE_PATH_KEY).contains(File.separator)){
                file = config.get(NEO4j_HOME) + File.separator + config.get(FILE_PATH_KEY);
            } else {
                file = config.get(NEO4j_HOME) + File.separator + NEO4j_CONF_DIR + File.separator + config.get(FILE_PATH_KEY);
            }

Can you try with such config please :

com.graphaware.module.ES.file=/srv/neo4j.plugins/5af6112ee4b02c2517490a91/mapping.json

I will reach out to the GrapheneDB guys to know if there is a symlink to this directory we could re-use.

jlondrejcka commented 6 years ago

@ikwattro I just tried and got the following error:

Caused by: java.io.FileNotFoundException: /srv/neo4j.server/conf/srv/neo4j.plugins/5af6112ee4b02c2517490a91/mapping.json (No such file or directory)

ikwattro commented 6 years ago

Thanks, I might have to do a small modification then, incoming...

ikwattro commented 6 years ago

@jlondrejcka Please test this version https://www.dropbox.com/s/9nacj5roxlhb4vr/graphaware-neo4j-to-elasticsearch-3.3.3.52.9-SNAPSHOT.jar?dl=0

jlondrejcka commented 6 years ago

@ikwattro you are awesome, thank you very much! I did not receive an errors in start-up.

Both these cypher queries work in neo4j:

CALL ga.es.initialized() YIELD status RETURN status and CALL ga.es.info() YIELD json as info return info

When I call the mapping query: CALL ga.es.nodeMapping() YIELD json as mapping RETURN mapping

I get: Failed to invoke procedurega.es.nodeMapping: Caused by: java.lang.NullPointerException

Could this be, because I am mapping all nodes? { "defaults": { "key_property": "uuid", "nodes_index": "default-index-node", "relationships_index": "default-index-relationship", "include_remaining_properties": true }, "node_mappings": [ { "condition": "allNodes()", "type": "nodes" } ], "relationship_mappings": [ { "condition": "allRelationships()", "type": "relationships" } ] }

ikwattro commented 6 years ago

@jlondrejcka Yeah this procedure is broken, we have an open issue for this.

My recommendation is to not pass via neo4j for configuring or checking ES configuration, you can just call the ES endpoints dedicated for this.

jlondrejcka commented 6 years ago

@ikwattro thank you. Ill work on queries from ES. Typically how long does it take for neo4j to start sending over data?

ikwattro commented 6 years ago

it should start immediately. You should see some outputs in the neo4j log about the replication.

On Tue, 15 May 2018 at 02:01, Joe Ondrejcka notifications@github.com wrote:

@ikwattro https://github.com/ikwattro thank you. Ill work on queries from ES. Typically how long does it take for neo4j to start sending over data?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/graphaware/neo4j-to-elasticsearch/issues/117#issuecomment-389000128, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKlecrpN4kuVJYdATshTjSl01zwK-6fks5tyhrxgaJpZM4T70i5 .

-- Christophe Willemsen | Graph Aware Limited

Phone: +44 (0) 333 444 7274 <javascript:void(0);> | Mobile: +32 (0) 489 687 208 <javascript:void(0);> christophe@graphaware.com | @graph_aware | www.graphaware.com

ikwattro commented 6 years ago

Hi @jlondrejcka

How are things going ?

jlondrejcka commented 6 years ago

Hi @ikwattro!

Thanks for following up. Index's were created, however, I have not received any data in ES yet.

Do you recommend anything to help trigger a push to ES, from graphaware? As I mentioned earlier, I used the all nodes config in the mapping.json.

Thanks,

Joe

ikwattro commented 6 years ago

@jlondrejcka Do you mind sending me your e-mail to christophe (at) graphaware (dot) com

If you have access to your logs, please send me those. I will also coordinate with GrapheneDB to debug the issue.

Thanks

ikwattro commented 6 years ago

Also, please send me your neo4j configuration