M312 - Chapter 4 - Hostnames and Cluster Configuration, Part 1


I am using Windows 10.
I keep getting the same error when running ‘mongo’ in Vagrant, as follows:

nodes-vagrant-env> mongo --host --eval “rs.initiate({’_id’: ‘M312’, ‘members’: [{’_id’: 0, ‘host’: ‘’}, {’_id’: 1, ‘host’: ‘m2.university.mongodb’}, {’_id’: 2, ‘host’: ‘m3’}]})”

‘mongo’ is not recognized as an internal or external command, operable program or batch file.

I did follow the instructions of another thread www.mongodb.com/community/forums/t/its-hard-to-follow-up-the-instructions-from-m312-hostnames-and-cluster-configuration-part-1/91294/4 but they didn’t resolve the problem:

BTW, the following commands executed successfully:
vagrant ssh m1 – -t ‘mongod -f /shared/mongod.cnf --bind_ip localhost,’
vagrant ssh m2 – -t ‘mongod -f /shared/mongod.cnf --bind_ip localhost,’
vagrant ssh m3 – -t ‘mongod -f /shared/mongod.cnf --bind_ip localhost,’

How can I solve my problem??
Rhonda T

You are running the mongo command with --eval from your Windows prompt which is not correct
You should run it at vagrant prompt

The second set of commands are working because it ssh’s to vagrant box and runs it there