In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Mongodb Monitoring tool mongosniff
Introduction
Mongosniff provides a low-level operational tracking and sniffing view of database real-time activity. Mongosniff can be thought of as customized for MongoDB, similar to tcpdump for TCP/IP network traffic analysis. Mongosniff is often used to drive development.
Note: mongosniff requires libpcap and is only available for Unix-like systems.
As opposed to mongosniff,Wireshark, a popular network sniffing tool can be used to detect and parse the MongoDB wire protocol.
Usage
The following command connects to mongod or mongos running on 27017 and 27018 of localhost:
Mongosniff-source NET lo 27017 27018
The following command records only invalid BSON objects for mongod or mongos running on 27018 of localhost to drive development and problem tracking:
Mongosniff-objcheck-source NET lo 27018
Practice
[root@test ~] # mongosniff-- help mongosniff: error while loading shared libraries: libpcap.so.0.9: cannot open shared object file: No such file or directory [root@test ~] # which mongosniff / usr/bin/mongosniff [root@test ~] # ldd / usr/bin/mongosniff linux-vdso.so.1 = > (0x00007fffe2d7a000) libpthread.so.0 = > / lib64/libpthread.so.0 (0x0000003558e00000) librt.so.1 = > / lib64/librt.so.1 (0x0000003559200000) libpcap.so.0.9 = > not found libstdc++.so.6 = > / usr/lib64/libstdc++.so.6 (0x0000003559e00000) libm.so.6 = > / lib64/libm.so.6 (0x0000003559600000) libgcc_s.so.1 = > / lib64/libgcc_s.so.1 (0x000000355a600000) libc.so.6 = > / lib64/libc.so .6 (0x0000003558a00000) / lib64/ld-linux-x86-64.so.2 (0x0000003558200000)
You can see that libpcap.so.0.9 = > not found is not found.
[root@test ~] # cd / usr/lib64 [root@test lib64] # ls-al | grep libpcap lrwxrwxrwx. 1 root root 16 Feb 26 17:28 libpcap.so.1-> libpcap.so.1.4.0-rwxr-xr-x 1 root root 260880 Nov 22 2013 libpcap.so.1.4.0
Add a soft connection.
[root@test lib64] # ln-s / usr/lib64/libpcap.so.1.4.0 / usr/lib64/libpcap.so.0.9
Check the help again.
[root@test lib64] # mongosniff-- help Usage: mongosniff [--help] [--forward host:port] [--source (NET | (FILE | DIAGLOG))] [...]-- forward Forward all parsed request messages to mongod instance at specified host:port-- source Source of traffic to sniff, either a network interface or a file containing previously captured packets in pcap format Or a file containing output from mongod's-- diaglog option. If no source is specified, mongosniff will attempt to sniff from one of the machine's network interfaces. -- objcheck Log hex representation of invalid BSON objects and nothing else. Spurious messages about invalid objects may result when there are dropped tcp packets. ... These parameters are used to filter sniffing. By default, only port 27017 is sniffed. -- help Print this help message.
Grab the bag:
[root@test lib64] # / usr/bin/mongosniff-- source NET bond0 > / var/log/currentOp/sniff.log
Here are some of the contents of sniff.log:
10.10.0.1 MyTest.Pro 1042 bytes id:41d99 269721 query: {$query: {id: {$in: [380,383]}, Availability.Status: {$lt: 5}, $or: [{id: {$lt: 331}}, {id: {$gt: 200, $lt: 400}, {id: {$gt: 600, $lt: 800}}]} $orderby: {Availability.Status: 1}} ntoreturn: 0 ntoskip: 0 hasfields SlaveOk
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.