【问题标题】:JanusGraph Server XML ConfigurationJanusGraph 服务器 XML 配置
【发布时间】:2018-09-11 17:56:31
【问题描述】:

任何人都知道如何配置janusgraph服务器的用户名和密码。所以任何发送到这个 janusgraph 服务器的 http/socket 都需要认证。

谢谢

【问题讨论】:

    标签: graph-databases tinkerpop janusgraph


    【解决方案1】:

    JanusGraph 打包了 TinkerPop 的 Gremlin 服务器,因此要配置身份验证,您只需按照 Gremlin 服务器的说明进行操作即可。基本步骤是修改服务器 yaml 文件以包含以下内容:

    authentication: {
      authenticator: org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator,
      config: {
        credentialsDb: conf/credentials.properties}}
    

    它设置了一个“简单”的身份验证系统,该系统使用由conf/credentials.properties 配置的本地Graph 实例来存放用户名/密码。显然,如果您愿意,您可以编写更高级的Authenticator 并改用它——SimpleAuthenticator 实际上只是一个让人们开始的参考实现。下面是一个使用 TinkerGraph 作为凭证​​的目标数据库的示例:

    gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
    gremlin.tinkergraph.vertexIdManager=LONG
    gremlin.tinkergraph.graphLocation=data/credentials.kryo
    gremlin.tinkergraph.graphFormat=gryo
    

    但它显然可以是您想使用的任何Graph

    要在该图中设置用户名和密码,您需要使用通常通过 Gremlin 控制台作为管理任务执行的 Credentials DSL。你会做这样的事情:

    gremlin> :plugin use tinkerpop.credentials
    ==>tinkerpop.credentials activated
    gremlin> graph = ... // create your graph instance for usernames/passwords
    ...
    gremlin> credentials = credentials(graph)
    ==>CredentialGraph{graph=tinkergraph[vertices:0 edges:0]}
    gremlin> credentials.createUser("stephen","password")
    ==>v[0]
    gremlin> credentials.createUser("daniel","better-password")
    ==>v[3]
    gremlin> credentials.createUser("marko","rainbow-dash")
    ==>v[6]
    gremlin> credentials.findUser("marko").properties()
    ==>vp[password->$2a$04$lBXMnKWtLB...]
    ==>vp[username->marko]
    gremlin> credentials.countUsers()
    ==>3
    gremlin> credentials.removeUser("daniel")
    ==>1
    gremlin> credentials.countUsers()
    ==>2
    

    使用该配置启动 Gremlin 服务器,并且应该启用身份验证。

    TinkerPop reference documentation 中更详细地描述了这些步骤。我建议您自行使用download Gremlin Server,并使用 TinkerGraph 用户已构建的“凭据图”检查预配置的“安全”配置。您可以使用以下命令运行该示例:

    $ bin/gremlin-server.sh conf/gremlin-server-secure.yaml
    

    仔细查看 conf/gremlin-server-secure.yaml 中的内容以及它与 conf/tinkergraph-credentials.properties 的关系,然后在您的 JanusGraph 服务器配置中进行类似的更改。这应该让你开始。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-19
      • 2016-07-15
      • 2021-06-15
      • 1970-01-01
      • 2013-06-13
      • 2016-05-27
      • 2016-11-09
      • 2017-05-12
      相关资源
      最近更新 更多