how janusGraph server instance come? - janusgraph

I've had a strange problem lately.When i use mgmt.getOpenInstance() in my gremlin shell, I find three instance:
gremlin> mgmt.getOpenInstances()
==>0a05778817387-ncn2d-wiseoap-hispace-janusgraph-5-119-1369(current)
==>0a05604582467-ncn2d-wiseoap-hispace-janusgraph-5-119-699
==>0a05778853802-ncn2d-wiseoap-hispace-janusgraph-5-119-136d
How are these three instances generated?

When you connect to janusgraph with gremlin-console or java code, it will creates a instance. You can close it with mgmt.forceCloseInstance("your_instance_name") cmd.

Related

Janusgraph doesn't allow to set vertex Id even after setting this property `graph.set-vertex-id=true`

I'm running janusgraph server backed by Cassandra. It doesn't allow me to use custom vertex ids.
I do see the following log when the janusgraph gremlin server is starting.
Local setting graph.set-vertex-id=true (Type: FIXED) is overridden by globally managed value (false). Use the ManagementSystem interface instead of the local configuration to control this setting
Even tried to set this property via management API and still no luck.
gremlin> mgmt = graph.openManagement()
gremlin> mgmt.set('graph.set-vertex-id', true)
As the log message already states, this config option has the mutability FIXED which means that it is a global configuration option. Global configuration is described in this section of the JanusGraph documentation.
It states that:
Global configuration options apply to all instances in a cluster.
JanusGraph stores these configuration options in its storage backend which is Cassandra in your case. This ensures that all JanusGraph instances have the same values for these configuration values. Any changes that are made to these options in a local file are ignored because of this. Instead, you have to use the management API to change them which will update them in the storage backend.
But that is already what you tried with mgmt.set(). This doesn't work in this case however because this specific config option has the mutability level FIXED. The JanusGraph documentation describes this as:
FIXED: Like GLOBAL, but the value cannot be changed once the JanusGraph cluster is initialized.
So, this value can really not be changed in an existing JanusGraph cluster. Your only option is to start with a new cluster if you really need to change this value.
It is of course unfortunate that the error message suggested to use the management API even though it doesn't work in this case. I have created an issue with the JanusGraph project to improve this error message to avoid such confusion in the future: https://github.com/JanusGraph/janusgraph/issues/3206

How to use graph.openManagement().updateIndex()?

I have janusgraph database, in which all indexes were built.But the status of some of those indexes is installed. Now I am trying to update those Indexes to the registered and then to enabled. So I have done some research and I found this Action(schemaAction).But I don't know the syntax and also how to use graph.openManagement().updateIndex().
Any suggestions regarding this issue or if there is anything other than this procedure, then please let me know it.
Thanks in advance!
If there are any open transactions while creating the indexes they might get stuck in the INSTALLED state.
You can find a clear explanation here.
After rolling back your open transactions and closing open instances, try reindexing.
Note: Block until the SchemaStatus transitions from INSTALLED to REGISTERED, after running the reindex command. Try to run groovy script instead of running the commands directly on gremlin console for building the indexes. Please find the sample script below.
import org.janusgraph.graphdb.database.management.ManagementSystem
mgmt = graph.openManagement();
mgmt.updateIndex(mgmt.getGraphIndex("giftIdByGift"), SchemaAction.REGISTER_INDEX).get();
ManagementSystem.awaitGraphIndexStatus(graph, "giftIdByGift").call();
mgmt.commit();
mgmt = graph.openManagement();
mgmt.updateIndex(mgmt.getGraphIndex("giftIdByGift"), SchemaAction.REINDEX).get();
ManagementSystem.awaitGraphIndexStatus(graph, "giftIdByGift").status(SchemaStatus.ENABLED).call();
mgmt.commit();

Adding extra jar to H2O when connecting to external instance using h2o.init()

I'm using H2O init to specify the Snowflake JDBC driver as extra_classpath when connecting to external H2O instance however, getting the following error (H2O connects successfully to external instance), when attempting to access Snowflake DB:
H2OServerError: HTTP 500 Server Error:
Server error java.lang.RuntimeException:
Error: SQLException: No suitable driver found for jdbc:snowflake:..
It works fine when starting a standalone H2O instance with nothing else changed.
Here is the init code:
h2o.init(ip='<ip>',
port=54321,
username='**',
password='**',
extra_classpath = ["snowflake-jdbc-3.8.0.jar"])
H2O version: 3.22.1.1
Python 3
extra_classpath is for use when starting H2O from Python. When you are connecting to H2O that is running on another machine, it has to already be started. So it is up to whoever started it, to have given that extra classpath, as part of the java command, when starting it. (And if a cluster, you have to make sure every node of the cluster uses the exact same command.)
The snowflake jar has to be available, on the path you give, on the server. In fact, there is no need for it to be on the client, unless you are also using it directly from your Python script (i.e. outside of h2o).
BTW, see https://github.com/h2oai/h2o-3/blob/master/h2o-py/h2o/h2o.py#L147 for the code. If you search for uses of extra_classpath you see it is only used when starting the local server.

Can't connect to database 'embedded_db', available server_db

I am trying to connect to the neo4j-database-files (embedded) from ruby.
Now I am getting this error:
Can't connect to database 'embedded_db', available server_db (Neo4j::Session::InitializationError)
Is using the embedded-connection only possible with JRuby? I am currently using the "standard" ruby.
Or is it because the folder is empty? How would I create an empty new database (embedded-ly) from within Ruby?
Found the docs, answering my own question:
Connecting to the neo4j-files is possible only from within the jRuby-Process:
http://neo4jrb.readthedocs.org/en/stable/Setup.html

How to connect to Cassandra using ruby

I am new to Cassandra and was trying to achieve some simple
operations like inserting data into cassandra. I am using cassandra gem
to achieve this.
client = Cassandra.new('tags_logs', 'ec2-xxx-xxx-xxx.com:9160')
client.disable_node_auto_discovery!
client.get('tag_data','red')
And I get the following error:
ThriftClient::NoServersAvailable - No live servers in ...
I'm running this code from my local machine. And while I've no problem connecting using cassandra-cli (so it is not a firewall issue), the code refuses to work. It works perfectly when accessing Cassandra on my own local machine.
Any ideas?
Thanks,
Eden.
I recommend you to use this gem I'm developing: https://github.com/hsgubert/cassandra_migrations
It gives access to Cassandra through CQL3 and manages schema with migrations.
Note: it requires Rails.
For future generations: simply change the timeout ...
client = Cassandra.new('tags_logs', 'ec2-example-example-example.com:9160',:connect_timeout => 10000)

Resources