hugegraph图数据库源码 之 -idea启动hugegraph-server

1. 源码下载

github.com/apache/incubator-hugegraph/releases/

2. 官网参考

hugegraph.apache.org/cn/docs/quickstart/hugegraph-server/

3. 环境依赖

1.jdk:1.8+
2. mysql:5.20
3. hugegraph-server:0.12.0
4. IntelliJ IDEA 2022.1 (Ultimate Edition)
5.操作系统:windows

4. 下载包导入idea

hugegraph.png

4.1 修改配置文件

修改gremlin-server.yaml
     org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
       # files: [scripts/empty-sample.groovy]
      }
hugegraph-配置.png

4.2 由于win的路径问题,默认配置files: [conf/empty-sample.groovy]会找不到empty-sample.groovy这个文件,这里有两种解决办法

将files: [conf/empty-sample.groovy]注释掉
将empty-sample.groovy文件copy到/下,并修改file为files: [empty-sample.groovy]


hugegraph-配置.png

4.3 修改rest-server.properties

rest-server.properties位于hugegraph-dist\src\assembly\static\conf\下
restserver.url=http://0.0.0.0:8080
graphs=D:/ideaWorkSpace/OpenSource/bigdata/incubator-hugegraph-0.12.0/incubator-hugegraph-0.12.0/hugegraph-dist/src/assembly/static/conf/graphs

hugegraph-rest配置.png
注意:
如果要对外访问,将restserver.url的host修改为0.0.0.0
将graphs的值改为graphs包的绝对路径

4.4 修改hugegraph.properties

hugegraph.properties位于hugegraph-dist\src\assembly\static\conf\graphs下

主要修改的文件

当后端存储选用mysql时,backend和serializer都要配置为mysql
backend=mysql
serializer=mysql

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.1.180:3306
jdbc.username=root
jdbc.password=123456
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3
jdbc.sslmode=false
# gremlin entrance to create graph
# auth config: com.baidu.hugegraph.auth.HugeFactoryAuthProxy
gremlin.graph=com.baidu.hugegraph.HugeFactory

# cache config
#schema.cache_capacity=100000
# vertex-cache default is 1000w, 10min expired
vertex.cache_type=l2
#vertex.cache_capacity=10000000
#vertex.cache_expire=600
# edge-cache default is 100w, 10min expired
edge.cache_type=l2
#edge.cache_capacity=1000000
#edge.cache_expire=600


# schema illegal name template
#schema.illegal_name_regex=\s+|~.*

#vertex.default_label=vertex

#backend=rocksdb
#serializer=binary
backend=mysql
serializer=mysql

store=hugegraph

raft.mode=false
raft.safe_read=false
raft.use_snapshot=false
raft.endpoint=127.0.0.1:8281
raft.group_peers=127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283
raft.path=./raft-log
raft.use_replicator_pipeline=true
raft.election_timeout=10000
raft.snapshot_interval=3600
raft.backend_threads=48
raft.read_index_threads=8
raft.read_strategy=ReadOnlyLeaseBased
raft.queue_size=16384
raft.queue_publish_timeout=60
raft.apply_batch=1
raft.rpc_threads=80
raft.rpc_connect_timeout=5000
raft.rpc_timeout=60000

search.text_analyzer=jieba
search.text_analyzer_mode=INDEX

# rocksdb backend config
#rocksdb.data_path=/path/to/disk
#rocksdb.wal_path=/path/to/disk


# cassandra backend config
#cassandra.host=localhost
#cassandra.port=9042
#cassandra.username=
#cassandra.password=
#cassandra.connect_timeout=5
#cassandra.read_timeout=20
#cassandra.keyspace.strategy=SimpleStrategy
#cassandra.keyspace.replication=3

# hbase backend config
#hbase.hosts=localhost
#hbase.port=2181
#hbase.znode_parent=/hbase
#hbase.threads_max=64

# mysql backend config
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.1.180:3306
jdbc.username=root
jdbc.password=123456
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3
jdbc.sslmode=false

# postgresql & cockroachdb backend config
#jdbc.driver=org.postgresql.Driver
#jdbc.url=jdbc:postgresql://localhost:5432/
#jdbc.username=postgres
#jdbc.password=
#jdbc.postgresql.connect_database=template1

# palo backend config
#palo.host=127.0.0.1
#palo.poll_interval=10
#palo.temp_dir=./palo-data
#palo.file_limit_size=32

4.5 修改ServerOptions.java文件

修改为绝对路径
位置
incubator-hugegraph-0.12.0\hugegraph-api\src\main\java\com\baidu\hugegraph\config\ServerOptions.java

    public static final ConfigOption GRAPHS =
            new ConfigOption<>(
                    "graphs",
                    "The directory store graphs' config file.",
                    disallowEmpty(),
                    "D:/ideaWorkSpace/OpenSource/bigdata/incubator-hugegraph-0.12.0/incubator-hugegraph-0.12.0/hugegraph-dist/src/assembly/static/conf/graphs"
            );

5. 初始化数据库(仅第一次启动前需要)

D:\ideaWorkSpace\OpenSource\bigdata\incubator-hugegraph-0.12.0\incubator-hugegraph-0.12.0\hugegraph-dist\src\assembly\static\conf\rest-server.properties
hugegraph-initstore.png

启动

hugegraph-mysql.png

5。启动hugegraph-server

配置


hugegraph-service.png

运行 表示启动成功

hugegraph启动.png

你可能感兴趣的:(hugegraph图数据库源码 之 -idea启动hugegraph-server)