Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用gremlinpython进行查询_Python_Gremlin_Janusgraph_Gremlin Server - Fatal编程技术网

无法使用gremlinpython进行查询

无法使用gremlinpython进行查询,python,gremlin,janusgraph,gremlin-server,Python,Gremlin,Janusgraph,Gremlin Server,我正在使用gremlinpython访问Janusgraph中的数据,但是它抛出了一个异常,而数据可以从gremlinshell访问 下面是我正在远程运行的Python代码: from gremlin_python import statics from gremlin_python.structure.graph import Graph from gremlin_python.process.graph_traversal import __ from gremlin_python.proc

我正在使用
gremlinpython
访问Janusgraph中的数据,但是它抛出了一个异常,而数据可以从gremlinshell访问

下面是我正在远程运行的Python代码:

from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://<IP>:8182/gremlin','g', 
username="janusgraph"))
print g.V().has('name', 'saturn').next()
Gremlin服务器的配置文件: gremlin-server.yaml

host: <IP>
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: conf/gremlin-server/janusgraph-hbase-es.properties
}
plugins:
  - janusgraph.imports
scriptEngines: {
  gremlin-groovy: {
    imports: [java.lang.Math],
    staticImports: [java.lang.Math.PI],
    scripts: [scripts/empty-sample.groovy]}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
  - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000},
  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
  graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
主机:
港口:8182
scriptEvaluationTimeout:30000
channelizer:org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
图表:{
图表:conf/gremlin server/janusgraph-hbase-es.properties
}
插件:
-janusgraph.imports
脚本引擎:{
gremlin groovy:{
导入:[java.lang.Math],
staticImports:[java.lang.Math.PI],
脚本:[scripts/empty sample.groovy]}
序列化程序:
-{className:org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,配置:{ioRegistries:[org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]}
-{className:org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0,配置:{ioRegistries:[org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]}
-{className:org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,配置:{serializeResultToString:true}}
-{className:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0,配置:{ioRegistries:[org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0]}
-{className:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0,配置:{ioRegistries:[org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]}
-{className:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,配置:{ioRegistries:[org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0]}
处理器:
-{className:org.apache.tinkerpop.gremlin.server.op.session.session处理器,配置:{sessionTimeout:2880000}
-{className:org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor,配置:{cacheExpirationTime:600000,cacheMaxSize:1000}
指标:{
consoleReporter:{已启用:true,间隔:180000},
csvReporter:{enabled:true,interval:180000,fileName:/tmp/gremlin server metrics.csv},
jmxReporter:{enabled:true},
slf4jReporter:{enabled:true,间隔:180000},
GangliarReporter:{已启用:false,间隔:180000,寻址模式:多播},
graphiteReporter:{启用:false,间隔:180000}
maxInitialLineLength:4096
maxHeaderSize:8192
maxChunkSize:8192
maxContentLength:65536
MaxAccumerationBufferComponents:1024
resultIterationBatchSize:64
writeBufferLowWaterMark:32768
writeBufferHighWaterMark:65536
janusgraph-hbase-es.properties

# JanusGraph configuration sample: HBase and Elasticsearch
#
# This file connects to HBase using a Zookeeper quorum
# (storage.hostname) consisting solely of localhost.  It also connects
# to Elasticsearch running on localhost over Elasticsearch's native "Transport"
# protocol.  Zookeeper, the HBase services, and Elasticsearch must already 
# be running and available before starting JanusGraph with this file.

# The primary persistence provider used by JanusGraph.  This is required. 
# It should be set one of JanusGraph's built-in shorthand names for its
# standard storage backends (shorthands: berkeleyje, cassandrathrift,
# cassandra, astyanax, embeddedcassandra, cql, hbase, inmemory) or to the
# full package and classname of a custom/third-party StoreManager
# implementation.
#
# Default:    (no default value)
# Data Type:  String
# Mutability: LOCAL

gremlin.graph=org.janusgraph.core.JanusGraphFactory

storage.backend=hbase
storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
storage.hbase.table = janusgraph

# The hostname or comma-separated list of hostnames of storage backend
# servers.  This is only applicable to some storage backends, such as
# cassandra and hbase.
#
# Default:    127.0.0.1
# Data Type:  class java.lang.String[]
# Mutability: LOCAL
storage.hostname=slv-01,slv-02,slv-03

# Whether to enable JanusGraph's database-level cache, which is shared
# across all transactions. Enabling this option speeds up traversals by
# holding hot graph elements in memory, but also increases the likelihood
# of reading stale data.  Disabling it forces each transaction to
# independently fetch graph elements from storage before reading/writing
# them.
#
# Default:    false
# Data Type:  Boolean
# Mutability: MASKABLE
cache.db-cache = true

# How long, in milliseconds, database-level cache will keep entries after
# flushing them.  This option is only useful on distributed storage
# backends that are capable of acknowledging writes without necessarily
# making them immediately visible.
#
# Default:    50
# Data Type:  Integer
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend.  After starting the database for the first
# time, this file's copy of this setting is ignored.  Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
cache.db-cache-clean-wait = 20

# Default expiration time, in milliseconds, for entries in the
# database-level cache. Entries are evicted when they reach this age even
# if the cache has room to spare. Set to 0 to disable expiration (cache
# entries live forever or until memory pressure triggers eviction when set
# to 0).
#
# Default:    10000
# Data Type:  Long
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend.  After starting the database for the first
# time, this file's copy of this setting is ignored.  Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
cache.db-cache-time = 180000

# Size of JanusGraph's database level cache.  Values between 0 and 1 are
# interpreted as a percentage of VM heap, while larger values are
# interpreted as an absolute size in bytes.
#
# Default:    0.3
# Data Type:  Double
# Mutability: MASKABLE
cache.db-cache-size = 0.5

# The indexing backend used to extend and optimize JanusGraph's query
# functionality. This setting is optional.  JanusGraph can use multiple
# heterogeneous index backends.  Hence, this option can appear more than
# once, so long as the user-defined name between "index" and "backend" is
# unique among appearances.Similar to the storage backend, this should be
# set to one of JanusGraph's built-in shorthand names for its standard
# index backends (shorthands: lucene, elasticsearch, es, solr) or to the
# full package and classname of a custom/third-party IndexProvider
# implementation.
#
# Default:    elasticsearch
# Data Type:  String
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend.  After starting the database for the first
# time, this file's copy of this setting is ignored.  Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
index.search.backend=elasticsearch

# The hostname or comma-separated list of hostnames of index backend
# servers.  This is only applicable to some index backends, such as
# elasticsearch and solr.
#
# Default:    127.0.0.1
# Data Type:  class java.lang.String[]
# Mutability: MASKABLE
index.search.hostname=<ES IP>:9201
index.search.index-name = search
#JanusGraph配置示例:HBase和Elasticsearch
#
#此文件使用Zookeeper仲裁连接到HBase
#(storage.hostname)仅由本地主机组成。它还连接
#通过Elasticsearch的本机“传输”在本地主机上运行Elasticsearch
#协议。Zookeeper、HBase服务和Elasticsearch必须已经
#在使用此文件启动JanusGraph之前,请确保正在运行且可用。
#JanusGraph使用的主要持久性提供程序。这是必需的。
#它应该被设置为JanusGraph的内置速记名称之一
#标准存储后端(简称:berkeleyje、cassandrathrift、,
#cassandra、astyanax、嵌入式cassandra、cql、hbase、inmemory)或
#自定义/第三方StoreManager的完整包和类名
#实施。
#
#默认值:(无默认值)
#数据类型:字符串
#易变性:局部
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=hbase
storage.hbase.ext.zookeeper.znode.parent=/hbase不安全
storage.hbase.table=janusgraph
#存储后端的主机名或以逗号分隔的主机名列表
#服务器。这仅适用于某些存储后端,例如
#卡桑德拉和hbase。
#
#默认值:127.0.0.1
#数据类型:类java.lang.String[]
#易变性:局部
storage.hostname=slv-01、slv-02、slv-03
#是否启用JanusGraph的共享数据库级缓存
#在所有交易中。启用此选项可通过以下方式加快遍历速度:
#在内存中保留热图形元素,但也会增加可能性
#读取陈旧数据的方法。禁用它将强制每个事务
#在读/写之前,从存储器中独立提取图形元素
#他们。
#
#默认值:false
#数据类型:布尔型
#易变性:可屏蔽
cache.db-cache=true
#之后数据库级缓存将保留条目的时间(毫秒)
#冲洗它们。此选项仅在分布式存储上有用
#能够确认写操作而无需
#使它们立即可见。
#
#默认值:50
#数据类型:整数
#易变性:全局_脱机
#
#可变全局_脱机的设置在中集中管理
#JanusGraph的存储后端。在第一次启动数据库之后
#此时,此文件的此设置副本将被忽略。使用JanusGraph的
#管理系统在引导后读取或修改此值。
cache.db-cache-clean-wait=20
#中的条目的默认过期时间(以毫秒为单位)
#数据库级缓存。当条目达到此年龄时,甚至会被逐出
#如果缓存有空闲空间。设置为0以禁用过期(缓存)
#条目将永远存在,或者直到设置时内存压力触发逐出
#到0)。
#
#默认值:10000
#数据类型:Long
#易变性:全局_脱机
#
#可变全局_脱机的设置在中集中管理
#JanusGraph的存储后端。在第一次启动数据库之后
#此时,此文件的此设置副本将被忽略。使用JanusGraph的
#管理系统在引导后读取或修改此值。
cache.db-cache-time=180000
#JanusGraph数据库级缓存的大小。0和1之间的值是
#解释为VM堆的百分比,而更大的值
#解释为以字节为单位的绝对大小。
#
#默认值:0.3
#数据类型:双精度
#易变性:可屏蔽
cache.db-ca
host: <IP>
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: conf/gremlin-server/janusgraph-hbase-es.properties
}
plugins:
  - janusgraph.imports
scriptEngines: {
  gremlin-groovy: {
    imports: [java.lang.Math],
    staticImports: [java.lang.Math.PI],
    scripts: [scripts/empty-sample.groovy]}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
  - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000},
  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
  graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
# JanusGraph configuration sample: HBase and Elasticsearch
#
# This file connects to HBase using a Zookeeper quorum
# (storage.hostname) consisting solely of localhost.  It also connects
# to Elasticsearch running on localhost over Elasticsearch's native "Transport"
# protocol.  Zookeeper, the HBase services, and Elasticsearch must already 
# be running and available before starting JanusGraph with this file.

# The primary persistence provider used by JanusGraph.  This is required. 
# It should be set one of JanusGraph's built-in shorthand names for its
# standard storage backends (shorthands: berkeleyje, cassandrathrift,
# cassandra, astyanax, embeddedcassandra, cql, hbase, inmemory) or to the
# full package and classname of a custom/third-party StoreManager
# implementation.
#
# Default:    (no default value)
# Data Type:  String
# Mutability: LOCAL

gremlin.graph=org.janusgraph.core.JanusGraphFactory

storage.backend=hbase
storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
storage.hbase.table = janusgraph

# The hostname or comma-separated list of hostnames of storage backend
# servers.  This is only applicable to some storage backends, such as
# cassandra and hbase.
#
# Default:    127.0.0.1
# Data Type:  class java.lang.String[]
# Mutability: LOCAL
storage.hostname=slv-01,slv-02,slv-03

# Whether to enable JanusGraph's database-level cache, which is shared
# across all transactions. Enabling this option speeds up traversals by
# holding hot graph elements in memory, but also increases the likelihood
# of reading stale data.  Disabling it forces each transaction to
# independently fetch graph elements from storage before reading/writing
# them.
#
# Default:    false
# Data Type:  Boolean
# Mutability: MASKABLE
cache.db-cache = true

# How long, in milliseconds, database-level cache will keep entries after
# flushing them.  This option is only useful on distributed storage
# backends that are capable of acknowledging writes without necessarily
# making them immediately visible.
#
# Default:    50
# Data Type:  Integer
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend.  After starting the database for the first
# time, this file's copy of this setting is ignored.  Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
cache.db-cache-clean-wait = 20

# Default expiration time, in milliseconds, for entries in the
# database-level cache. Entries are evicted when they reach this age even
# if the cache has room to spare. Set to 0 to disable expiration (cache
# entries live forever or until memory pressure triggers eviction when set
# to 0).
#
# Default:    10000
# Data Type:  Long
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend.  After starting the database for the first
# time, this file's copy of this setting is ignored.  Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
cache.db-cache-time = 180000

# Size of JanusGraph's database level cache.  Values between 0 and 1 are
# interpreted as a percentage of VM heap, while larger values are
# interpreted as an absolute size in bytes.
#
# Default:    0.3
# Data Type:  Double
# Mutability: MASKABLE
cache.db-cache-size = 0.5

# The indexing backend used to extend and optimize JanusGraph's query
# functionality. This setting is optional.  JanusGraph can use multiple
# heterogeneous index backends.  Hence, this option can appear more than
# once, so long as the user-defined name between "index" and "backend" is
# unique among appearances.Similar to the storage backend, this should be
# set to one of JanusGraph's built-in shorthand names for its standard
# index backends (shorthands: lucene, elasticsearch, es, solr) or to the
# full package and classname of a custom/third-party IndexProvider
# implementation.
#
# Default:    elasticsearch
# Data Type:  String
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend.  After starting the database for the first
# time, this file's copy of this setting is ignored.  Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
index.search.backend=elasticsearch

# The hostname or comma-separated list of hostnames of index backend
# servers.  This is only applicable to some index backends, such as
# elasticsearch and solr.
#
# Default:    127.0.0.1
# Data Type:  class java.lang.String[]
# Mutability: MASKABLE
index.search.hostname=<ES IP>:9201
index.search.index-name = search