I'm reading the documentation of orion Context Broker and in the command line arguments I dont see any argument to set the read preference to my replicaset of mongoDB. In my application I need to set that the read preference have the option nearest to avoid bottle necks in high query traffic periods. Does anyone know if is possible?
Current Orion version (3.3.1) doesn't allow to set read preference. There is an open issue in the Orion repository about implement the -mongoUri
CLI parameter to allow setting the MongoDB connection URI (so you could add for instance &readPreference=secondary
to it).
Alternatively, you could hack the Orion source code to build an specific version for you with the readPreference
value you want. Have a look to composeMongoUri()
function. It seems it is a matter of just addding uri += optionPrefix + "readPreference=<whatever you want>";
at the end.
It is not a smart soluction (it is not flexible and you would need to rebuild Orion if you want to change the setting) but it could be a valid workaround while -mongoUri
gets implemented.
EDIT: -dbURI
(the final name changed from -mongoUri
) has been finally implemented. It is currently available in the telefonicaiot/fiware-orion:latest
dockerhub build and it will be available in Orion 3.11.0 (to be released soon).