﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Rising Sun -随笔分类-云计算</title><link>http://www.blogjava.net/brock/category/53781.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 08 Oct 2013 03:29:25 GMT</lastBuildDate><pubDate>Tue, 08 Oct 2013 03:29:25 GMT</pubDate><ttl>60</ttl><item><title>ERROR 2003 (HY000): Can't connect to MySQL server</title><link>http://www.blogjava.net/brock/archive/2013/10/08/404719.html</link><dc:creator>brock</dc:creator><author>brock</author><pubDate>Tue, 08 Oct 2013 02:34:00 GMT</pubDate><guid>http://www.blogjava.net/brock/archive/2013/10/08/404719.html</guid><wfw:comment>http://www.blogjava.net/brock/comments/404719.html</wfw:comment><comments>http://www.blogjava.net/brock/archive/2013/10/08/404719.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/brock/comments/commentRss/404719.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/brock/services/trackbacks/404719.html</trackback:ping><description><![CDATA[<div style="margin: 5px 0px; font-size: 20px; line-height: 30px; font-family: 'Microsoft YaHei'; background-color: #ffffff; "><h3><br /></h3></div><div style="padding-top: 5px; padding-bottom: 5px; color: #999999; font-size: 12px; line-height: 24px; font-family: Arial; text-align: right; background-color: #ffffff; "></div><div id="article_content" style="margin: 20px 0px 0px; line-height: 26px; font-family: Arial; color: #333333; background-color: #ffffff; "><p><strong>一.问题的提出</strong></p><p><strong></strong></p><p>/usr/local/webserver/mysql/bin/mysql -u root -h 172.29.141.112&nbsp; -p -S /tmp/mysql.sock<br />Enter password:&nbsp;<br />ERROR 2003 (HY000): Can't connect to MySQL server on '172.29.141.112' (113)</p><p><strong></strong></p><p><strong>二.问题的分析</strong></p><p>&nbsp;</p><p>出现上述问题，可能有以下几种可能</p><p>&nbsp;</p><p><strong>1.</strong>&nbsp;my.cnf 配置文件中 skip-networking 被配置</p><p>skip-networking 这个参数，导致所有TCP/IP端口没有被监听,也就是说出了本机，其他客户端都无法用网络连接到本mysql服务器</p><p>所以需要把这个参数注释掉。</p><p>&nbsp;</p><p><strong>2.</strong>my.cnf配置文件中 bindaddress 的参数配置</p><p>bindaddress，有的是bind-address&nbsp; ，这个参数是指定哪些ip地址被配置，使得mysql服务器只回应哪些ip地址的请求，所以需要把这个参数注释掉。</p><p>&nbsp;</p><p><strong>3.</strong>防火墙的原因</p><p>通过 /etc/init.d/iptables&nbsp; stop&nbsp; 关闭防火墙</p><p>我的问题，就是因为这个原因引起的。关闭mysql 服务器的防火墙就可以使用了。</p><p>&nbsp;</p><p><strong>三.问题的解决</strong></p><p><strong>1.</strong>&nbsp; 如果是上述第一个原因，那么 找到 my.cnf&nbsp; ，注释掉 skip-networking 这个参数</p><p>sed -i&nbsp; 's%skip-networking%#skip-networking%g'&nbsp; my.cnf</p><p>&nbsp;</p><p><strong>2.</strong>&nbsp;如果是上述第二个原因，那么&nbsp; 找到 my.cnf&nbsp; ，注释掉 bind-address&nbsp; 这个参数</p><p>sed -i&nbsp; 's%bind-address%#bind-address%g'&nbsp;&nbsp;&nbsp; my.cnf</p><p>sed -i&nbsp; 's%bindaddress%#bindaddress%g'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my.cnf</p><p>&nbsp;</p><p>最好修改完查看一下，这个参数。</p><p>&nbsp;</p><p><strong>3.</strong>如果是上述第三个原因，那么 把防火墙关闭，或者进行相应配置</p><p>&nbsp;</p><p>/etc/init.d/iptables stop</p><p>&nbsp;</p><p><strong>四.参考</strong></p><p><a href="http://hi.baidu.com/vbkan/blog/item/cd5035030cefee793812bb56.html" style="color: #336699; text-decoration: none; ">http://hi.baidu.com/vbkan/blog/item/cd5035030cefee793812bb56.html</a></p><p><a href="http://dev.firnow.com/course/7_databases/mysql/myxl/20090820/169010.html" style="color: #336699; text-decoration: none; ">http://dev.firnow.com/course/7_databases/mysql/myxl/20090820/169010.html</a></p><p><a href="http://www.dnbcw.com/biancheng/sql/lojz182597.html" style="color: #336699; text-decoration: none; ">http://www.dnbcw.com/biancheng/sql/lojz182597.html</a></p></div><img src ="http://www.blogjava.net/brock/aggbug/404719.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/brock/" target="_blank">brock</a> 2013-10-08 10:34 <a href="http://www.blogjava.net/brock/archive/2013/10/08/404719.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>nux和CentOS下网卡启动、配置等ifcfg-eth0教程</title><link>http://www.blogjava.net/brock/archive/2013/07/31/402220.html</link><dc:creator>brock</dc:creator><author>brock</author><pubDate>Wed, 31 Jul 2013 10:42:00 GMT</pubDate><guid>http://www.blogjava.net/brock/archive/2013/07/31/402220.html</guid><wfw:comment>http://www.blogjava.net/brock/comments/402220.html</wfw:comment><comments>http://www.blogjava.net/brock/archive/2013/07/31/402220.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/brock/comments/commentRss/402220.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/brock/services/trackbacks/402220.html</trackback:ping><description><![CDATA[<p style="margin: 10px 0px; padding: 0px; color: #333333; font-family: arial, 宋体; line-height: 26px; background-color: #f5f8fd; "><strong style="margin: 0px; padding: 0px; ">步骤1、配置/etc/sysconfig/network-scripts/ifcfg-eth0 里的文件。it动力的CentOS下的ifcfg-eth0的配置详情：<br style="margin: 0px; padding: 0px; " /><br style="margin: 0px; padding: 0px; " /></strong><strong style="margin: 0px; padding: 0px; ">[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0</strong></p><p style="margin: 10px 0px; padding: 0px; color: #333333; font-family: arial, 宋体; line-height: 26px; background-color: #f5f8fd; "><strong style="margin: 0px; padding: 0px; ">DEVICE="eth0"<br style="margin: 0px; padding: 0px; " />HWADDR="00:0C:29:FD:FF:2A"<br style="margin: 0px; padding: 0px; " />NM_CONTROLLED="yes"<br style="margin: 0px; padding: 0px; " />ONBOOT="yes"<br style="margin: 0px; padding: 0px; " />IPADDR=192.168.1.31<br style="margin: 0px; padding: 0px; " />NETMASK=255.255.255.0<br style="margin: 0px; padding: 0px; " />GATEWAY=192.168.1.1<br style="margin: 0px; padding: 0px; " />BOOTPROTO=static<br style="margin: 0px; padding: 0px; " /><br style="margin: 0px; padding: 0px; " />前面三行是系统睚带的，后面就是手动添加的。<br style="margin: 0px; padding: 0px; " />这样设置扣，记得重启网卡：<br style="margin: 0px; padding: 0px; " />[root@localhost ~]# /etc/init.d/network stop<br style="margin: 0px; padding: 0px; " />[root@localhost ~]# /etc/init.d/network start<br style="margin: 0px; padding: 0px; " /></strong><strong style="margin: 0px; padding: 0px; "><br style="margin: 0px; padding: 0px; " />行了，现在就可以PING得通网关了，如果还得上网，不必须设置DNS。设置DNS就详见步骤2<br style="margin: 0px; padding: 0px; " /><br style="margin: 0px; padding: 0px; " />步骤2、修改dns<br style="margin: 0px; padding: 0px; " />[root@localhost ~]# vi /etc/resolv.conf&nbsp;<br style="margin: 0px; padding: 0px; " />在里面添加二个dns：<br style="margin: 0px; padding: 0px; " />nameserver 202.96.134.133<br style="margin: 0px; padding: 0px; " />nameserver 8.8.8.8<br style="margin: 0px; padding: 0px; " /><br style="margin: 0px; padding: 0px; " />ok，大攻告成，即可上网了！！！！</strong></p><img src ="http://www.blogjava.net/brock/aggbug/402220.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/brock/" target="_blank">brock</a> 2013-07-31 18:42 <a href="http://www.blogjava.net/brock/archive/2013/07/31/402220.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>vSphere Web Services SDK 安装</title><link>http://www.blogjava.net/brock/archive/2013/07/31/402219.html</link><dc:creator>brock</dc:creator><author>brock</author><pubDate>Wed, 31 Jul 2013 10:41:00 GMT</pubDate><guid>http://www.blogjava.net/brock/archive/2013/07/31/402219.html</guid><wfw:comment>http://www.blogjava.net/brock/comments/402219.html</wfw:comment><comments>http://www.blogjava.net/brock/archive/2013/07/31/402219.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/brock/comments/commentRss/402219.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/brock/services/trackbacks/402219.html</trackback:ping><description><![CDATA[<p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">&nbsp;The VMware vSphere Web Services SDK includes all the components necessary to work with the VMware vSphere API, including WSDL files, sample code, and libraries. The vSphere Web Services SDK facilitates development of client applications that target the VMware vSphere API. With the vSphere Web Services SDK, developers can create client applications to manage, monitor, and maintain VMware vSphere components, as deployed on VMware&#174;VMware vSphere&#174;ESX&#174;, ESXi&#8482;, and VMware&#174;vCenter&#8482; Server systems.</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">这是官方对vSphere Web Services SDK的介绍，简单来说就是提供了管理vcenter，ESXi的程序接口，目前支持JAVA和.NET平台，下面以windows 7平台为例，介绍JAVA开发环境的部署过程</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; "><span style="color: #ff0000; ">一、开发环境准备</span></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">1、安装JAVA开发环境 J2SE 1.6 b22</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; "><a href="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u22-oth-JPR" style="color: #ff9900; text-decoration: none; ">http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u22-oth-JPR</a></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">安装到c:\java下，不要安装到C:\program files下，目录中有空格，执行脚本的时候会报错</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">2、安装SOAP工具JAX-WS2.1</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; "><a href="http://jax-ws.java.net/2.1.1/index.html" style="color: #ff9900; text-decoration: none; ">http://jax-ws.java.net/2.1.1/index.html</a></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">双击安装即可</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">3、下载vSphere Web Services SDK 5.1</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; "><a href="http://communities.vmware.com/community/vmtn/developer/downloads" style="color: #ff9900; text-decoration: none; ">http://communities.vmware.com/community/vmtn/developer/downloads</a></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">解压到c:\devprojects下</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; "><span style="color: #ff0000; ">二、开发环境配置</span></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">1、设置系统变量</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">JAVA_HOME=C:\java\jdk1.6.0_22</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">JAVAHOME=C:\java\jdk1.6.0_22</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">SDKHOME=C:\devprojects</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">VMKEYSTORE=C:\VMware-Certs\vmware.keystore（稍后介绍安装过程）</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">WEBHOME=C:\devprojects\vsphere-ws\java\Axis\lib\wbem.jar</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">WS_SDK_HOME=C:\devprojects\SDK\vsphere-ws</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">CLASSPATH=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\devprojects\SDK\vsphere-ws\java\JAXWS\lib\samples.jar;C:\devprojects\SDK\vsphere-ws\java\JAXWS\lib\vim25.jar(这个变量很重要）</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">2、服务器认证</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">2.1、将ESX Server或Vcenter的证书导入本机，ESXi的证书在/etc/vmware/ssl/rui.crt；Vcenter的证书在C:/Documents and Settings/All Users/Application Data/VMware/VMware VitualCenter/SSL/rui.crt</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">2.2、证书拷贝到本机的C:/VMware-Certs目录下，打开windows7的命令行界面，切换到C:/VMware-Certs目录下，使用jdk的keytool工具导入证书：</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">keytool -import -file &lt;certificate-filename&gt; -alias &lt;server-name&gt; -keystore vmware.keystore</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">其中certificate-filename为rui.crt,service-name可以为服务器的机器名或IP地址，运行成功后会在C:/VMware-Certs目录下生成vmware.keystore文件。</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">3、重新编译JAX-WS</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">如果你的安装的版本不是JDK 1.6 b22或者SOAP不是用 JAX-WS2.1，就需要重新编译</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">打开CMD，切换到C:\devprojects\SDK\vsphere-ws\java\JAXWS\</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">运行build.bat</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; ">运行成功会出现会出现</p><div style="font-family: Arial; line-height: 26px; "></div><div style="font-family: Arial; line-height: 26px; ">Generating stubs from wsdl</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">Compiling stubs.</div><div style="font-family: Arial; line-height: 26px; ">...</div><div style="font-family: Arial; line-height: 26px; ">Done</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; "><span style="color: #ff0000; ">三、运行简单的客户端脚本以验证安装成功</span></div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">打开CMD，切换到C:\devprojects\SDK\vsphere-ws\java\JAXWS\</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">run.bat com.vmware.general.SimpleClient --url<a href="https://yourfqdnservername/sdk" style="color: #ff9900; text-decoration: none; ">https://yourFQDNservername/sdk</a>&nbsp;--username&nbsp; username --password password，如下输出表示配置SDK成功</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; "><img alt="" src="http://img.my.csdn.net/uploads/201303/22/1363920373_9464.PNG" style="border: none; max-width: 100%; " /></div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; "><span style="color: #ff0000; ">四、错误调试</span></div><div style="font-family: Arial; line-height: 26px; ">1、如果出现找不到类的错误，ClassNotFoundException:........,可以这样</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">打开CMD，切换到C:\devprojects\SDK\vsphere-ws\java\JAXWS\</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">java -Djavax.net.ssl.trustStore=%VMKEYSTORE% com.vmware.general.SimpleClient--url https://example.com/sdk --username pubs --password ***</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">2、如果提示JAVA虚拟机的内存不够，可以这样</div><div style="font-family: Arial; line-height: 26px; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; ">java -Djavax.net.ssl.trustStore=%VMKEYSTORE%&nbsp;-Xms 512M -XMx1024M com.vmware.general.SimpleClient--url https://example.com/sdk --username pubs --password ***</div><img src ="http://www.blogjava.net/brock/aggbug/402219.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/brock/" target="_blank">brock</a> 2013-07-31 18:41 <a href="http://www.blogjava.net/brock/archive/2013/07/31/402219.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bind+dlz+mysql实现区域记录动态更新</title><link>http://www.blogjava.net/brock/archive/2013/07/31/402218.html</link><dc:creator>brock</dc:creator><author>brock</author><pubDate>Wed, 31 Jul 2013 10:40:00 GMT</pubDate><guid>http://www.blogjava.net/brock/archive/2013/07/31/402218.html</guid><wfw:comment>http://www.blogjava.net/brock/comments/402218.html</wfw:comment><comments>http://www.blogjava.net/brock/archive/2013/07/31/402218.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/brock/comments/commentRss/402218.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/brock/services/trackbacks/402218.html</trackback:ping><description><![CDATA[<div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">BIND-DLZ实验:http://bind-dlz.sourceforge.net/</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">实验环境:RHEL4,BIND-9.5.0-P2.tar.gz(9.4.0以上版本都已含DLZ补丁),Mysql-5.0.56.tar.gz</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">1、安装mysql(先安装gcc等相关软件包)</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #tar zxvf mysql-5.0.56.tar.gz&nbsp;<br />&nbsp;&nbsp; #cd mysql-5.0.56<br />&nbsp;&nbsp; #./configure --prefix=/usr/local/mysql --localstatedir=/usr/loal/mysql/data --&nbsp;&nbsp; libexecdir=/usr/local/mysql/lib --disable-shared<br />&nbsp;&nbsp; #make<br />&nbsp;&nbsp; #make install<br />&nbsp;&nbsp; #cd /usr/local/mysql/<br />&nbsp;&nbsp; #groupadd -g 1003 mysql<br />&nbsp;&nbsp; #useradd -g 1003 mysql<br />&nbsp;&nbsp; #chown -R mysql .<br />&nbsp;&nbsp; #chgrp -R mysql .<br />&nbsp;&nbsp; #chown -R mysql lib<br />&nbsp;&nbsp; #./bin/mysql_install_db --user=mysql //以mysql的用户身份安装<br />&nbsp;&nbsp; #chown -R root .<br />&nbsp;&nbsp; #./bin/mysqld_safe --user=mysql &amp; //在后台启动mysql</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; "><p style=" padding: 0px; "><span style="font-size: 9pt; font-family: 'Courier New'; ">#&nbsp;cd /root/mysql-5.0.56<br />#&nbsp;cp support-files/my-medium.cnf /etc/my.cnf<br />#&nbsp;cp support-files/mysql.server /etc/rc.d/init.d/mysqld<br />#&nbsp;chmod 700 !$<br />#&nbsp;chkconfig --add mysqld<br />#&nbsp;chkconfig --list mysqld<br />&nbsp; mysqld 1:off 2:on 3:on 4:on 5:on 6:off<br />#&nbsp;service mysqld start[restart/reload/stop]<br />#&nbsp;vi /etc/my.cnf<br /><span style="color: blue; ">&nbsp;add this:(</span></span><span style="font-size: 9pt; color: blue; font-family: 宋体; ">防止</span><span style="font-size: 9pt; color: blue; font-family: 'Courier New'; ">mysql</span><span style="font-size: 9pt; color: blue; font-family: 宋体; ">服务器无查询后</span><span style="font-size: 9pt; color: blue; font-family: 'Courier New'; ">8</span><span style="font-size: 9pt; color: blue; font-family: 宋体; ">小时自动重连</span><span style="font-size: 9pt; color: blue; font-family: 'Courier New'; "><span style="color: #000000; ">)<br />wait_timeout = 86400</span></span></p><span style="font-size: 9pt; color: blue; font-family: 'Courier New'; "><span style="color: #000000; ">interactive_timeout = 86400</span><br /></span><br />&nbsp;&nbsp; #/usr/local/mysql/bin/mysqladmin -uroot password 'aptech'<br />&nbsp;&nbsp; #./bin/mysql -uroot -paptech</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #echo "PATH=$PATH:/usr/local/mysql/bin" &gt;&gt; /etc/profile</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #. !$</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">2、安装bind</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #tar zxvf bind-9.5.0-P2.tar.gz&nbsp;<br />&nbsp;&nbsp; #cd bind-9.5.0-P2<br />&nbsp;&nbsp; #./configure --prefix=/usr/local/bind9 --with-dlz-mysql=/usr/local/mysql --enable-threads=no</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; //--with-dlz-mysql=/usr/local/mysql&nbsp;要求bind安装中支持DLZ</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;//--enable-threads=no&nbsp;关闭多线程&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; //--disable-openssl-version-check 禁止openssl版本的检查<br />&nbsp;&nbsp; #make<br />&nbsp;&nbsp; #make install<br /><br />3、创建database,table</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; create database mydata;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; use mydata;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; create table other_dns_records(</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; zone varchar(255),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; host varchar(255),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; type varchar(255),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; data varchar(255),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; ttl int(11),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; mx_priority varchar(255),&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; refresh int(11),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; retry int(11),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; expire int(11),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; minimum int(11),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; serial bigint(11),</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; resp_person varchar(255),&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; primary_ns varchar(255));</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; create table cnc_dns_records(<div>&nbsp;&nbsp; host varchar(255),</div><div>&nbsp;&nbsp; type varchar(255),</div><div>&nbsp;&nbsp; data varchar(255),</div><div>&nbsp;&nbsp; ttl int(11),</div><div>&nbsp;&nbsp; mx_priority varchar(255),&nbsp;</div><div>&nbsp;&nbsp; refresh int(11),</div><div>&nbsp;&nbsp; retry int(11),</div><div>&nbsp;&nbsp; expire int(11),</div><div>&nbsp;&nbsp; minimum int(11),</div><div>&nbsp;&nbsp; serial bigint(11),</div><div>&nbsp;&nbsp; resp_person varchar(255),&nbsp;</div><div>&nbsp;&nbsp; primary_ns varchar(255));</div></div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; insert other_dns_records(zone,host,type,data,ttl,retry)</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; values('aaa.com','www','A','192.168.199.2','86400','13');</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; insert cnc_dns_records(zone,host,type,data,ttl,retry)</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; values('bbb.com','www','A','192.55.199.199','86400','13');</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">4、编辑/usr/local/bind9/etc/named.conf</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #cd /usr/local/bind9/etc</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #../sbin/rndc-confgen -a</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #../sbin/rndc-confgen &gt; named.conf</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #vi !$&nbsp; &nbsp;//vi named.conf</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;&nbsp; #less named.conf</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;# Use with the following in named.conf, adjusting the allow list as needed:<br />&nbsp;key "rndc-key" {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; algorithm hmac-md5;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; secret "c4aUV+N7GbOF773V+/LnAA==";<br />&nbsp;};<br />&nbsp;<br />&nbsp;controls {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet 127.0.0.1 port 953<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allow { 127.0.0.1; } keys { "rndc-key"; };<br />&nbsp;};<br /># End of named.conf<br />options {<br />directory "/usr/local/bind9/etc/";<br />pid-file "/usr/local/bind9/var/run/named.pid";<br />allow-query { any; };<br />recursion no;<br />version "gaint-d1";<br />};<br />include "/usr/local/bind9/etc/cnc.cl";<br />include "/usr/local/bind9/etc/other.cl";<br />view "cnc-user" {<br />match-clients { cnc; };<br />dlz "Mysql zone" {<br />database "mysql<br />{host=localhost dbname=mydata ssl=false port=3306 user=root pass=aptech}<br />{select zone from cnc_dns_records where zone = '%zone%'}<br />{select ttl, type, mx_priority, case when lower(type)='txt' then concat('/"', data,&nbsp;<br />'/"')<br />when lower(type) = 'soa' then concat_ws('<br />', data, resp_person, serial, refresh, retry, expire, minimum) else data end as mydata from<br />cnc_dns_records where zone = '%zone%' and host = '%record%'}";<br />};<br />};<br />view "other-user" {<br />match-clients { other; };<br />dlz "Mysql zone" {<br />database "mysql<br />{host=localhost dbname=mydata ssl=false port=3306 user=root pass=aptech}<br />{select zone from other_dns_records where zone='%zone%'}<br />{select ttl, type, mx_priority, case when lower(type) = 'txt' then concat('/"', data,&nbsp;<br />'/"')<br />when lower(type)='soa' then concat_ws('<br />', data, resp_person, serial, refresh, retry, expire, minimum) else data end as mydata from<br />other_dns_records where zone = '%zone%' and host = '%record%'}";<br />};<br />};<br />[root@dlz etc]# less cnc.cl&nbsp;<br />acl "cnc"{<br />192.168.9.0/24;<br />};</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">[root@dlz etc]# less other.cl&nbsp;<br />acl "other" {<br />127.0.0.0/18;<br />};</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp;</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">5、启动&amp;测试</div><div style="font-family: Arial; line-height: 26px; background-color: #ffffff; ">[root@dlz ~]# /usr/local/bind9/sbin/named -gc&nbsp; /usr/local/bind9/etc/named.conf<br />06-Mar-2009 22:23:02.569 starting BIND 9.5.0-P2 -gc /usr/local/bind9/etc/named.conf<br />06-Mar-2009 22:23:02.579 loading configuration from '/usr/local/bind9/etc/named.conf'<br />06-Mar-2009 22:23:02.583 listening on IPv4 interface lo, 127.0.0.1#53<br />06-Mar-2009 22:23:02.586 listening on IPv4 interface eth0, 192.168.1.5#53<br />06-Mar-2009 22:23:02.588 Loading 'Mysql zone' using driver mysql<br />06-Mar-2009 22:23:02.604 default max-cache-size (33554432) applies: view cnc-user<br />06-Mar-2009 22:23:02.609 Loading 'Mysql zone' using driver mysql<br />06-Mar-2009 22:23:02.612 default max-cache-size (33554432) applies: view other-user<br />06-Mar-2009 22:23:02.616 default max-cache-size (33554432) applies: view _bind<br />06-Mar-2009 22:23:02.621 command channel listening on 127.0.0.1#953<br />06-Mar-2009 22:23:02.621 ignoring config file logging statement due to -g option<br />06-Mar-2009 22:23:02.623 running</div><div></div><img src ="http://www.blogjava.net/brock/aggbug/402218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/brock/" target="_blank">brock</a> 2013-07-31 18:40 <a href="http://www.blogjava.net/brock/archive/2013/07/31/402218.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>