BIND(三)—— DNS工具和BIND日志.md
BIND(三)—— DNS工具和BIND日志.md
异类深呼吸 发表于4年前
BIND(三)—— DNS工具和BIND日志.md
  • 发表于 4年前
  • 阅读 158
  • 收藏 0
  • 点赞 0
  • 评论 0

新睿云服务器60天免费使用,快来体验!>>>   

摘要: BIND压测和负载工具,包括日志的详细介绍等

<h2 style="margin: 1.5em 0px 1em; padding: 0.5em 0px 0px; -webkit-print-color-adjust: exact; border-width: 4px 0px 0px; border-top-style: solid; border-top-color: #e0e0e0; font-size: 20px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">dns压测</h2> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px;">queryperf在BIND源码包种自带,但是RPM包安装中并没有</p> <h4 style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;">1、安装queryperf</h4> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">//安装依赖 <br />yum groupinstall "Development tools" "Server Platform Development" -y <br /><br />tar xf bind-9.10.0-P1.tar.gz <br />cd bind-9.10.0-P1/contrib/queryperf/ <br />./configure <br />make <br />cp queryperf /bin/ </code></pre> <h4 style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;">2、基本使用</h4> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">queryperf --help //查询帮助 <br /># queryperf -d dns.txt -s 192.168.122.131 <br /><br />DNS Query Performance Testing Tool <br />Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $ <br /><br />[Status] Processing input data <br />[Status] Sending queries (beginning with 192.168.122.131) <br />[Timeout] Query timed out: msg id 1 <br />[Timeout] Query timed out: msg id 2 <br />[Status] Testing complete <br /><br />Statistics: <br /><br /> Parse input file: once <br /> Ended due to: reaching end of file <br /><br /> Queries sent: 2 queries <br /> Queries completed: 2 queries <br /> Queries lost: 0 queries <br /> Queries delayed(?): 0 queries <br /><br /> RTT max: -1.000000 sec <br /> RTT min: -1.000000 sec <br /> RTT average: 0.000000 sec <br /> RTT std deviation: 0.000000 sec <br /> RTT out of range: 0 queries <br /><br /> Percentage completed: 100.00% <br /> Percentage lost: 0.00% <br /><br /> Started at: Mon Jun 2 21:42:25 2014 <br /> Finished at: Mon Jun 2 21:42:30 2014 <br /> Ran for: 5.000052 seconds <br /><br /> Queries per second: 0.399996 qps </code></pre> <h2 style="margin: 1.5em 0px 1em; padding: 0.5em 0px 0px; -webkit-print-color-adjust: exact; border-width: 4px 0px 0px; border-top-style: solid; border-top-color: #e0e0e0; font-size: 20px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">dnstop</h2> <h4 style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;">1、安装dnstop</h4> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">yum install libpcap-devel <br />wget http://dns.measurement-factory.com/tools/dnstop/src/dnstop-20121017.tar.gz <br />tar xf dnstop-20121017.tar.gz <br />cd dnstop-20121017 <br />./configure <br />make <br />make install </code></pre> <h2 style="margin: 1.5em 0px 1em; padding: 0.5em 0px 0px; -webkit-print-color-adjust: exact; border-width: 4px 0px 0px; border-top-style: solid; border-top-color: #e0e0e0; font-size: 20px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">BIND日志</h2> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">先来大致看一段日志格式 <br />logging { <br /> channel b_log { <br /> file "../log/bind.log" versions 30 size 1m; <br /> print-time yes; <br /> print-category yes; <br /> print-severity yes; <br /> severity info; <br />}; <br /><br /> channel b_debug { <br /> file "../log/debug.log" versions 2 size 1m; <br /> print-time yes; <br /> print-category yes; <br /> print-severity yes; <br /> severity dynamic; <br />}; <br /><br /> channel b_query { <br /> file "../log/query.log" versions 2 size 1m; <br /> print-time yes; <br /> severity info; <br />};<br /><br /> category default { b_log; b_debug; }; <br /> category config { b_log; b_debug; }; <br /> category queries { b_query; }; <br />}; </code></pre> <h3 style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">语法</h3> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">logging { <br /> channel string { <br /> file log_file [versions number|unlimited] [size sizespec]; | syslog optional_facility; |null; |stderr;; <br /> severity &lt;logseverity&gt;;; <br /> print-time &lt; yes|no &gt;;; <br /> print-severity boolean;; <br /> print-category boolean;; }; <br /> <br /> category string { string; ... }; <br />}; </code></pre> <h3 style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">1、channel</h3> <ul style="margin: 1em 0px 1em 2em; padding: 0px; -webkit-print-color-adjust: exact; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">在日志配置中主要有channel和category两种类别</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">channel用于指定日志发送目标,其中channel 用下用于指定channel名称,将日志输入到中指定的文件中,这里所指定的路径是一个相对路径,实际路径需要权限全局配置文件options块中direcotry决定,不管指定什么路径named用户必须有写权限</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">versions指定允许同时存在多少个版本的日志文件,比如指定version 3,就会保存logfile.log、logfile.log0、logfile.log1 和logfile.log2,然后建立一个新的log_file.log进行写入的时候,就会删除最开始的logfile.log2,</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">unlimited表示无限制写入,默认就是unlimited。</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">size指定文件大小的上限,如果只指定了size而没有指定versions,当文件达到指定的上限时,BIND将停止写入该日志文件。</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">syslog optional_facility:将日志输入到syslog,其中optional_facility是syslog的设备名。</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">severity:指定日志级别</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">log level:</li> </ul> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">- critical(比error量多严重的错误信息) <br />- error(一些重大的错误信息,比如配置文件的某些值造成该服务无法启动的信息说明,通常由error的错误通知) <br />- warning(可能有错误,但是还不至于影响到服务远行的信息) <br />- notice(比info更需要被注意的一些信息) <br />- info(一些基本的信息说明) <br />- debug(当需要进行错误检查或忽略某些服务的信息时使用) <br />- dynamic(一个特殊的值,它匹配服务器当前的调试级别定义了某个严重性级别后,系统会记录包括该级别以及比该级别更严重的级别的所有消息。比如定义级别为error,则会记录critical和error两个级别的信息) </code></pre> <ul style="margin: 1em 0px 1em 2em; padding: 0px; -webkit-print-color-adjust: exact; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">print-time: 指定在日志中是否需要写入时间</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">print-severity:指定在日志中是否需要写入消息级别</li> <li style="margin: 0.5em 0px; padding: 0px; -webkit-print-color-adjust: exact;">print-category:指定在日志中是否需要写入日志类别</li> </ul> <h3 style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">2、category</h3> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;"># bind内置15中category,是用来定义日志内容 <br />1、client:处理客户端请求。 <br />2、config:配置文件分析和处理。 <br />3、database:同BIND内部数据库相关的消息,用来存储区数据和缓存记录。 <br />4、default:匹配所有未明确指定通道的类别。 <br />5、dnssec:处理DNSSEC签名的响应。 <br />6、general:包括所有未明确分类的BIND消息。 <br />7、lame-servers:发现错误授权。 <br />8、network:网络操作。 <br />9、notify:区更新通知消息。 <br />10、queries:查询日志。 <br />11、resolver:名字解析,包括对来自解析器的递归查询信息。 <br />12、security:批准/非批准的请求。 <br />13、update:动态更新事件。 <br />14、xfer-in:从远程名字服务器到本地名字服务器的区域传送。 <br />15、xfer-out:从本地名字服务器到远程名字服务器的区域传送。 <br /><br /># 特别注意 <br />一个category产生的日志只能发往多个channel,而一个channel只能为一个category记录日志 </code></pre> <h3 style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">3、实例</h3> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">logging { <br /> channel b_log { <br /> file "../log/bind.log" versions 30 size 1m; <br /> print-time yes; <br /> print-category yes; <br /> print-severity yes; <br /> severity info; <br />}; <br /><br /> channel b_debug { <br /> file "../log/debug.log" versions 2 size 1m; <br /> print-time yes; <br /> print-category yes; <br /> print-severity yes; <br /> severity dynamic; <br />}; <br /><br /> channel b_query { <br /> file "../log/query.log" versions 2 size 1m; <br /> print-time yes; <br /> severity info; <br />}; <br /><br /> category default { b_log; b_debug; }; <br /> category config { b_log; b_debug; }; <br /> category queries { b_query; }; }; </code></pre> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">- 此时回头看看上面的实例 含义为定义了三个channel,b_log,b_query,b_debug<br />- 分别写入日志bind.log, query.log, debug.log; <br />- 将default信息记录到bind.log和debug.log中; <br /></code><span style="line-height: normal;">- 将config信息记录到bind.log和debug.log中; <br />- 将query信息记录到query.log中</span></pre>

标签: bind dnstop queryperf log
  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 5
博文 46
码字总数 42368
×
异类深呼吸
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: