Connecting Titan To Solr

断了今生、忘了曾经 提交于 2019-12-11 11:59:37

问题


I am trying to connect titan to solr. The properties file I am using is titan-cassandra-solr.properties :

index.search.backend=solr
index.search.solr.mode=cloud
index.search.solr.zookeeper-url=localhost:2181

I have configured my titan core to be:

name: titan instance: /opt/solr-titan/titan data: /opt/solr-titan/data

inside /opt/solr-titan/titan I have a conf directory which contains all the files I copied from titandb/conf/solr.

When I use gremlin.sh and try:

gremlin> graph = TitanFactory.open("conf/titan-cassandra-solr.properties")
==>standardtitangraph[cassandrathrift:[127.0.0.1]]
gremlin> graph.traversal().V()
==>v[4328]
gremlin> graph.traversal().V().has("MY_ID", "www.mindmaps.com/action-movie")
==>v[4328]
gremlin> graph.traversal().V().has("MY_ID", "action-movie")
gremlin> graph.traversal().V().has("MY_ID", "www.mindmaps.com/action-movie")
==>v[4328]

it all seems to be working but when I run:

TitanGraph titanGraph = TitanFactory.open("conf/titan-cassandra-solr.properties");

I get the following exception:

6:02:51,191  INFO ClientCnxn:975 - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
16:02:51,212  WARN ClientCnxn:1102 - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
    java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)

回答1:


I managed to get titan to talk to solr by doing the following:

Change my solr core. I simple ran solr by using solr start -e schemaless then I changed titan-cassandra-solr.properties to be:

index.search.backend=solr
index.search.solr.mode=http 
index.search.solr.zookeeper-url=http://localhost:8983/solr

Clean Titan. Run titan.sh stop followed by titan.sh clean

After this I was able to connect to Titan through my java code. I still need do more to get this working cloud mode but for now this seems to work.



来源:https://stackoverflow.com/questions/34726383/connecting-titan-to-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!