Apache Polygene connect with MongoDB EntityStore - mongodb

I'm using Apache Polygene (Qi4j) 2.1 and I'm trying to use the MongoDB entity store with multiple nodes and replicaSet.
my current configuration in my mongodb.booking.store.properties file is:
hostname=localhost
port=27017
nodes=192.168.1.100:27017, 192.168.1.101:27017, 192.168.1.102:27017
database=example
collection=example
I get back the following error:
org.qi4j.api.value.NoSuchValueException: Could not find any visible ValueComposite of type [com.mongodb.ServerAddress] in module [config]
But when I remove the nodes property from the above file, then it all works fine and the connection with mongo is successful.
How can I use multiple nodes and replicaSet?

This was an unfortunate release of the MongoDB extension, and there is no good answer to initialize this configuration from properties files.
Polygene 3.0 was released in July 2017 and this particular issue was solved. See https://issues.apache.org/jira/browse/POLYGENE-172

Related

How can I connect to an Atlas cluster with the SRV connection string format using ReactiveMongo?

I have a play scala app and i have an atlas cluster which i am trying to connect. According to the ReactiveMongo this is possible. I can add my connection string gotten from Atlas to my app via
mongodb.uri
In my application.conf file. I have tried everything based on the instructions from reactivemongo and atlas db but i am still unable to connect to the cluster. using my mongoshell however, i am able to connect and have access to my db but it simply refuses to connect via my app.
Mongo simply returns an error "MongoError['No primary node is available! (Supervisor-13/Connection-14)']" } and logs a warning in my console Some options were ignored because they are not supported (yet): w, retryWrites. I am using scala version 2.12 and reactivemongo 0.12.6 with play 2.6.
My connection string is mongodb+srv://<username>:<password>#my-cluster.abo25.mongodb.net/my-db?retryWrites=true&w=majority
Any info or help would be greatly appreciated.
Solved my problem. It turns out the +srv string format works seamlessly from reactivemongo version 0.17 and i was initially on 0.16. After i upgraded (and also upgraded my code), i was able to connect to my cluster. I also found out one of the user credentials i was using was wrong so that plus the upgrade got me up and running.

Mongo Spark connector with several hosts

I try to connect Spark to MongoDB using mongo-spark-connector_2.10-2.0.0 but it doesn't work when I have several hosts in the URI
My URI looks like that :
mongodb://login:password#cluster0-shard-0xxxxx:27017,cluster0-shard-0yyyyy:27017,cluster0-shard-0zzzzz:27017/database?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin
and I get errors like this
Command failed with error 8000: &apos;no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.&apos; on server cluster0-shard-0xxxxx
It works fine with other URIs that only have 1 host.
The problem was that I was using Atlas Free tier that requires SNI, which is not supported by the Mongo Java driver currently used by mongo-spark-connector_2.10-2.0.0.

OrientDB - How to configure OSystem database path?

Since 2.2.0, OrientDB now has a system database named OSystem. I'm looking for a way to configure the path to this database independently from other databases? Is this possible? Can I do this at runtime with environment variables?
Thanks!
This is currently not supported.
However, I'll try to add support for this in an upcoming release.
Thanks for the suggestion.
-Colin
OrientDB LTD
The Company behind OrientDB
I've done some tests, trying to set different paths in orientdb-server-config.xml properties, but after every server start OrientDB checks for OSystem DB presence, and if there is no one, it will automatically create it in default /databases/ folder:
2016-06-17 15:13:26:738 INFO {db=OSystem} Creating the system database 'OSystem' for current server [OSystemDatabase]

Error trying to load driver for generic database configuration in Mule

I am using Mule 3.6 and would like to use the bulk insert option on the Generic Database Configuration to load data into mongodb 3.0.8.
I have entered the URL as:
jdbc:mongo://localhost:27017/test
and have tried a number of different Mongo and JDBC drivers but keep receiving the message "Test connection failed. Error trying to load driver..."
How can I configure the Generic Database Connector in Mule to connect to Mongo?
As already stated in this post, there is no official JDBC driver for MongoDB but one the suggested alternatives is using UnityJDBC.
If you decide to follow the UnityJDBC approach, then:
Download and install the driver by executing the following command:
java -jar UnityJDBC_Trial_Install.jar
Go to the installation folder and copy mongodb_unityjdbc_full.jar to the classpath of your Mule app.
Configure the URL and Driver in the Global Element of your Generic Database component (the values you provided are OK):
URL: jdbc:mongo://<host>:<port>/<database>
Driver Class Name: mongodb.jdbc.MongoDriver
If not, use the MongoDB Connector as suggested by #JoostD.
You need to use the MongoDB connector, it should be included in studio.
Otherwise install it from the Anypoint Exchange:
https://www.mulesoft.com/exchange/#!/mongodb-integration-connector
Also see some example on it:
https://www.mulesoft.com/exchange/#!/importing-csv-into-mongodb

Connect Gremlin shell to Titan Elasticsearch/Cassandra embedded instance?

I'm using Titan 0.3.2 in embedded mode with Cassandra and Elasticsearch. I am using the configuration documented in the titan docs for my cassandra-es.properties (fed into titan.sh/titan.bat):
storage.backend=embeddedcassandra
storage.cassandra-config-dir=config/cassandra.yaml
storage.index.search.backend=elasticsearch
storage.index.search.directory=/tmp/searchindex
storage.index.search.client-only=false
storage.index.search.local-mode=true
But I'm trying to get the right configuration for bin/cassandra-es.local to connect to the Titan server via the Gremlin client shell (with g = TitanFactory.open("cassandra-es.local") ). If I try to use the default version included with the download:
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
The graph won't know anything about the ES index ("Index is unknown or not configured: search").
If I configure it with:
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
storage.index.search.backend=elasticsearch
storage.index.search.client-only=false
storage.index.search.directory=/tmp/cassandra/elasticsearch
It will create an ES instance on another port that seems to exist separately from the one used by the server.
My question: (how) can I set up my Gremlin console to properly communicate with the Titan Embedded Server?
There was some recent discussion about this on the Google group. It looks like it's actually not possible to run two ES instances on one machine, so one of the easier ways around this is to set up ES separately on a VM.
I tried out this solution, and it works fine with these lines in both cassandra-es.local and titan-server-cassandra-es.properties:
storage.index.search.backend=elasticsearch
storage.index.search.hostname=<VM ES server IP>
storage.index.search.client-only=true
I can now access the same ES index from both the Gremlin shell and the Titan server.