JanusGraph: 可视化 Gephi 插件安装可参考:https://datamining.blog.csdn.net/article/details/103894994
下载地址:https://github.com/bricaud/graphexp
安装
解压,在根目录下修改 graphexp.html
<div class="nav input_unit_container"><label class="nav input_label" for="server_address">Server Address:</label><input name="server_address" id="server_address" value="localhost" />
</div>
<div class="nav input_unit_container"><label class="nav input_label" for="server_port">Server port:</label><input name="server_port" id="server_port" type="number" value="8182"/>
</div>
修改为,192.168.2.111:8182 为JanusGraph服务端口
<div class="nav input_unit_container"><label class="nav input_label" for="server_address">Server Address:</label><input name="server_address" id="server_address" value="192.168.1.111" />
</div>
<div class="nav input_unit_container"><label class="nav input_label" for="server_port">Server port:</label><input name="server_port" id="server_port" type="number" value="8182"/>
</div>
安装ngix 参考:https://www.runoob.com/linux/nginx-install-setup.html
修改配置文件 vim /usr/local/webserver/nginx/conf/nginx.conf
error_log /var/log/error.log debug; #制定日志路径,级别。这个设置可以放入全局块,http块,server块,级别以此为:debug|info|notice|warn|error|crit|alert|emerg
events {accept_mutex on; #设置网路连接序列化,防止惊群现象发生,默认为onmulti_accept on; #设置一个进程是否同时接受多个网络连接,默认为off#use epoll; #事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventportworker_connections 1024; #最大连接数,默认为512
}
http {include mime.types; #文件扩展名与文件类型映射表default_type application/octet-stream; #默认文件类型,默认为text/plain#access_log off; #取消服务日志log_format myFormat '$remote_addr–$remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for'; #自定义格式access_log /var/log/access.log myFormat; #combined为日志格式的默认值sendfile on; #允许sendfile方式传输文件,默认为off,可以在http块,server块,location块。sendfile_max_chunk 100k; #每个进程每次调用传输数量不能大于设定的值,默认为0,即不设上限。keepalive_timeout 65; #连接超时时间,默认为75s,可以在http,server,location块。upstream mysvr {server 127.0.0.1:7878;server 192.168.10.121:3333 backup; #热备}error_page 404 https://www.baidu.com; #错误页server {keepalive_requests 120; #单连接请求上限次数。listen 4545; #监听端口server_name 192.168.2.111; #监听地址location ~*^.+$ { #请求的url过滤,正则匹配,~为区分大小写,~*为不区分大小写。root /opt/graphexp-master; #插件目录}}
}
启动服务:/usr/local/webserver/nginx/sbin/nginx
访问 : http://192.168.2.111:4545/graphexp.html
提示如下成功
测试效果
打开 gremlin.sh
注意:conf/remote.yaml 文件中配置着JanusGraph服务端口
$ bin/gremlin.sh \,,,/(o o)
-----oOOo-(3)-oOOo-----
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/zhonghong/jast/graph/janus/janusgraph-0.3.2-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/zhonghong/jast/graph/janus/janusgraph-0.3.2-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.gephi
plugin activated: tinkerpop.utilities
19:45:30 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 192.168.2.116:8182
gremlin> :> graph.addVertex("name", "stephen")
==>v[4128]
gremlin> :> g.V().values('name')
==>stephen
gremlin>
数据插入成功,查询