Error running "mongos --help" on Windows

179 views
Skip to first unread message

Nick Hird

unread,
Feb 9, 2012, 2:15:32 PM2/9/12
to mongod...@googlegroups.com
I am reading the book MongoDB in Action and i have successfully setup my replication sets and i wanted to continue on and setup a shard cluster. So i followed along in the book and i have my servers running and my config servers running, all seems to be going well until i get to the point where i run mongos, i guess that's where the config servers come in. and i immediately get an error "error command line: too many positional options". So i just try "mongos --help" as it suggests and i get the same error.

I am running Windows 7 x64 with mongo 2.0.2 x64. I have all the servers running on a single machine for this demo and i can't seem to figure out what is causing this issue. Is this because i am using Windows or is there something else going on with my setup or the files?

Thanks,
--Nick

Tad Marshall

unread,
Feb 9, 2012, 4:05:58 PM2/9/12
to mongodb-user
That is very odd. I assume that this is a downloaded version from
http://www.mongodb.org/downloads and not a version you built
yourself. Do you get the same error message if you type "mongos --
version"? I get this:

C:\Bin\MongoDB\202>mongos --version
Thu Feb 09 15:52:26 mongos db version v2.0.2, pdfile version 4.5
starting (--help for usage)
Thu Feb 09 15:52:26 git version:
514b122d308928517f5841888ceaa4246a7f18e3
Thu Feb 09 15:52:26 build info: windows (6, 1, 7601, 2, 'Service Pack
1') BOOST_LIB_VERSION=1_42

The text "too many positional options" matches error text that the
Boost program_options library includes ( C:\boost\boost\program_options
\errors.hpp ) so if something went wrong in the build I could see how
this error might be produced. In fact, mistyping the command in any
of several ways seems to produce this message:

C:\Bin\MongoDB\202>mongos help
error command line: too many positional options
use --help for help

C:\Bin\MongoDB\202>mongos -- help
error command line: too many positional options
use --help for help

C:\Bin\MongoDB\202>mongos --help
General options:
-h [ --help ] show this usage information
--version show version information
-f [ --config ] arg configuration file specifying additional
options
-v [ --verbose ] be more verbose (include multiple times for
more
verbosity e.g. -vvvvv)
--quiet quieter output
--port arg specify port number
--bind_ip arg comma separated list of ip addresses to listen
on - all
local ips by default
--maxConns arg max number of simultaneous connections
--objcheck inspect client data for validity on receipt
--logpath arg log file to send write to instead of stdout -
has to be
a file, not directory
--logappend append to logpath instead of over-writing
--pidfilepath arg full path to pidfile (if not set, no pidfile
is
created)
--keyFile arg private key for cluster authentication (only
for
replica sets)

Sharding options:
--configdb arg 1 or 3 comma separated config servers
--test just run unit tests
--upgrade upgrade meta data version
--chunkSize arg maximum amount of data per chunk
--ipv6 enable IPv6 support (disabled by default)
--jsonp allow JSONP access via http (has security
implications)
--noscripting disable scripting engine

C:\Bin\MongoDB\202>

Nick Hird

unread,
Feb 9, 2012, 4:45:12 PM2/9/12
to mongod...@googlegroups.com
I downloaded the release from the website. I am not brave enough to build the stuff myself yet.

I opened up a new console and tried "mongos --version" and it worked. I then tried "mongos --help" and that worked too, so i figured i was in the clear but when i typed the actual command to get things rolling, i get the error again. So either i have something else wrong in the command below or there is another error that i just cant see. 

C:\MongoDB\bin>mongos --configdb br-pc-nb-nhird:27019,br-pc-nb-nhird:27020,br-pc-nb-nhird:27021 --port 40000 --chunkSize 1

error command line: too many positional options
use --help for help

mongos --version
Thu Feb 09 16:42:28 mongos db version v2.0.2, pdfile version 4.5 starting (--help for usage)
Thu Feb 09 16:42:28 git version: 514b122d308928517f5841888ceaa4246a7f18e3
Thu Feb 09 16:42:28 build info: windows (6, 1, 7601, 2, 'Service Pack 1') BOOST_LIB_VERSION=1_42

Tad Marshall

unread,
Feb 9, 2012, 5:25:31 PM2/9/12
to mongodb-user
Try putting quotes around your list of config servers. Your command
line actually works fine for me without quotes (I get the expected
error messages due to not having hosts with the specified names), but
I get the "positional" error message if I put a space after a comma,
for example. With quotes around the list of config servers, spaces in
the list don't give me the error.

rem Spaces added for testing ...
C:\MongoDB\bin>mongos --configdb "br-pc-nb-nhird:27019, br-pc-nb-nhird:
27020, br-pc-nb-nhird:27021" --port 40000 --chunkSize 1

Any theory for why "mongos --help" wasn't working before but now is
working? Could your keyboard be sneaking in characters that you can't
see?

Nick Hird

unread,
Feb 10, 2012, 6:05:40 AM2/10/12
to mongod...@googlegroups.com
This may sound wierd but i think its a Windows problem. If i dont have all 9 servers running i can run the mongos command and get back the missing server message but it at least runs. When i have all 9 other servers running i get the other error. So maybe Windows just isnt meant to run all of those servers on the same box. I might start them up one by one and see at what point the command stops running.

Tad Marshall

unread,
Feb 10, 2012, 9:14:50 AM2/10/12
to mongodb-user
Your theory sounds as good as anything I can think of. As you may
know, when Windows runs out of memory pretty much anything can fail.
Mark Russinovich gives a graphic demonstration in one of his TechNet
videos, where he shows Windows failing to paint the screen properly
when he exhausts memory.

To reduce the memory load from your flock of mongod instances, you
could add --smallfiles on the command line when you start them, and
manually set a smaller oplog size. Since you already have created
oplogs (in your various local.* files) you would have to remove them
before you can create smaller ones. If you have nothing important in
your local databases, you could just delete local.* in each directory
and then start mongod.exe with a "--oplogSize 100" (for example) to
create a 100 MB oplog. Task Manager should give you a sense of how
much memory you are using ... --smallfiles and a smaller oplog should
reduce the load.

Nick Hird

unread,
Feb 10, 2012, 10:34:47 AM2/10/12
to mongod...@googlegroups.com
I have 8gb of memory but went ahead and changed the oplogSize to 100 and added smallfiles and that all went well. I just have the 2 replica sets running and the mongos command gives me the same error. Maybe i should just try to create the shards w/out the replicaSets and see if that works. Maybe its just a windows limitation or something. The machine i am using is pretty beefy.

Tad Marshall

unread,
Feb 10, 2012, 11:13:01 AM2/10/12
to mongodb-user
Both replica sets and sharding are designed to be spread across
machines, so you are deep in the "testing" range, but we do run test
suites that exercise these features on single machines. Your plan of
cutting back until it behaves properly sounds like a good debugging
plan. Unless you are running out of memory or hitting some limit I
don't know about, this really should work, and having the failure show
up in command line parsing seems very odd. Let us know what you find
out, thanks!

Nick Hird

unread,
Feb 10, 2012, 3:37:45 PM2/10/12
to mongod...@googlegroups.com
I am able to run a a shard server without a replica set and a replica set without a shard server but not both at the same time on the same machine. I am thinking this is some sort of windows limitation with the command prompt stack or something. I checked my resources while things were running and i have plenty of memory and cpu. I got each piece to work seperatly so thats good. If i can get my hands on a linux box i will try again.
 
Thanks for the help!
--Nick
Reply all
Reply to author
Forward
0 new messages