I have one primary and two secondaries on aws using ELB. What is best practice for reading and writing?
1) Do I create a single LB with all nodes in the ELB with the primary and secondaries and let the python (pymongo) deal with sorting out to read and write do?
2) Or do a place all secondaries under ELB and assign a primary to an elastic IP? This will require a script to keep track of node type and reassign if fail-over.
I am hoping for option 1.
It depends on your situation. With the mongodb drivers, you do not have to keep track of which node the client is connecting to – you merely have to inform it about the replica set and it will automatically connect to the primary and handle failover.
If you want to distribute read load, then you can set read preference to allow an application to read from secondaries, but you will only ever be able to write to the primary. That means that setting ELB for all incoming connections is unnecessary, and could even hurt you because it could cause writes to be sent to secondaries (where they will fail). Using read preference will allow you to distribute reads, so in your case, I would recommend not using the ELB.
In general, I would take a look at http://www.slideshare.net/jrosoff/mongodb-on-ec2-and-ebs. You may find it helpful.