void printMongoStatHelp(const moe::OptionSection options, std::ostream* out) { *out << "View live MongoDB performance statistics.\n" << std::endl; *out << "usage: mongostat [options] [sleep time]" << std::endl; *out << "sleep time: time to wait (in seconds) between calls" << std::endl; *out << options.helpString(); *out << "\n"; *out << " Fields\n"; *out << " inserts \t- # of inserts per second (* means replicated op)\n"; *out << " query \t- # of queries per second\n"; *out << " update \t- # of updates per second\n"; *out << " delete \t- # of deletes per second\n"; *out << " getmore \t- # of get mores (cursor batch) per second\n"; *out << " command \t- # of commands per second, on a slave its local|replicated\n"; *out << " flushes \t- # of fsync flushes per second\n"; *out << " mapped \t- amount of data mmaped (total data size) megabytes\n"; *out << " vsize \t- virtual size of process in megabytes\n"; *out << " res \t- resident size of process in megabytes\n"; *out << " faults \t- # of pages faults per sec\n"; *out << " locked \t- name of and percent time for most locked database\n"; *out << " idx miss \t- percent of btree page misses (sampled)\n"; *out << " qr|qw \t- queue lengths for clients waiting (read|write)\n"; *out << " ar|aw \t- active clients (read|write)\n"; *out << " netIn \t- network traffic in - bytes\n"; *out << " netOut \t- network traffic out - bytes\n"; *out << " conn \t- number of open connections\n"; *out << " set \t- replica set name\n"; *out << " repl \t- replication type \n"; *out << " \t PRI - primary (master)\n"; *out << " \t SEC - secondary\n"; *out << " \t REC - recovering\n"; *out << " \t UNK - unknown\n"; *out << " \t SLV - slave\n"; *out << " \t RTR - mongos process (\"router\")\n"; *out << std::flush; }
void printMongoRestoreHelp(const moe::OptionSection options, std::ostream* out) { *out << "Import BSON files into MongoDB.\n" << std::endl; *out << "usage: mongorestore [options] [directory or filename to restore from]" << std::endl; *out << options.helpString(); *out << std::flush; }
void printMongoImportHelp(const moe::OptionSection options, std::ostream* out) { *out << "Import CSV, TSV or JSON data into MongoDB.\n" << std::endl; *out << "When importing JSON documents, each document must be a separate line of the input file.\n"; *out << "\nExample:\n"; *out << " mongoimport --host myhost --db my_cms --collection docs < mydocfile.json\n" << std::endl; *out << options.helpString(); *out << std::flush; }
std::string getMongoShellHelp(StringData name, const moe::OptionSection& options) { StringBuilder sb; sb << "usage: " << name << " [options] [db address] [file names (ending in .js)]\n" << "db address can be:\n" << " foo foo database on local machine\n" << " 192.168.0.5/foo foo database on 192.168.0.5 machine\n" << " 192.168.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999\n" << options.helpString() << "\n" << "file names: a list of files to run. files have to end in .js and will exit after " << "unless --shell is specified"; return sb.str(); }
void printMongoFilesHelp(const moe::OptionSection options, std::ostream* out) { *out << "Browse and modify a GridFS filesystem.\n" << std::endl; *out << "usage: mongofiles [options] command [gridfs filename]" << std::endl; *out << "command:" << std::endl; *out << " one of (list|search|put|get)" << std::endl; *out << " list - list all files. 'gridfs filename' is an optional prefix " << std::endl; *out << " which listed filenames must begin with." << std::endl; *out << " search - search all files. 'gridfs filename' is a substring " << std::endl; *out << " which listed filenames must contain." << std::endl; *out << " put - add a file with filename 'gridfs filename'" << std::endl; *out << " get - get a file with filename 'gridfs filename'" << std::endl; *out << " delete - delete all files with filename 'gridfs filename'" << std::endl; *out << options.helpString(); *out << std::flush; }
void printMongodHelp(const moe::OptionSection& options) { std::cout << options.helpString() << std::endl; };
void printMongoExportHelp(const moe::OptionSection options, std::ostream* out) { *out << "Export MongoDB data to CSV, TSV or JSON files.\n" << std::endl; *out << options.helpString(); *out << std::flush; }
std::string getTestFrameworkHelp(const StringData& name, const moe::OptionSection& options) { StringBuilder sb; sb << "usage: " << name << " [options] [suite]...\n" << options.helpString() << "suite: run the specified test suite(s) only\n"; return sb.str(); }
Status addMongoShellOptions(moe::OptionSection* options) { typedef moe::OptionDescription OD; typedef moe::PositionalOptionDescription POD; Status ret = options->addOption(OD("shell", "shell", moe::Switch, "run the shell after executing files", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("nodb", "nodb", moe::Switch, "don't connect to mongod on startup - no 'db address' arg expected", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("norc", "norc", moe::Switch, "will not run the \".mongorc.js\" file on start up", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("quiet", "quiet", moe::Switch, "be less chatty", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("port", "port", moe::String, "port to connect to" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("host", "host", moe::String, "server to connect to" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("eval", "eval", moe::String, "evaluate javascript" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("username", "username,u", moe::String, "username for authentication" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("password", "password,p", moe::String, "password for authentication" , true, moe::Value(), moe::Value(std::string("")))); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("authenticationDatabase", "authenticationDatabase", moe::String, "user source (defaults to dbname)" , true, moe::Value(std::string("")))); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("authenticationMechanism", "authenticationMechanism", moe::String, "authentication mechanism", true, moe::Value(std::string("MONGODB-CR")))); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("help", "help,h", moe::Switch, "show this usage information", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("version", "version", moe::Switch, "show version information", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("verbose", "verbose", moe::Switch, "increase verbosity", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("ipv6", "ipv6", moe::Switch, "enable IPv6 support (disabled by default)", true)); if (!ret.isOK()) { return ret; } #ifdef MONGO_SSL ret = options->addOption(OD("ssl", "ssl", moe::Switch, "use SSL for all connections", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("ssl.CAFile", "sslCAFile", moe::String, "Certificate Authority for SSL" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("ssl.PEMKeyFile", "sslPEMKeyFile", moe::String, "PEM certificate/key file for SSL" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("ssl.PEMKeyPassword", "sslPEMKeyPassword", moe::String, "password for key in PEM file for SSL" , true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("ssl.CRLFile", "sslCRLFile", moe::String, "Certificate Revocation List file for SSL", true)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("ssl.FIPSMode", "sslFIPSMode", moe::Switch, "activate FIPS 140-2 mode at startup", true)); if (!ret.isOK()) { return ret; } #endif ret = options->addOption(OD("dbaddress", "dbaddress", moe::String, "dbaddress" , false)); if (!ret.isOK()) { return ret; } ret = options->addOption(OD("files", "files", moe::StringVector, "files" , false)); if (!ret.isOK()) { return ret; } // for testing, kill op will also be disabled automatically if the tests starts a mongo program ret = options->addOption(OD("nokillop", "nokillop", moe::Switch, "nokillop", false)); if (!ret.isOK()) { return ret; } // for testing, will kill op without prompting ret = options->addOption(OD("autokillop", "autokillop", moe::Switch, "autokillop", false)); if (!ret.isOK()) { return ret; } ret = options->addPositionalOption(POD("dbaddress", moe::String, 1)); if (!ret.isOK()) { return ret; } ret = options->addPositionalOption(POD("files", moe::String, -1)); if (!ret.isOK()) { return ret; } return Status::OK(); }
void printMongoOplogHelp(const moe::OptionSection options, std::ostream* out) { *out << "Pull and replay a remote MongoDB oplog.\n" << std::endl; *out << options.helpString(); *out << std::flush; }
void printBSONDumpHelp(const moe::OptionSection options, std::ostream* out) { *out << "Display BSON objects in a data file.\n" << std::endl; *out << "usage: bsondump [options] <bson filename>" << std::endl; *out << options.helpString(); *out << std::flush; }