Connecting reporting tools to Secondary server

56 views
Skip to first unread message

Ankur Agarwal

unread,
Jun 24, 2016, 10:57:44 PM6/24/16
to mongodb-user
Hi - We have a 3 node mongodb set-up where one is primary, 2nd is secondary and 3rd one is hidden. We intend to install a reporting tool and would want that tool to be able to connect and read from secondary only without disturbing the primary and live site. From shell it can be achieved by specifying read preference. Could you please advise how that can be done from tools where its expected to put the server URL, port directly?

regards,

Stephen Steneker

unread,
Jun 25, 2016, 11:36:29 PM6/25/16
to mongodb-user

On Friday, 24 June 2016 19:57:44 UTC-7, Ankur Agarwal wrote:

Hi - We have a 3 node mongodb set-up where one is primary, 2nd is secondary and 3rd one is hidden. We intend to install a reporting tool and would want that tool to be able to connect and read from secondary only without disturbing the primary and live site. From shell it can be achieved by specifying read preference. Could you please advise how that can be done from tools where its expected to put the server URL, port directly?

Hi Ankur,

The exact configuration will depend on your reporting tool, but typically tools will use the MongoDB Connection String URI Format which allows you to specify read preferences and other connection options. For support using specific reporting tools, you would be best contacting the company/developer for that tool.

However, with your replica set connection as described I would expect you would be more likely to use the hidden secondary for reporting. By design, hidden secondaries are not visible via replica set connections or read preferences so you have to connect to those directly.

Regards,
Stephen

Ankur Agarwal

unread,
Nov 11, 2016, 2:49:14 AM11/11/16
to mongodb-user
Hi Stephen,

Thanks for your reply! and my apologies for late revert.

yes I would prefer to connect to hidden secondary. Have you done that in past? Can i connect to hidden (via mongo shell) and read data from it?

regards,
Ankur

Stephen Steneker

unread,
Nov 17, 2016, 12:17:35 AM11/17/16
to mongodb-user
On Friday, 11 November 2016 18:49:14 UTC+11, Ankur Agarwal wrote:
Thanks for your reply! and my apologies for late revert.

yes I would prefer to connect to hidden secondary. Have you done that in past? Can i connect to hidden (via mongo shell) and read data from it?

Hi Ankur,

Yes, you can connect directly to a hidden secondary using the mongo shell or another driver/tool. You will need to allow secondary reads to do so.

For example, in the mongo shell call rs.slaveOk() before making any queries.

Regards,
Stephen
Reply all
Reply to author
Forward
0 new messages