# host and port of gremlin server, need to be consistent with host and port in rest-server.properties#host: 127.0.0.1#port: 8182# Gremlin 查询中的超时时间(以毫秒为单位)evaluationTimeout:30000channelizer:org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer# 不要在此处设置图形,此功能将在支持动态添加图形后再进行处理graphs:{}scriptEngines:{gremlin-groovy:{staticImports:[org.opencypher.gremlin.process.traversal.CustomPredicates.*',org.opencypher.gremlin.traversal.CustomFunctions.*],plugins:{org.apache.hugegraph.plugin.HugeGraphGremlinPlugin:{},org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin:{},org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin:{classImports:[java.lang.Math,org.apache.hugegraph.backend.id.IdGenerator,org.apache.hugegraph.type.define.Directions,org.apache.hugegraph.type.define.NodeRole,org.apache.hugegraph.masterelection.GlobalMasterInfo,org.apache.hugegraph.util.DateUtil,org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser,org.apache.hugegraph.traversal.algorithm.CountTraverser,org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,org.apache.hugegraph.traversal.algorithm.HugeTraverser,org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,org.apache.hugegraph.traversal.algorithm.KneighborTraverser,org.apache.hugegraph.traversal.algorithm.KoutTraverser,org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,org.apache.hugegraph.traversal.algorithm.PathsTraverser,org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,org.apache.hugegraph.traversal.algorithm.steps.EdgeStep,org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,org.apache.hugegraph.traversal.optimize.ConditionP,org.apache.hugegraph.traversal.optimize.Text,org.apache.hugegraph.traversal.optimize.TraversalUtil,org.opencypher.gremlin.traversal.CustomFunctions,org.opencypher.gremlin.traversal.CustomPredicate],methodImports:[java.lang.Math#*,org.opencypher.gremlin.traversal.CustomPredicate#*,org.opencypher.gremlin.traversal.CustomFunctions#*]},org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin:{files:[scripts/empty-sample.groovy]}}}}serializers:- {className:org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,config:{serializeResultToString:false,ioRegistries:[org.apache.hugegraph.io.HugeGraphIoRegistry]}}- {className:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,config:{serializeResultToString:false,ioRegistries:[org.apache.hugegraph.io.HugeGraphIoRegistry]}}- {className:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,config:{serializeResultToString:false,ioRegistries:[org.apache.hugegraph.io.HugeGraphIoRegistry]}}- {className:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,config:{serializeResultToString:false,ioRegistries:[org.apache.hugegraph.io.HugeGraphIoRegistry]}}metrics:{consoleReporter:{enabled:false, interval:180000},csvReporter:{enabled:false, interval:180000, fileName:./metrics/gremlin-server-metrics.csv},jmxReporter:{enabled:false},slf4jReporter:{enabled:false, interval:180000},gangliaReporter:{enabled:false, interval:180000, addressingMode:MULTICAST},graphiteReporter:{enabled:false, interval:180000}}maxInitialLineLength:4096maxHeaderSize:8192maxChunkSize:8192maxContentLength:65536maxAccumulationBufferComponents:1024resultIterationBatchSize:64writeBufferLowWaterMark:32768writeBufferHighWaterMark:65536ssl:{enabled:false}
# bind url# could use '0.0.0.0' or specified (real)IP to expose external network accessrestserver.url=http://127.0.0.1:8080#restserver.enable_graphspaces_filter=false# gremlin server url, need to be consistent with host and port in gremlin-server.yaml#gremlinserver.url=127.0.0.1:8182graphs=./conf/graphsgraph.load_from_local_config=true# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0batch.max_write_ratio=80batch.max_write_threads=0# configuration of arthasarthas.telnetPort=8562arthas.httpPort=8561arthas.ip=127.0.0.1arthas.disabledCommands=jad# authentication configs#auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator# for admin password, By default, it is pa and takes effect upon the first startup#auth.admin_pa=pa#auth.graph_store=hugegraph# use pd# usePD=true# slow query loglog.slow_query_threshold=1000# bytes of request body recorded as-is (may contain sensitive literals), 0 to disablelog.slow_query_body_limit=512# jvm(in-heap) memory usage monitor, set 1 to disable itmemory_monitor.threshold=0.85memory_monitor.period=2000
restserver.url:RestServer 提供服务的 url,根据实际环境修改。如果其他 IP 地址无法访问,可以尝试修改为特定的地址;或修改为 http://0.0.0.0 来监听来自任何 IP 地址的请求,这种方案较为便捷,但需要留意服务可被访问的网络范围;
# gremlin entrance to create graph# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxygremlin.graph=org.apache.hugegraph.HugeFactory# cache config#schema.cache_capacity=100000# vertex-cache default is 1000w, 10min expiredvertex.cache_type=l2#vertex.cache_capacity=10000000#vertex.cache_expire=600# edge-cache default is 100w, 10min expirededge.cache_type=l2#edge.cache_capacity=1000000#edge.cache_expire=600# schema illegal name template#schema.illegal_name_regex=\s+|~.*#vertex.default_label=vertex# NOTE: since 1.7.0, only hstore, rocksdb, hbase, memory are supported for backend.# if you want to use Cassandra/MySql/PG... as backend, please use version < 1.7.0backend=rocksdbserializer=binary# The process-wide max capacity of one serialization buffer in bytes#serializer.buffer_max_capacity=134217728store=hugegraph# pd config#pd.peers=127.0.0.1:8686# task configtask.schedule_period=10task.retry=0task.wait_timeout=10# search configsearch.text_analyzer=jiebasearch.text_analyzer_mode=INDEX# rocksdb backend config#rocksdb.data_path=/path/to/disk#rocksdb.wal_path=/path/to/disk# hbase backend config#hbase.hosts=localhost#hbase.port=2181#hbase.znode_parent=/hbase#hbase.threads_max=64# IMPORTANT: recommend to modify the HBase partition number# by the actual/env data amount & RS amount before init store# It will influence the load speed a lot#hbase.enable_partition=true#hbase.vertex_partitions=10#hbase.edge_partitions=30# WARNING: These raft configurations are deprecated, please use the latest version instead.# raft.mode=false# memory management config#memory.mode=off-heap#memory.max_capacity=1073741824#memory.one_query_max_capacity=104857600#memory.alignment=8
停止 Server,初始化执行 init-store.sh(为新的图创建数据库),重新启动 Server
$ ./bin/stop-hugegraph.sh
$ ./bin/init-store.sh
Initializing HugeGraph Store...
2023-06-11 14:16:14 [main][INFO] o.a.h.u.ConfigUtil - Scanning option 'graphs' directory './conf/graphs'2023-06-11 14:16:14 [main][INFO] o.a.h.c.InitStore - Init graph with config file: ./conf/graphs/hugegraph_rocksdb.properties
...
2023-06-11 14:16:15 [main][INFO] o.a.h.StandardHugeGraph - Graph 'hugegraph_rocksdb' has been initialized
2023-06-11 14:16:15 [main][INFO] o.a.h.c.InitStore - Init graph with config file: ./conf/graphs/hugegraph_memory.properties
...
2023-06-11 14:16:16 [main][INFO] o.a.h.StandardHugeGraph - Graph 'hugegraph_memory' has been initialized
2023-06-11 14:16:16 [main][INFO] o.a.h.StandardHugeGraph - Close graph standardhugegraph[hugegraph_rocksdb]...
2023-06-11 14:16:16 [main][INFO] o.a.h.HugeFactory - HugeFactory shutdown
2023-06-11 14:16:16 [hugegraph-shutdown][INFO] o.a.h.HugeFactory - HugeGraph is shutting down
Initialization finished.
$ ./bin/start-hugegraph.sh
Starting HugeGraphServer in daemon mode...
Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)...OK
Started [pid 21614]