§2024-11-03
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2404-arm64-100.10.0.tgz
$ tar xvf src/mongodb-database-tools-ubuntu2404-arm64-100.10.0.tgz
mongodb-database-tools-ubuntu2404-arm64-100.10.0/LICENSE.md
mongodb-database-tools-ubuntu2404-arm64-100.10.0/README.md
mongodb-database-tools-ubuntu2404-arm64-100.10.0/THIRD-PARTY-NOTICES
mongodb-database-tools-ubuntu2404-arm64-100.10.0/mongodb-database-tools-ubuntu2404-arm64-100.10.0.tgz.cdx.json
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/bsondump
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongodump
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongoexport
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongofiles
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongoimport
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongorestore
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongostat
mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin/mongotop
lexlai@hc4Noble:~/build/mongodb-database-tools-ubuntu2404-arm64-100.10.0/bin$ sudo cp -v * /usr/local/bin
[sudo] password for alexlai:
'bsondump' -> '/usr/local/bin/bsondump'
'mongodump' -> '/usr/local/bin/mongodump'
'mongoexport' -> '/usr/local/bin/mongoexport'
'mongofiles' -> '/usr/local/bin/mongofiles'
'mongoimport' -> '/usr/local/bin/mongoimport'
'mongorestore' -> '/usr/local/bin/mongorestore'
'mongostat' -> '/usr/local/bin/mongostat'
'mongotop' -> '/usr/local/bin/mongotop'
¶ README.md
# MongoDB Tools
- **bsondump** - _display BSON files in a human-readable format_
- **mongoimport** - _Convert data from JSON, TSV or CSV and insert them into a collection_
- **mongoexport** - _Write an existing collection to CSV or JSON format_
- **mongodump/mongorestore** - _Dump MongoDB backups to disk in .BSON format, or restore them to a
live database_
- **mongostat** - _Monitor live MongoDB servers, replica sets, or sharded clusters_
- **mongofiles** - _Read, write, delete, or update files in
[GridFS](http://docs.mongodb.org/manual/core/gridfs/)_
- **mongotop** - _Monitor read/write activity on a mongo server_
Report any bugs, improvements, or new feature requests at https://jira.mongodb.org/browse/TOOLS
## Building Tools
We currently build the tools with Go version 1.15. Other Go versions may work but they are untested.
Using `go get` to directly build the tools will not work. To build them, it's recommended to first
clone this repository:
git clone https://github.com/mongodb/mongo-tools cd mongo-tools
Then run `./make build` to build all the tools, placing them in the `bin` directory inside the
repository.
You can also build a subset of the tools using the `-pkgs` option. For example,
`./make build -pkgs=mongodump,mongorestore` builds only `mongodump` and `mongorestore`.
To use the build/test scripts in this repository, you **_must_** set GOROOT to your Go root
directory. This may depend on how you installed Go.
export GOROOT=/usr/local/go
## Updating Dependencies
Starting with version 100.3.1, the tools use `go mod` to manage dependencies. All dependencies are
listed in the `go.mod` file and are directly vendored in the `vendor` directory.
In order to make changes to dependencies, you first need to change the `go.mod` file. You can
manually edit that file to add/update/remove entries, or you can run the following in the repository
directory:
go mod edit -require=
Then run `go mod vendor -v` to reconstruct the `vendor` directory to match the changed `go.mod`
file.
Optionally, run `go mod tidy -v` to ensure that the `go.mod` file matches the `mongo-tools` source
code.
## Contributing
See our [Contributor's Guide](CONTRIBUTING.md).
## Documentation
See the MongoDB packages [documentation](https://docs.mongodb.org/database-tools/).
For documentation on older versions of the MongoDB, reference that version of the
[MongoDB Server Manual](docs.mongodb.com/manual):
- [MongoDB 4.2 Tools](https://docs.mongodb.org/v4.2/reference/program)
- [MongoDB 4.0 Tools](https://docs.mongodb.org/v4.0/reference/program)
- [MongoDB 3.6 Tools](https://docs.mongodb.org/v3.6/reference/program)
## Adding New Platforms Support
See our [Adding New Platform Support Guide](PLATFORMSUPPORT.md).
## Vendoring the Change into Server Repo
See our [Vendor the Change into Server Repo](SERVERVENDORING.md).
- mongotop can not use
mongodb://
style
$ mongotop --host redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017 --username siteRootAdmin --password b23258585 --authenticationDatabase admin 60
- mongostat interval
$ mongostat 60 --host redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017 --username siteRootAdmin --password b23258585 --authenticationDatabase admin
2024-11-03T09:57:01.237+0800 WARNING: On some systems, a password provided directly using --password may be visible to system status programs such as `ps` that may be invoked by other users. Consider omitting the password to provide it via stdin, or using the --config option to specify a configuration file with the password.
host insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time
redisMongo03.yushei.com.tw:27017 *0 *0 *0 *0 4 11|0 0.3% 5.9% 1 8.35G 4.19G 0|0 0|0 7.23k 239k 86 ys20220318 SLV Nov 3 09:58:01.381
redisMongo04.yushei.com.tw:27017 *0 *0 *1 *0 1 4|0 0.5% 14.1% 1 5.49G 1.39G 0|0 0|0 2.89k 5.63k 39 ys20220318 SEC Nov 3 09:58:01.476
host insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time
redisMongo03.yushei.com.tw:27017 *0 2 *0 *0 3 10|0 0.2% 5.9% 1 8.35G 4.18G 0|0 0|0 6.65k 229k 86 ys20220318 SLV Nov 3 09:59:01.382
redisMongo04.yushei.com.tw:27017 *0 *0 *0 *0 1 4|0 0.4% 14.1% 1 5.49G 1.39G 0|0 0|0 2.32k 4.74k 39 ys20220318 SEC Nov 3 09:59:01.483
redisMongo05.yushei.com.tw:27017 *0 *0 *1 *0 0 3|0 0.2% 76.3% 1 5.33G 1.91G 0|0 0|0 760b 3.40k 37 ys20220318 SEC Nov 3 09:58:01.578
redisMongo03.yushei.com.tw:27017 *0 *0 *0 *0 3 10|0 0.3% 5.9% 1 8.35G 4.18G 0|0 0|0 6.70k 236k 86 ys20220318 SLV Nov 3 10:00:01.392
redisMongo04.yushei.com.tw:27017 *0 *0 *0 *0 1 4|0 0.4% 14.1% 1 5.49G 1.39G 0|0 0|0 2.70k 5.26k 39 ys20220318 SEC Nov 3 10:00:01.471
redisMongo05.yushei.com.tw:27017 *0 *0 *0 *0 0 3|0 0.2% 76.3% 1 5.33G 1.91G 0|0 0|0 770b 3.40k 37 ys20220318 SEC Nov 3 09:59:01.646