JanusGraph java连接访问

求知探索 1年前 ⋅ 891 阅读

JanusGraph通过java访问,如果cassandra和ElasticSearch的组合,需要将这两个组件设置允许外部网络访问。

Maven配置如下:

<dependency>
	<groupId>org.janusgraph</groupId>
	<artifactId>janusgraph-core</artifactId>
	<version>0.6.0</version>
</dependency>
<dependency>
	<groupId>org.janusgraph</groupId>
	<artifactId>janusgraph-cql</artifactId>
	<version>0.6.0</version>
</dependency>
<dependency>
	<groupId>org.janusgraph</groupId>
	<artifactId>janusgraph-es</artifactId>
	<version>0.6.0</version>
</dependency>
<dependency>
	<groupId>io.netty</groupId>
	<artifactId>netty-all</artifactId>
	<version>4.1.32.Final</version>
</dependency>

java连接方法如下:

JanusGraph jsGraph=JanusGraphFactory.build().set("storage.backend","cql")
				.set("storage.hostname", "192.168.X.X")
				.set("storage.port", "9042")
				.set("index.search.backend", "elasticsearch")
				.set("index.search.hostname", "192.168.X.X")
				.open();

storage.hostname为cassandra服务器ip

index.search.hostname为ElastciSearch服务器ip,可以设置多个,这样就实现了java到JanusGraph的连接


全部评论: 0

    我有话说: