1. 首页 > 软件下载 > 正文

JanusGraph图数据库下载-JanusGraph最新版本下载地址-JanusGraph数据库下载方法

1. JanusGraph图数据库简介

JanusGraph是开源的分布式图数据库,专为处理大规模图数据设计。JanusGraph支持多种存储后端和索引后端,具有高度可扩展性,特别适合知识图谱、社交网络、推荐系统等场景。更多学习教程www.fgedu.net.cn

JanusGraph核心特点

可扩展架构:支持PB级图数据存储和处理

多存储后端:支持Apache Cassandra、Apache HBase、Google Cloud Bigtable

多索引后端:支持Elasticsearch、Apache Solr、Apache Lucene

Gremlin查询:基于Apache TinkerPop,使用Gremlin图遍历语言

事务支持:支持ACID事务,保证数据一致性

2. JanusGraph版本说明

JanusGraph提供多个版本,用户可根据需求选择。学习交流加群风哥微信: itpux-com

最新版本信息

JanusGraph 1.2.0:最新稳定版本

JanusGraph 1.1.0:稳定版本

JanusGraph 1.0.0:里程碑版本

JanusGraph 0.6.x:历史长期支持版本

版本特性

1.x版本:支持TinkerPop 3.7.x,改进的性能和稳定性

0.6.x版本:支持TinkerPop 3.5.x,稳定可靠

3. JanusGraph下载地址

JanusGraph可以从官方网站或GitHub获取安装包。

官方下载地址

官方网站:https://janusgraph.org/download/

GitHub仓库:https://github.com/JanusGraph/janusgraph

文档中心:https://docs.janusgraph.org/

下载安装包

# 下载JanusGraph 1.2.0
# cd /fgeudb/software
# wget https://github.com/JanusGraph/janusgraph/releases/download/v1.2.0/janusgraph-1.2.0.zip

# 输出示例如下:
–2026-04-04 10:00:00– https://github.com/JanusGraph/janusgraph/releases/download/v1.2.0/janusgraph-1.2.0.zip
Resolving github.com… 140.82.112.4
Connecting to github.com|140.82.112.4|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 157286400 (150M) [application/zip]
Saving to: ‘janusgraph-1.2.0.zip’

janusgraph-1.2.0.zip 100%[===================>] 150.00M 25.5MB/s in 5.9s

2026-04-04 10:00:10 (25.5 MB/s) – ‘janusgraph-1.2.0.zip’ saved

# 验证下载文件
# ls -lh janusgraph-1.2.0.zip
-rw-r–r–. 1 root root 150M Apr 4 10:00 janusgraph-1.2.0.zip

生产环境建议:建议使用1.2.x最新稳定版本进行生产部署。JanusGraph需要配合存储后端和索引后端使用,建议使用Cassandra+ES组合。from:www.itpux.com

4. 环境准备

在安装JanusGraph之前,需要准备必要的系统环境和Java运行时。

系统要求

# 检查操作系统版本
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)

# 检查系统架构
# uname -m
x86_64

# 检查内存和磁盘空间
# free -h
total used free shared buff/cache available
Mem: 31G 2.1G 28G 8.5M 1.0G 28G
Swap: 15G 0B 15G

# df -h /fgeudb
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 500G 20G 480G 4% /fgeudb

# 安装JDK 11或更高版本
# yum install -y java-11-openjdk java-11-openjdk-devel

# 验证Java版本
# java -version

# 输出示例如下:
openjdk version “11.0.20” 2023-07-18 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.20+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.20+9-LTS, mixed mode, sharing)

# 配置JAVA_HOME
# vi /etc/profile.d/java.sh

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
export PATH=$JAVA_HOME/bin:$PATH

# 使环境变量生效
# source /etc/profile.d/java.sh

# 创建JanusGraph用户和组
# groupadd -g 5009 janusgraph
# useradd -g janusgraph -u 5009 -d /home/janusgraph -s /bin/bash janusgraph

# 创建安装目录
# mkdir -p /fgeudb/janusgraph/{data,logs}
# chown -R janusgraph:janusgraph /fgeudb/janusgraph

5. TAR包安装实战

使用ZIP包安装是最常见的方式,以下是详细步骤。学习交流加群风哥QQ113257174

步骤1:解压安装包

# 安装unzip工具
# yum install -y unzip

# 解压安装包
# cd /fgeudb/software
# unzip janusgraph-1.2.0.zip -d /fgeudb/

# 输出示例如下:
Archive: janusgraph-1.2.0.zip
creating: /fgeudb/janusgraph-1.2.0/
creating: /fgeudb/janusgraph-1.2.0/bin/
creating: /fgeudb/janusgraph-1.2.0/conf/
creating: /fgeudb/janusgraph-1.2.0/lib/
creating: /fgeudb/janusgraph-1.2.0/data/

# 重命名目录
# mv /fgeudb/janusgraph-1.2.0 /fgeudb/janusgraph

# 查看目录结构
# ls -la /fgeudb/janusgraph/
total 32
drwxr-xr-x. 6 janusgraph janusgraph 4096 Apr 4 10:05 .
drwxr-xr-x. 3 root root 4096 Apr 4 10:00 ..
drwxr-xr-x. 2 janusgraph janusgraph 4096 Apr 4 10:05 bin
drwxr-xr-x. 2 janusgraph janusgraph 4096 Apr 4 10:05 conf
drwxr-xr-x. 2 janusgraph janusgraph 4096 Apr 4 05:05 data
drwxr-xr-x. 2 janusgraph janusgraph 4096 Apr 4 10:05 lib
-rw-r–r–. 1 janusgraph janusgraph 5120 Apr 4 10:05 LICENSE.txt
-rw-r–r–. 1 janusgraph janusgraph 1024 Apr 4 10:05 NOTICE.txt
-rw-r–r–. 1 janusgraph janusgraph 2048 Apr 4 10:05 README.md

# 设置权限
# chown -R janusgraph:janusgraph /fgeudb/janusgraph

步骤2:配置JanusGraph

# 编辑配置文件(使用BerkeleyJE存储后端)
# vi /fgeudb/janusgraph/conf/janusgraph-berkeleyje-es.properties

# 存储后端配置
storage.backend=berkeleyje
storage.directory=/fgeudb/janusgraph/data/berkeley

# 索引后端配置
index.search.backend=elasticsearch
index.search.hostname=192.168.1.51
index.search.port=9200
index.search.elasticsearch.client-only=true

# 图配置
graph.graphname=janusgraph
graph.set-vertex-id-property=true

# 缓存配置
cache.db-cache=true
cache.db-cache-size=0.5
cache.db-cache-clean-wait=20
cache.db-cache-time=180000

# 事务配置
storage.transactions=true

# 保存配置文件

# 编辑Cassandra存储后端配置
# vi /fgeudb/janusgraph/conf/janusgraph-cql.properties

# 存储后端配置
storage.backend=cql
storage.hostname=192.168.1.51
storage.port=9042
storage.cql.keyspace=janusgraph
storage.cql.replication={
‘class’: ‘SimpleStrategy’,
‘replication_factor’: 3
}

# 索引后端配置
index.search.backend=elasticsearch
index.search.hostname=192.168.1.51
index.search.port=9200

# 保存配置文件

风哥提示:生产环境建议使用Cassandra作为存储后端,Elasticsearch作为索引后端。cache.db-cache-size设置为JVM堆内存的50%。storage.cql.replication设置副本因子,生产环境建议至少3。

步骤3:启动Gremlin Server

# 切换到janusgraph用户
# su – janusgraph

# 启动Gremlin Server
$ cd /fgeudb/janusgraph
$ ./bin/gremlin-server.sh conf/gremlin-server/gremlin-server.yaml

# 输出示例如下:
[INFO] GremlinServer – Configuring Gremlin Server
[INFO] GremlinServer – Initializing Graph [graph]
[INFO] GremlinServer – Graph [graph] successfully initialized
[INFO] GremlinServer – Channel started at port 8182

# 检查进程
$ ps -ef | grep gremlin
janusgraph 12345 1 5 10:10 pts/0 00:00:10 /usr/lib/jvm/java-11-openjdk/bin/java -cp /fgeudb/janusgraph/lib/* org.apache.tinkerpop.gremlin.server.GremlinServer

# 检查端口
$ netstat -tlnp | grep 8182
tcp 0 0 0.0.0.0:8182 0.0.0.0:* LISTEN 12345/java

步骤4:配置systemd服务

# 创建systemd服务文件
# vi /etc/systemd/system/janusgraph.service

[Unit]
Description=JanusGraph Gremlin Server
After=network.target

[Service]
Type=simple
User=janusgraph
Group=janusgraph
Environment=”JAVA_HOME=/usr/lib/jvm/java-11-openjdk”
Environment=”JANUSGRAPH_HOME=/fgeudb/janusgraph”
ExecStart=/fgeudb/janusgraph/bin/gremlin-server.sh /fgeudb/janusgraph/conf/gremlin-server/gremlin-server.yaml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

# 重新加载systemd
# systemctl daemon-reload

# 启动JanusGraph服务
# systemctl start janusgraph

# 设置开机自启
# systemctl enable janusgraph

# 输出示例如下:
Created symlink from /etc/systemd/system/multi-user.target.wants/janusgraph.service to /etc/systemd/system/janusgraph.service.

# 检查服务状态
# systemctl status janusgraph

● janusgraph.service – JanusGraph Gremlin Server
Loaded: loaded (/etc/systemd/system/janusgraph.service; enabled)
Active: active (running) since Fri 2026-04-04 10:15:00 CST; 10s ago
Main PID: 12345 (java)
CGroup: /system.slice/janusgraph.service
└─12345 /usr/lib/jvm/java-11-openjdk/bin/java -cp …

6. Docker容器安装实战

使用Docker容器安装JanusGraph是最快捷的方式,适合快速测试和开发环境。更多学习教程公众号风哥教程itpux_com

步骤1:拉取JanusGraph镜像

# 拉取官方JanusGraph镜像
# docker pull janusgraph/janusgraph:1.2.0

# 输出示例如下:
1.2.0: Pulling from janusgraph/janusgraph
f1f26f570256: Pull complete
8f8e43ef9c3a: Pull complete
e9d8dca5b8a5: Pull complete
a1b8d4c4a5e6: Pull complete
Digest: sha256:abc123def456…
Status: Downloaded newer image for janusgraph/janusgraph:1.2.0
docker.io/janusgraph/janusgraph:1.2.0

# 查看镜像
# docker images | grep janusgraph
janusgraph/janusgraph 1.2.0 abc123def456 2 weeks ago 800MB

步骤2:运行JanusGraph容器

# 创建数据目录
# mkdir -p /fgeudb/janusgraph/{data,logs}

# 运行JanusGraph容器(使用内置BerkeleyJE)
# docker run -d \
–name janusgraph \
-p 8182:8182 \
-v /fgeudb/janusgraph/data:/var/lib/janusgraph/data \
-v /fgeudb/janusgraph/logs:/var/log/janusgraph \
-e JAVA_OPTIONS=”-Xms2g -Xmx4g” \
janusgraph/janusgraph:1.2.0

# 输出示例如下:
abc123def456789…

# 检查容器状态
# docker ps | grep janusgraph
abc123def456 janusgraph/janusgraph:1.2.0 “/docker-entrypoint.…” 10 seconds ago Up 9 seconds 0.0.0.0:8182->8182/tcp janusgraph

# 查看容器日志
# docker logs janusgraph

# 输出示例如下:
[INFO] GremlinServer – Configuring Gremlin Server
[INFO] GremlinServer – Initializing Graph [graph]
[INFO] GremlinServer – Graph [graph] successfully initialized
[INFO] GremlinServer – Channel started at port 8182

7. JanusGraph配置优化

以下是生产环境的JanusGraph配置优化建议。

存储后端配置优化

# 编辑Cassandra存储后端配置
# vi /fgeudb/janusgraph/conf/janusgraph-cql.properties

# 连接池配置
storage.cql.internal.configuration.advanced.connection.pool.local.size=16
storage.cql.internal.configuration.advanced.connection.pool.remote.size=16
storage.cql.internal.configuration.advanced.connection.max-requests-per-connection=1024

# 超时配置
storage.cql.internal.configuration.advanced.request.timeout=12000
storage.cql.internal.configuration.advanced.connection.connect-timeout=5000
storage.cql.internal.configuration.advanced.connection.read-timeout=12000

# 批量写入配置
storage.batch-loading=false
storage.buffer-size=1024

# 事务配置
storage.transactions=true
storage.lock.wait-time=100
storage.lock.retries=3

# 保存配置文件

索引后端配置优化

# 编辑Elasticsearch索引配置
# vi /fgeudb/janusgraph/conf/janusgraph-cql-es.properties

# 索引配置
index.search.backend=elasticsearch
index.search.hostname=192.168.1.51,192.168.1.52,192.168.1.53
index.search.port=9200
index.search.elasticsearch.client-only=true

# 索引刷新配置
index.search.elasticsearch.refresh=true

# 批量索引配置
index.search.elasticsearch.bulk-refresh=true

# 保存配置文件

Gremlin Server配置优化

# 编辑Gremlin Server配置
# vi /fgeudb/janusgraph/conf/gremlin-server/gremlin-server.yaml

# 基础配置
host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 30000
serializedResponseTimeout: 30000

# 线程池配置
threadPoolWorker: 16
gremlinPool: 32

# 认证配置
authentication: {
authenticator: org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator,
config: {
credentialsDb: conf/tinkergraph-credentials.properties
}
}

# 保存配置文件

生产环境建议:使用Cassandra作为存储后端实现高可用。使用Elasticsearch作为索引后端支持复杂查询。threadPoolWorker根据CPU核心数设置。gremlinPool设置为CPU核心数的2倍。

8. 安装验证与测试

安装完成后,需要进行验证测试确保JanusGraph正常运行。

使用Gremlin Console连接

# 启动Gremlin Console
$ cd /fgeudb/janusgraph
$ ./bin/gremlin.sh

# 输出示例如下:
\,,,/
(o o)
—–oOOo-(3)-oOOo—–

gremlin>

# 连接到远程Gremlin Server
gremlin> :remote connect tinkerpop.server conf/remote.yaml

# 输出示例如下:
==>Configured localhost/127.0.0.1:8182

# 查看版本
gremlin> Gremlin.version()

# 输出示例如下:
==>3.7.1

# 查看图信息
gremlin> :> graph.openManagement().printSchema()

# 输出示例如下:
————————————————————————————————
Vertex Label Name | Partitioned | Static |
————————————————————————————————
————————————————————————————————
Edge Label Name | Directed | Unidirected | Multiplicity |
————————————————————————————————
————————————————————————————————
Property Key Name | Cardinality | Data Type |
————————————————————————————————
————————————————————————————————
Vertex Index Name | Type | Element | Property Keys |
————————————————————————————————
————————————————————————————————
Edge Index Name | Type | Element | Property Keys |
————————————————————————————————

创建图Schema

# 创建属性键
gremlin> :> mgmt = graph.openManagement()
gremlin> :> name = mgmt.makePropertyKey(‘name’).dataType(String.class).make()
gremlin> :> age = mgmt.makePropertyKey(‘age’).dataType(Integer.class).make()
gremlin> :> city = mgmt.makePropertyKey(‘city’).dataType(String.class).make()

# 输出示例如下:
==>propertykey[name]
==>propertykey[age]
==>propertykey[city]

# 创建顶点标签
gremlin> :> person = mgmt.makeVertexLabel(‘person’).make()

# 输出示例如下:
==>vertexlabel[person]

# 创建边标签
gremlin> :> follow = mgmt.makeEdgeLabel(‘follow’).multiplicity(MULTI).make()

# 输出示例如下:
==>edgelabel[follow]

# 创建索引
gremlin> :> mgmt.buildIndex(‘nameIndex’, Vertex.class).addKey(name).indexOnly(person).buildCompositeIndex()

# 输出示例如下:
==>nameIndex

# 提交Schema
gremlin> :> mgmt.commit()

# 输出示例如下:
==>null

插入和查询数据

# 插入顶点数据
gremlin> :> v1 = graph.addVertex(‘person’)
gremlin> :> v1.property(‘name’, ‘Zhang San’)
gremlin> :> v1.property(‘age’, 30)
gremlin> :> v1.property(‘city’, ‘Beijing’)

# 输出示例如下:
==>v[4104]
==>vp[name->Zhang San]
==>vp[age->30]
==>vp[city->Beijing]

gremlin> :> v2 = graph.addVertex(‘person’)
gremlin> :> v2.property(‘name’, ‘Li Si’)
gremlin> :> v2.property(‘age’, 28)
gremlin> :> v2.property(‘city’, ‘Shanghai’)

# 输出示例如下:
==>v[4108]
==>vp[name->Li Si]
==>vp[age->28]
==>vp[city->Shanghai]

# 插入边数据
gremlin> :> v1.addEdge(‘follow’, v2)

# 输出示例如下:
==>e[17p-3c0-2dx-374][4104-follow->4108]

# 提交事务
gremlin> :> graph.tx().commit()

# 输出示例如下:
==>null

# 查询顶点
gremlin> :> g.V().hasLabel(‘person’).values(‘name’)

# 输出示例如下:
==>Zhang San
==>Li Si

# 查询边
gremlin> :> g.V().has(‘name’, ‘Zhang San’).out(‘follow’).values(‘name’)

# 输出示例如下:
==>Li Si

# 路径查询
gremlin> :> g.V().has(‘name’, ‘Zhang San’).out(‘follow’).path()

# 输出示例如下:
==>path[v[4104], v[4108]]

# 退出
gremlin> :exit

REST API测试

# 使用curl测试REST API
$ curl -X POST “http://192.168.1.51:8182” \
-H “Content-Type: application/json” \
-d ‘{“gremlin”: “g.V().count()”}’

# 输出示例如下:
{
“requestId”: “abc123def456”,
“status”: {
“message”: “”,
“code”: 200,
“attributes”: {}
},
“result”: {
“data”: [2],
“meta”: {}
}
}

# 查询顶点
$ curl -X POST “http://192.168.1.51:8182” \
-H “Content-Type: application/json” \
-d ‘{“gremlin”: “g.V().hasLabel(\”person\”).values(\”name\”)”}’

# 输出示例如下:
{
“requestId”: “def456ghi789”,
“status”: {
“message”: “”,
“code”: 200,
“attributes”: {}
},
“result”: {
“data”: [“Zhang San”, “Li Si”],
“meta”: {}
}
}

生产环境建议:建议配置Cassandra集群作为存储后端。建议配置Elasticsearch集群作为索引后端。定期备份数据,使用JanusGraph管理工具。监控关键指标如查询延迟、内存使用率、存储容量。

至此,JanusGraph图数据库的下载和安装已完成。后续可以根据实际业务需求创建图Schema、设计索引和优化查询。

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息