JanusGraph 服务器-配置ConfiguredGraphFactory

一、配置properties

/path/to/janusgraph-0.5.2/customConfig/janusgraph-hbase-es-configurationgraph.properties(根据实际情况修改路径)

gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory

storage.backend=hbase
graph.graphname=ConfigurationManagementGraph
storage.hostname=127.0.0.1

# 这个参数批量导入需要设置
# 注意:若设置该值为true,则需要先建立Schema。
#storage.batch-loading =true
#schema.default=none
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.5

index.search.backend=elasticsearch
index.search.hostname=159.75.113.176:9200
index.search.elasticsearch.http.auth.basic.username=admin
index.search.elasticsearch.http.auth.basic.password=admin
index.search.elasticsearch.http.auth.type=basic

# 这个参数 经过调试,这个值比较合理
ids.block-size=20000000
ids.renew-timeout=3600000
storage.buffer-size=20240
# 设置id块的大小
# 在尝试获取新的id块之前,JanusGraph的id池管理会等待的毫秒。
# the number of milliseconds JanusGraph’s id pool manager will wait in total while attempting to acquire a new id block before failing
# 使插入数据更 robust
storage.read-attempts=100
storage.write-attempts=100
storage.attempt-wait=1000
# 在重新尝试失败的后端操作之前将等待的毫秒数

二、配置yaml

/path/to/janusgraph-0.5.2/customConfig/gremlin-server-hbase-es-configuration.yaml(根据实际情况修改路径)

host: 127.0.0.1
port: 8182
scriptEvaluationTimeout: 100000
channelizer: org.janusgraph.channelizers.JanusGraphWsAndHttpChannelizer
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
  ConfigurationManagementGraph: customConfig/janusgraph-hbase-es-configurationgraph.properties
}
scriptEngines: {
  gremlin-groovy: {
    plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
               org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: []}}}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  # Older serialization versions for backwards compatibility:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
  - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000},
  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
  graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
# 网络发送缓冲区中的最高字节数,超过此限制,则该通道不再进行写操作,直到缓冲区小于writeBufferLowWaterMark。
# 20971520 Bytes = 20 MB
writeBufferHighWaterMark: 20971520

三、启动

cd /path/to/janusgraph-0.5.2
nohup ./bin/gremlin-server.sh ./customConfig/gremlin-server-hbase-es-configuration.yaml > janusgraph.log &

四、使用


bin/gremlin.sh
gremlin> :remote connect tinkerpop.server conf/remote.yaml session
gremlin> :remote console
gremlin> map = new HashMap<String, Object>();
gremlin> map.put("storage.backend", "hbase");
gremlin> map.put("storage.hostname", "127.0.0.1");
gremlin> map.put("storage.hbase.table", "graph1");
gremlin> map.put('index.search.backend', 'elasticsearch'); 
gremlin> map.put('index.search.hostname', '127.0.0.1:9200'); 
gremlin> map.put('index.search.elasticsearch.http.auth.basic.username', 'admin'); 
gremlin> map.put('index.search.elasticsearch.http.auth.basic.password', 'admin'); 
gremlin> map.put('index.search.elasticsearch.http.auth.type', 'basic');
gremlin> map.put('index.search.index-name', 'graph1'); 
gremlin> map.put("graph.graphname", "graph1");
gremlin> ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));
gremlin> ConfiguredGraphFactory.open("graph1");

五、查看Hbase


cd /path/to/hbase-2.1.5
./bin/hbase shell
hbase(main):001:0> list
TABLE                                                                                                                                                                                                                                                                                                                                                                                           
ConfigurationManagementGraph                                                                                                                                                                      
graph1                                                                                                                                                                                         
2 row(s)
Took 0.7618 seconds                                                                                                                                                                               
=> ["ConfigurationManagementGraph", "graph1"]
#删除图"graph1"
hbase(main):001:0> disable "graph1"
hbase(main):001:0> drop "graph1"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值