久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

linux 每日學(xué)一點(diǎn)《BIND+DLZ+MYSQL實(shí)現(xiàn)區(qū)域記錄動態(tài)更新》

 邊讀邊記 2011-08-08
linux 每日學(xué)一點(diǎn)《BIND+DLZ+MYSQL實(shí)現(xiàn)區(qū)域記錄動態(tài)更新》 2010-11-16 09:14:24
BIND+DLZ+MYSQL實(shí)現(xiàn)區(qū)域記錄動態(tài)更新
 
所用到的軟件包:BIND-9.5.0-P2.tar.gz9.4.0以上版本都已經(jīng)包含了DLZ補(bǔ)丁),、Mysql-5.0.56.tar.gz
寫在前面:DLZDynamically Loadable Zones),,它允許你的區(qū)域記錄放置到數(shù)據(jù)庫中,并且支持多種數(shù)據(jù)庫,。你可以在BIND-DLZ上找到相應(yīng)的資料,。
1、先安裝mysql
shell>tar zxvf mysql-version.tar.gz
shell>cd mysql-*
shell>./configure --prefix=/usr/local/mysql \
>--localstatedir=/usr/local/mysql/data \
>--libexecdir=/usr/local/mysql/lib \
>--disable-shared
shell>make && make install
安裝完成后,。
進(jìn)入安裝mysql的目錄
>cd /usr/local/mysql
>chown -R mysql .
>chgrp -R mysql .
>chown -R mysql data
>chown -R mysql lib
>groupadd -g 1003 mysql
>adduser -g 1003 mysql
>./bin/mysql_install_db --user=mysql //mysql用戶的身份安裝
>chown -R root .
>./bin/mysqld_safe --user=mysql &  //啟動mysql并轉(zhuǎn)入后臺自行處理 
>/usr/local/mysql/bin/mysqladmin -u root -p password '*******'
password:(由于初始密碼為空,,此處直接敲回車)
>/usr/local/mysql/bin/mysql -u root -p
password:(輸入你的密碼)
mysql>      
2、安裝bind
shell>tar zxvf bind-9.5.0-p2.tar.gz
shell>cd bind-9.5.0-p2
shell>./configure --prefix=/usr/local/bind9 --with-dlz-mysql --enabl-threads=no --disable-openssl-version-check
--with-dlz-mysql=/usr/local/mysql/include/mysql  要求bind安裝中支持DLZ
--enabl-threads=no  關(guān)閉多線程
--disable-openssl-version-check   這項(xiàng)是禁止openssl版本的檢查
shell>make
shell>make install 
3,、創(chuàng)建數(shù)據(jù)庫,、表
mysql>create database mydata;
mysql>use mydata;
mysql>create table other_dns_records (
>zone varchar (255),
>host varchar (255),
>type varchar (255),
>data varchar (255),
>ttl int(11),
>mx_priority varchar (255),
>refresh int(11),
>retry int(11),
>expire int(11),
>minimum int(11),
>serial bigint(20),
>resp_person varchar (255),
>primary_ns varchar (255)
>);
mysql>create table cnc_dns_records (
>zone varchar (255),
>host varchar (255),
>type varchar (255),
>data varchar (255),
>ttl int(11),
>mx_priority varchar (255),
>refresh int(11),
>retry int(11),
>expire int(11),
>minimum int(11),
>serial bigint(20),
>resp_person varchar (255),
>primary_ns varchar (255)
>);
>//
向表中添加一條記錄
>insert into other_dns_records (zone,host,type,data,ttl,retry) values ('aaa.com','www','A','192.168.199.2','86400','15');
>insert into cnc_dns_records (zone,host,type,data,ttl,retry) values ('bbb.com','www','A','192.199.22.22','86400','13');
4、編輯/usr/local/bind9/etc/named.conf
>cd /usr/local/bind9/etc
>../sbin/rndc-config -a
>../sbin/rndc-config > named.conf
>vi !$
//刪除# Use with the following in named.conf, adjusting the allow list as needed: 以前的行
# Use with the following in named.conf, adjusting the allow list as needed:  # End of named.conf 之間的行前#
最終的etc/named.conf文件如下:

dlz "Mysql zone" {

   database "mysql

 
# Use with the following in named.conf, adjusting the allow list as needed:
 key "rndc-key" {
  algorithm hmac-md5;
  secret "2rkqGUle0VlsawCL2+IKsA==";
 };
 
 controls {
  inet 127.0.0.1 port 953
  allow { 127.0.0.1; } keys { "rndc-key"; };
 };
# End of named.conf
options {
    directory "/usr/local/binid/etc/";
    pid-file "/usr/local/binid/var/run/named.pid";
    allow-query { any; };
    recursion no;
    version "gaint-d1";
};
include "/usr/local/binid/etc/cnc.cl";
include "/usr/local/binid/etc/other.cl";
view "cnc-user" {
    match-clients { cnc; };
dlz "Mysql zone" {
     database "mysql
{host=localhost dbname=mydb ssl=false port=3306 user=root pass=abc123!}
{select zone from cnc_dns_records where zone = '%zone%'}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
     when lower(type)='soa' then concat_ws(' ', data, resp_person, serial, refresh, retry, expire, minimum) else data end as mydata from cnc_dns_records where zone = '%zone%' and host = '%record%'}";
                 };
};
view "other-user" {
    match-clients { other; };
dlz "Mysql zone" {
     database "mysql
{host=localhost dbname=mydb ssl=false port=3306 user=root pass=abc123!}
{select zone from other_dns_records where zone = '%zone%'}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
     when lower(type)='soa' then concat_ws(' ', data, resp_person, serial, refresh, retry, expire, minimum) else data end as mydata from other_dns_records where zone = '%zone%' and host = '%record%'}";
                 };
};

   {host=localhost dbname=dns_data ssl=tRue}

   {select zone from dns_records where zone = '%zone%'}

   {select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')

        when lower(type) = 'soa' then concat_ws(' ', data, resp_person, serial, refresh, retry, expire, minimum)

        else data end from dns_records where zone = '%zone%' and host = '%record%'}";

};

 
 
 
etc/cnc.cl如下:
acl "cnc" {
192.168.9.0/24;
};
 
etc/other.cl如下:
acl "other" {
127.0.0.0/18;
};
5,、測試
打開named測試/usr/local/bind9/sbin/named -g -d 1 -c /usr/local/bind9/etc/named.conf
注:如果不想寫全路徑來啟動bindmysql的話,,可以編輯:
>vi /root/.bash_profile
加入如下兩行:
PATH=$PATH:/usr/local/bind9/sbin
PATH=$PATH:/usr/local/mysql/bin/
保存退出
> . /root/.bash_profile (或者:. !$)
配置文件中的sql查詢可以參照BIND-DLZ
 
dlz "Mysql zone" {
   database "mysql
   {host=localhost dbname=dns_data ssl=tRue}
   {select zone from dns_records where zone = '%zone%'}
   {select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
        when lower(type) = 'soa' then concat_ws(' ', data, resp_person, serial, refresh, retry, expire, minimum)
        else data end from dns_records where zone = '%zone%' and host = '%record%'}";
};
 
 
參考網(wǎng)站: http://bind-dlz./mysql_example.html

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn),。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多