Re: ConfiguredGraphFactory and Authentication not working
hadoopmarc@...
Hi Vinayak,
Could you try in the gremlin-server.yaml with just: graphs: { ConfigurationManagementGraph: conf/janusgraph-cql-configurationgraph.properties } So, without the graph, graph1 and graph2 keys. This is a speculative answer, but this is the only thing that seems to be different from the ref docs, so we need to test the assumption that these additional keys are not harmful. Best wishes, Marc |
|
Re: ConfiguredGraphFactory and Authentication not working
Vinayak Bali
Hi All, Investigated the issue further. We I start janusgraph by default janusgraph schema is created, but I need configuredmanagementgraph. Request you to please help regarding it . Thanks & Regards, Vinayak On Thu, Feb 25, 2021 at 11:44 AM Vinayak Bali <vinayakbali16@...> wrote:
|
|
Re: JanusGraphIndex how to retrieve constraint (indexOnly) specified for the global index?
hadoopmarc@...
Thanks. Still, my earlier answer remains unsatisfactory. Somehow, a new JanusGraph instance must be able to load an existing schema from the system table and have the information about label constraints available. Otherwise, the instance would not be able to index newly added vertices and edges correctly.
Best wishes, Marc |
|
ConfiguredGraphFactory and Authentication not working
Vinayak Bali
Hi All, Followed the following blogs for configuring authentication and ConfiguredGraphFactory respectively. Still, both of them are not working. Sharing the property files. gremlin-server.yaml # Copyright 2019 JanusGraph Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. host: 0.0.0.0 port: 8182 scriptEvaluationTimeout: 30000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer graphManager: org.janusgraph.graphdb.management.JanusGraphManager graphs: { ConfigurationManagementGraph: conf/janusgraph-cql-configurationgraph.properties, graph: conf/graph.properties, graph1: conf/graph1.properties, graph2: conf/graph2.properties } authentication: { authenticator: org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.SaslAndHMACAuthenticator, authenticationHandler: org.janusgraph.graphdb.tinkerpop.gremlin.server.handler.SaslAndHMACAuthenticationHandler, config: { #defaultUsername: user, #defaultPassword: password, hmacSecret: secret, credentialsDb: conf/janusgraph-credentials-server.properties } } scriptEngines: { gremlin-groovy: { plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {}, org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {}, org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]}, org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: []}}}} serializers: - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} # Older serialization versions for backward compatibility: - { 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.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} - { 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-cql-configurationgraph.properties # Copyright 2019 JanusGraph Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # JanusGraph configuration sample: Cassandra over a socket # # This file connects to a Cassandra daemon running on localhost via # CQL. Cassandra must already be started before starting JanusGraph # with this file. gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory # 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, cql, cassandrathrift, # cassandra, astyanax, embeddedcassandra, 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 storage.backend=cql # The configuration management graph reserved for use with JanusGraphManager # and ConfiguredGraphFactory graph.graphname=ConfigurationManagementGraph # 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=127.0.0.1 # 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 # 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 Error: gremlin> :remote connect tinkerpop.server conf/remote.yaml session ==>Configured localhost/127.0.0.1:8182-[8671c17b-e724-484a-aa9f-6b0d255b5ded] gremlin> :remote console ==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[8671c17b-e724-484a-aa9f-6b0d255b5ded] - type ':remote console' to return to local mode gremlin> ConfiguredGraphFactory.getGraphNames() Please add a key named "ConfigurationManagementGraph" to the "graphs" property in your YAML file and restart the server to be able to use the functionality of the ConfigurationManagementGraph class. Request you to check and help me to solve the issue. Thanks & Regards, Vinayak |
|
Re: JanusGraphIndex how to retrieve constraint (indexOnly) specified for the global index?
Thank you, Index class is having tx() transaction description, but I have not found it there as well, I have added these comments to 1163 as suggested. Regards, CM |
|
Re: JanusGraphIndex how to retrieve constraint (indexOnly) specified for the global index?
hadoopmarc@...
Confirmed, could not find it either. Could you please add it as a comment to:
https://github.com/JanusGraph/janusgraph/issues/1163 Unless someone comes up with a solution, it seems you will have to keep track of label constraints yourself. Best wishes, Marc |
|
Re: Gremlin Query to return count for nodes and edges
hadoopmarc@...
Hi Vinayak,
Speeding up your query depends on your setup. 15.000 vertices/second is already fast. Is this the janusgraph inmemory backend? Or ScyllaDB? In a perfect world, not there yet, your query would profit from parallelization (OLAP). JanusGraph supports both the withComputer() and withComputer(SparkGraphComputer) start steps, but the former is undocumented and the performance gains of the latter are often disappointing. Best wishes, Marc |
|
Re: Gremlin Query to return count for nodes and edges
Vinayak Bali
Hi All, The query shared by HadoopMarc works. The query, I executed returns 752650 nodes and 297302 edges as a count. The time taken is around 1min. Is there any way to optimize it further ??? Thank You, Marc, and all others for your help. Thanks & Regards, Vinayak On Wed, Feb 24, 2021 at 2:32 PM Graham Wallis <graham_wallis@...> wrote: Good query from @hadoopmarc and I like @cmilowka's suggestion, although I needed to modify it very slightly as follows: |
|
Re: Gremlin Query to return count for nodes and edges
Graham Wallis <graham_wallis@...>
Good query from @hadoopmarc
and I like @cmilowka's suggestion, although I needed to modify it very
slightly as follows:
g.V().hasLabel('A').union( __.count(), __.outE().count(), __.outE().inV().count() ) That has to be the shortest and neatest solution. Certainly far better than my rather basic effort below, which surely gets the prize for the longest solution :-) g.V().hasLabel('A').aggregate('a').outE().aggregate('e').inV().aggregate('b').select('a').dedup().as('as').select('e').dedup().as('es').select('b').dedup().as('bs').select('as','es','bs').by(unfold().count()) Best regards, Graham Graham Wallis IBM Open Software Internet: graham_wallis@... IBM, Hursley Park, Hursley, Hampshire SO21 2JN From: "cmilowka" <cmilowka@...> To: janusgraph-users@... Date: 23/02/2021 22:49 Subject: [EXTERNAL] Re: [janusgraph-users] Gremlin Query to return count for nodes and edges Sent by: janusgraph-users@... Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU |
|
JanusGraphIndex how to retrieve constraint (indexOnly) specified for the global index?
Global indexes can be limited to the "constraint" by indexOnly() step, from JanusGraph documentation: mgmt.buildIndex('byNameAndLabel', Vertex.class).addKey(name).indexOnly(god).buildCompositeIndex() It is handled by the "createCompositeIndex(...) java code by: addSchemaEdge(indexVertex, (JanusGraphSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null);
I should learn how the index was created from JanusGraphIndex instance, but the method is not there,... I need to have it automatically detected by the software somehow. Is any other way to know it was Indexed Only By the "god"?
|
|
Re: Gremlin Query to return count for nodes and edges
It may work as well, to count totals of all in and out edges for "A" label: g.V().hasLabel('A').union( __.count(), __. outE().count(), __.inV().count() )
|
|
Re: Gremlin Query to return count for nodes and edges
hadoopmarc@...
Hi Vinayak,
A new attempt: g = TinkerFactory.createModern().traversal() g.withSideEffect('vs', new HashSet()).withSideEffect('es', new HashSet()). V(1,2).aggregate('vs').outE().aggregate('es').inV().aggregate('vs').cap('vs', 'es'). project('vs', 'es'). by(select('vs').unfold().count()). by(select('es').unfold().count()) ==>[vs:4,es:3] This still looks clunky to me, so I challenge other readers to get rid of the project().by(select()) construct. Best wishes, Marc |
|
Re: Changing graphname at runtime
hadoopmarc@...
You really have to try this out and see. I can only answer from what I read in the ref docs.
> Do I need to ConfiguredGraphFactory.close(GRAPH) before I update its configuration? The docs say the binding between graph name and graph instance renews every 20 secs, so maybe this is not necessary. > What happens to GRAPH_TEMP? Wouldn't it be still pointing to the same storage backend HBase table as GRAPH, i.e. to TABLE_B? GRAPH_TEMP is just a name in the JanusGraphManager memory. It does not matter. > if I want to reuse the same scheme, I'd have to have some logic that the next time around I need to renew GRAPH, I have GRAPH_TEMP talk to TABLE_A instead and then switch GRAPH to use TABLE_A, correct? You are right. I would prefer straight versioning or a timestamp in the tablename, or the reuse of names will bite you some day. Of course, you would drop TABLE_A from the storage backend if not needed anymore. Best wishes, Marc |
|
Re: Gremlin Query to return count for nodes and edges
Vinayak Bali
Hi Graham, Tried itm the output is as follows: [{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1},{"v1":1,"e":1,"v2":1}, I want the count something like {v1: 20, e: 60, v2:10} or {v:30, e: 60} Thanks & Regards, Vinayak On Tue, Feb 23, 2021 at 3:00 PM Graham Wallis <graham_wallis@...> wrote: Hi Vinayak |
|
Re: Gremlin Query to return count for nodes and edges
Graham Wallis <graham_wallis@...>
Hi Vinayak
You could do this: g.V().hasLabel('A').as('a').outE().as('e').inV().as('b').select('a','e','b').by(count()) That should produce something like: ==>{a=1, e=1, b=1} Best regards, Graham Graham Wallis IBM Open Software Internet: graham_wallis@... IBM, Hursley Park, Hursley, Hampshire SO21 2JN From: "Vinayak Bali" <vinayakbali16@...> To: janusgraph-users@... Date: 23/02/2021 09:11 Subject: [EXTERNAL] Re: [janusgraph-users] Gremlin Query to return count for nodes and edges Sent by: janusgraph-users@... Hi Marc, I am using the following query to return the results. g.V().hasLabel('A').as('a').outE().as('e').inV().as('b').select('a','e','b').by(valueMap().by(unfold())) Want the count of Hi Marc, I am using the following query to return the results. g.V().hasLabel('A').as('a').outE().as('e').inV().as('b').select('a','e','b').by(valueMap().by(unfold())) Want the count of unique nodes in a and b together and e i.e number of edges. Please modify this query to get the required output. Thanks & Regards, Vinayak On Tue, Feb 23, 2021 at 1:08 PM <hadoopmarc@...> wrote: Hi
Vinayak, Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU |
|
Re: Gremlin Query to return count for nodes and edges
Vinayak Bali
Hi Marc, I am using the following query to return the results. g.V().hasLabel('A').as('a').outE().as('e').inV().as('b').select('a','e','b').by(valueMap().by(unfold())) Want the count of unique nodes in a and b together and e i.e number of edges. Please modify this query to get the required output. Thanks & Regards, Vinayak On Tue, Feb 23, 2021 at 1:08 PM <hadoopmarc@...> wrote: Hi Vinayak, |
|
Re: Gremlin Query to return count for nodes and edges
hadoopmarc@...
Hi Vinayak,
Try: g.V().project('v', 'vcount', 'ecount').by(identity()).by(count()).by(bothE().count()) Best wishes, Marc |
|
Gremlin Query to return count for nodes and edges
Vinayak Bali
Hi All, Wanted to return the count of nodes and edges returned by the query. Tired a few queries but they are not working. Can someone please share a single query, which returns both the count? Thanks & Regards, Vinayak |
|
Re: Changing graphname at runtime
Diglio A. Simoni
OK, so that I'm clear, what you're suggesting is that I try something like:
// Create and open main graph map = new HashMap(); map.put("storage.backend", “hbase); map.put("storage.hostname", “xx.xx.xx.xx,yy.yy.yy.yy,zz.zz.zz.zz”); map.put("storage.hbase.table”, “TABLE_A”); map.put("graph.graphname", “GRAPH”); configuration = new MapConfiguration(map); configuration.setDelimiterParsingDisabled(True); ConfiguredGraphFactory.createConfiguration(configuration); graph = ConfiguredGraphFactory.open(“GRAPH”);
// Create, open and update replacement graph map = new HashMap(); map.put("storage.backend", “hbase); map.put("storage.hostname", “xx.xx.xx.xx,yy.yy.yy.yy,zz.zz.zz.zz”); map.put("storage.hbase.table”, “TABLE_B”); map.put("graph.graphname", “GRAPH_TEMP”); configuration = new MapConfiguration(map); configuration.setDelimiterParsingDisabled(True); ConfiguredGraphFactory.createConfiguration(configuration); graph = ConfiguredGraphFactory.open(“GRAPH_TEMP”);
// Modify GRAPH_TEMP and when it’s time to make that the live one: map = new HashMap(); map.put("storage.hbase.table”, “TABLE_B); ConfiguredGraphFactory.updateConfiguration(“GRAPH”,map); graph = ConfiguredGraphFactory.open(“GRAPH”); But that raises some additional questions:
|
|
Re: Janusgraph 0.5.3 potential memory leak
Sadly, that quick fix is not only fast but also incorrect. It requires to iterate the `Iterator` twice which causes incorrect results.
|
|