-
Notifications
You must be signed in to change notification settings - Fork 0
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>