1、查询当前目录下每个文件的大小
du -sh */ | awk '{printf "%-7s %s\n", ($1 ~ /[GMK]/ ? $1 : "0G"), $2}'
2、清除docker 的空景象
docker image ls|grep none |awk '{print $3}'|xargs docker rmi
2. 使用 mongotop
查看集合级读写
docker exec -it mongodb-latest mongotop --host=localhost -u admin -p yourpassword --authenticationDatabase=admin
输出示例:
ns total read write
test.users 105ms 25ms 80ms
test.orders 80ms 60ms 20ms
3. 使用 mongostat
工具(推荐)
# 进入容器执行
docker exec -it mongodb-latest mongostat --host=localhost --username=admin --password=yourpassword --authenticationDatabase=admin
# 或直接从宿主机执行(需安装mongo-tools)
mongostat --host=localhost:27017 -u admin -p yourpassword --authenticationDatabase=admin
输出示例(关键指标说明):
insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn time
0 10 5 0 0 1|0 0.0% 0.0% 0 1.21G 1.21G 0|0 1|0 12k 156k 5 14:02:01
4、MySql查询正在执行的Sql
select * from information_schema.processlist where command!='sleep';