知识图谱与图数据库

janusgraph 默认server使用手记

2019-06-28  本文已影响0人  水他

启动server(with Cassandra/ES)

janusgraph-0.3.0-hadoop2 bin/janusgraph.sh start
Forking Cassandra...
Running `nodetool statusthrift`. OK (returned exit status 0 and printed string "running").
Forking Elasticsearch...
Connecting to Elasticsearch (127.0.0.1:9200)...... OK (connected to 127.0.0.1:9200).
Forking Gremlin-Server...
Connecting to Gremlin-Server (127.0.0.1:8182)...... OK (connected to 127.0.0.1:8182).
Run gremlin.sh to connect.

测试(用:remote用连接,用:>提交命令)

janusgraph-0.3.0-hadoop2 bin/gremlin.sh

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/didi/Softwares/bigdata/janusgraph-0.3.0-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/didi/Softwares/bigdata/janusgraph-0.3.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]
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
16:22:13 WARN  org.apache.hadoop.util.NativeCodeLoader  - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182
gremlin> :> graph.addVertex("name", "stephen")
==>v[4184]
gremlin> :> g.V().values('name')
==>stephen

session测试

gremlin> :remote connect tinkerpop.server conf/remote.yaml session
==>Configured localhost/127.0.0.1:8182-[710a60e5-a2eb-4fb1-a59d-5025e0445e06]
gremlin> graph = EmptyGraph.instance()
==>emptygraph[empty]
gremlin> g = graph.traversal().withRemote("remote-graph.properties")
==>graphtraversalsource[emptygraph[empty], standard]
gremlin> herculesAge = g.V().has("name", "stephen").values("name").next()
==>stephen
gremlin> g.V().values('name')
==>stephen
==>stephen

关闭和清理

➜  janusgraph-0.3.0-hadoop2 bin/janusgraph.sh stop
Killing Gremlin-Server (pid 68363)...
Killing Elasticsearch (pid 68310)...
Cassandra (org.apache.cassandra.service.CassandraDaemon) not found in the java process table
➜  janusgraph-0.3.0-hadoop2 bin/janusgraph.sh clean
Are you sure you want to delete all stored data and logs? [y/N] y
Deleted data in /Users/didi/Softwares/bigdata/janusgraph-0.3.0-hadoop2/db
Deleted logs in /Users/didi/Softwares/bigdata/janusgraph-0.3.0-hadoop2/log
上一篇下一篇

猜你喜欢

热点阅读