-
Notifications
You must be signed in to change notification settings - Fork 233
MongoDB Specific Features
You would normally define servers to connect to in "kundera.nodes" property under persistence.xml. However, if you have MongoDB servers running on multiple nodes and possibly different ports, This property comes to your rescue. Just specify this in MongoDB XML configuration file (See XML at bottom)
MongoDB lets you choose whether you want to read data from primary or secondary server. You can specify this behaviour in the following way into MongoDB XML configuration file. (See XML at bottom). Possible values are "primary" and "secondary".
You can configure socket timeout (in millisecond) for time period in MongoDB XML configuration file, kundera will wait for connection to MongoDB before timing out. (See XML at bottom)
A sample XML configuration file is given below:
<?xml version="1.0" encoding="UTF-8"?>
<clientProperties>
<datastores>
<dataStore>
<name>mongo</name>
<connection>
<properties>
<property name="read.preference" value="primary"></property>
<property name="socket.timeout" value="100000"></property>
</properties>
<servers>
<server>
<host>192.168.145.168</host>
<port>27017</port>
</server>
<server>
<host>192.168.145.167</host>
<port>27018</port>
</server>
</servers>
</connection>
</dataStore>
</datastores>
</clientProperties>
For a detailed list of property settings available with MongoDb (supported by Kundera ) please refer to : https://github.com/impetus-opensource/Kundera/blob/9f7cd186965704d50c01f9c84fc166ff295d9fd5/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBConstants.java