2016-04-06 24 views
1

我使用Elasticsearch的Titan 1.0.0。我有Titan(与DynamoDB后端)在EC2机器上工作。泰坦:从另一台机器连接到Elasticsearch

我的主要目标是通过另一台使用Java的EC2机器连接到那个Titan实例。

不幸的是我无法连接到这台机器。

我的Titan实例使用属性文件进行配置。这里是Elasticsearch配置的一个片段:

# elasticsearch config 
index.search.backend=elasticsearch 
index.search.directory=/path/to/elasticsearch 
index.search.elasticsearch.interface=NODE 
index.search.elasticsearch.ext.node.data=true 
index.search.elasticsearch.ext.node.client=false 
index.search.elasticsearch.ext.node.local=false 

这将启动一个完整的节点保存数据。

现在我想从另一台机器连接到此节点的Elasticsearch。为此我的配置文件是:

storage.backend= com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager 
storage.hostname=10.0.0.249 
storage.port=8182 

index.search.backend=elasticsearch 
index.search.elasticsearch.interface=TRANSPORT_CLIENT 
index.search.elasticsearch.ext.node.data=false 
index.search.elasticsearch.ext.node.client=true 
index.search.hostname=10.0.0.249:9200 


storage.dynamodb.client.endpoint=https://dynamodb.us-east-1.amazonaws.com 

## DynamoDB client configuration: credentials 
storage.dynamodb.client.credentials.class-name=com.amazonaws.auth.DefaultAWSCredentialsProviderChain 
storage.dynamodb.client.credentials.constructor-args= 

当我尝试使用Java通过这条线连接:

graph=TitanFactory.open("conf/dynamodb_remote.properties") 

我得到一个错误说:

java.lang.IllegalArgumentException: Could not instantiate implementation: com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex 
    at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:55) 
    at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:473) 
    at com.thinkaurelius.titan.diskstorage.Backend.getIndexes(Backend.java:460) 
    at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:147) 
    at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1805) 
    at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:123) 
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) 
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:62) 
    at com.thinkaurelius.titan.core.TitanFactory$open.call(Unknown Source) 
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) 
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) 
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122) 
    at groovysh_evaluate.run(groovysh_evaluate:3) 
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215) 
    at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:69) 
    at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:185) 
    at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:119) 
    at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:94) 
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) 
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207) 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130) 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150) 
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:123) 
    at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:58) 
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) 
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207) 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130) 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150) 
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:82) 
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215) 
    at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:144) 
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215) 
    at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:303) 
Caused by: java.lang.reflect.InvocationTargetException 
    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 com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:44) 
    ... 44 more 
Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] 
    at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:279) 
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:198) 
    at org.elasticsearch.client.transport.support.InternalTransportClusterAdminClient.execute(InternalTransportClusterAdminClient.java:86) 
    at org.elasticsearch.client.support.AbstractClusterAdminClient.health(AbstractClusterAdminClient.java:127) 
    at org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder.doExecute(ClusterHealthRequestBuilder.java:92) 
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91) 
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65) 
    at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:201) 
    ... 49 more 

我检查使用wget和似乎端口9200和9201正在工作,但9300不是。可能这就是问题存在的原因。

任何帮助?

回答

1

基于泰坦配置documentation

  1. index.search.hostname一对夫妇的建议,应该只是主机名或IP地址。它不应该包含端口。
  2. index.search.port如果您决定指定它,则应该使用9300或您的Elasticsearch的传输TCP端口值。
  3. index.search.elasticsearch.cluster-name应该匹配Elasticsearch配置中的cluster.name

更新:这似乎适用于我。在$TITAN_HOME/conf/mytitan.properties,我配置了索引后端这样的:

storage.backend=berkeleyje 
storage.directory=../db/mytitan/berkeleyje 
index.search.backend=elasticsearch 
index.search.index-name=mytitan 
index.search.elasticsearch.interface=NODE 
index.search.conf-file=mytitan-elasticsearch.yml 

然后$TITAN_HOME/conf/mytitan-elasticsearch.yml看起来完全像一个普通的ES配置:

cluster.name: TitanElasticsearch 
network.name: u1401 
network.host: 192.168.14.101 
discovery.zen.ping.multicast.enabled: false 
discovery.zen.ping.unicast.hosts: ["192.168.14.101"] 
discovery.zen.minimum_master_nodes: 1 
node.name: u1401 
node.master: true 
node.data: true 
http.port: 9200 
transport.tcp.port: 9300 
path.data: ./db/mytitan/elasticsearch 

当我试图指定这些属性的前缀index.search.elasticsearch.ext...,运输TCP端口没有像你之前提到的那样开始。

+0

问题是没有打开'9300'端口。我在gremlin-server计算机上用'netstat'进行了检查,但没有打开。只有'9200'和'9201'。 –

+0

默认情况下,端口范围是9300-9400。在执行'netstat -plent'时,通过pid匹配ES java进程并找出它正在使用的端口。 –

+0

ES正在监听两个端口'9200'和'9201'。他们都在监听HTTP请求。我想这与我配置gremlin-server的方式有关。你怎么看? –

相关问题