bobthecow / genghis

The single-file MongoDB admin app
http://genghisapp.com
MIT License
1.45k stars 166 forks source link

"Unkown Error" when connecting to secondary server in replica set. #133

Open codazoda opened 11 years ago

codazoda commented 11 years ago

I'm running 6 Mongo servers. Only one of those is the primary (which changes from time to time). I'm able to connect to the primary server using Genghis, but I'm not able to connect to any of the secondary servers. When I do, I get an "Unknown Error" at the top and a waiting indicator that never finishes.

screen shot 2013-08-28 at 9 33 41 am

bobthecow commented 11 years ago

Do you mind checking your JavaScript console or Network tab and looking for errors for me?

codazoda commented 11 years ago

In the Javascript console I have the following:

GET http://dropbox.dev/ksl/genghis/genghis.php/servers/mongodb-rs1.ksl.com/databases 500 (Internal Server Error) Uncaught Error: A "url" property or function must be specified

Here's the response from the network tab, which you might find useful. In particular, the "500: not master and slaveOk=false" error. According to the interwebs, this is the same error I would get if I tried to read from a slave if I hadn't run rs.slaveOk() in a console (which prevents you from accidentally treating "eventually consistent" data as if it were current). Maybe that could be added as a command you initially send to mongo on connection.

<!DOCTYPE html> Genghis — 500: not master and slaveOk=false

500: not master and slaveOk=false

If you think you've reached this message in error, please press 0 to speak with an operator. Otherwise, hang up and try again.

bobthecow commented 11 years ago

Gotcha. Just add ?slaveOk=true to the end of your server URI, and you should be good.

codazoda commented 11 years ago

Not sure where to put it. I tried adding ?slaveOk=true to the end of the server config and I get this.

screen shot 2013-08-29 at 1 35 43 pm

Then I tried adding it, manually, to the URL after clicking that link and I get this.

screen shot 2013-08-29 at 1 36 37 pm

bobthecow commented 11 years ago

Yeah, that should have worked :-/

theartoflogic commented 10 years ago

I have v2.3.8 and I tried adding ?slaveOk=true but I get an error: "Unsupported connection option - slaveOk"

In the (PHP) code I see a switch statement that explicitly calls out "slaveOk" in one of the cases that throws the "Unsupported connection option..." exception. Is connecting to a slave now explicitly disabled?

bobthecow commented 10 years ago

You're absolutely right. I'd forgotten that slaveOk support was dropped because Genghis doesn't have a read-only mode.

pierre-b commented 10 years ago

+1. I also have this "Error: A "url" property or function must be specified", even when I select the primary server. Just updated to the 2.6.1 version of mongodb, any coincidence ? Thx

shordeaux commented 10 years ago

I have something similar but before this error, I have another one:

500: PHP error:  Genghis_Json::doEncode(): The 'sec' property is read-only
bobthecow commented 10 years ago

@shordeaux Yours is definitely an error, but is completely unrelated :)

Commenting on your pull request.