Configure Elastic search authentication at JanusGraph 0.2.1

410 Views Asked by At

I'm using JanusGraph 0.2.1 with Cassandra as backend and Elasticsearch 6.1 (have separate ES cluster and JanusGraph connect to it via http rest). With the Elasticsearch X-Pack security, I was able to enable authentication at my Elastic Search end. But I'm not able to configure the elasticsearch credential at JanusGraph configuration yaml.

In my janusgraph-cassandra-es-server.properties file in /var/janusgraph/conf/gremlin-server/ folder I have added the following configuration:

index.search.elasticsearch.client-only: true
index.search.elasticsearch.interface: REST_CLIENT
index.search.elasticsearch.ext.shield.user: <username>:<password>

I have followed this link to get the above-specified configuration.

When I start my JanusGraph, I'm getting the following error:

enter SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/var/janusgraph-0.2.0-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/janusgraph-0.2.0-hadoop2/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
0    [main] INFO  org.apache.tinkerpop.gremlin.server.GremlinServer  -
    \,,,/
    (o o)
-----oOOo-(3)-oOOo-----
95   [main] INFO  org.apache.tinkerpop.gremlin.server.GremlinServer  - Configuring Gremlin Server from conf/gremlin-server/gremlin-server.yaml
156  [main] INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager  - Configured Metrics ConsoleReporter configured with report interval=180000ms
158  [main] INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager  - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
197  [main] INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager  - Configured Metrics JmxReporter configured with domain= and agentId=
199  [main] INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager  - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
550  [main] INFO  com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager  - Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=ClusterJanusGraphConnectionPool,ServiceType=connectionpool
559  [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - AddHost: janusgraph-1675467593-cassandra
623  [main] INFO  com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager  - Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=KeyspaceJanusGraphConnectionPool,ServiceType=connectionpool
623  [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - AddHost: janusgraph-1675467593-cassandra
641  [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - AddHost: 10.10.18.47
641  [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - RemoveHost: janusgraph-1675467593-cassandra
898  [main] INFO  org.janusgraph.core.util.ReflectiveConfigOptionLoader  - Loaded and initialized config classes: 13 OK out of 13 attempts in PT0.194S
964  [main] INFO  org.reflections.Reflections  - Reflections took 40 ms to scan 2 urls, producing 0 keys and 0 values
1034 [main] INFO  org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration  - Generated unique-instance-id=0a021b061-janusgraph-1675467593-5f598b9b4f-jqtz81
1040 [main] INFO  com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager  - Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=ClusterJanusGraphConnectionPool,ServiceType=connectionpool
1040 [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - AddHost: janusgraph-1675467593-cassandra
1043 [main] INFO  com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager  - Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=KeyspaceJanusGraphConnectionPool,ServiceType=connectionpool
1043 [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - AddHost: janusgraph-1675467593-cassandra
1050 [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - AddHost: 10.10.18.47
1050 [main] INFO  com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor  - RemoveHost: janusgraph-1675467593-cassandra
1060 [main] INFO  org.janusgraph.diskstorage.Backend  - Configuring index [search]
1381 [main] WARN  org.janusgraph.diskstorage.es.rest.RestElasticSearchClient  - Unable to determine Elasticsearch server version. Default to FIVE.
org.elasticsearch.client.ResponseException: GET http://janusgraph-1675467593-elasticsearch-client:9200/: HTTP/1.1 401 Unauthorized
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication token for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication token for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:354)
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:343)
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119)
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177)
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326)
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
at java.lang.Thread.run(Thread.java:748)
1390 [main] WARN  org.apache.tinkerpop.gremlin.server.GremlinServer  - Graph [graph] configured at [conf/gremlin-server/janusgraph-cassandra-es-server.properties] could not be instantiated and will not be available in Gremlin Server.  GraphFactory message: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:82)
at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:70)
at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:104)
at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.lambda$new$0(DefaultGraphManager.java:57)
at java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:55)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:110)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:89)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:110)
at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:354)
Caused by: java.lang.reflect.InvocationTargetException

As you can see, JanusGraph at startup tries to check connectivity to the elastic-search client by checking the cluster health status but since Janusgraph is not able to add authentication header to the ES cluster status request, its getting blocked.

Please let me know how to fix it. (I'm looking for a solution that doesn't include JanusGraph upgrade)

Thanks in advance.

0

There are 0 best solutions below