centos 6.2 bind dlz mysql 驱动,bind9 dlz mysql 配置 – daemon
1.数据库安装
yum -y install mysql-community-server mysql-community-devel
2.编译安装bind 一些基础的包,请参考前一章
./configure –with-dlz-mysql –enable-largefile –enable-threads=no –prefix=/xxx/bind –with-libtool –enable-epoll –with-openssl
make -j 8 && make -j 8 install
3.数据库初始化:
CREATE SCHEMA `bind` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
CREATE TABLE IF NOT EXISTS `dns_records` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`zone` varchar(255) NOT NULL,
`host` varchar(255) NOT NULL DEFAULT '@',
`type` enum('A','MX','CNAME','NS','SOA','PTR','TXT','AAAA','SVR','URL') NOT NULL,
`data` varchar(255) DEFAULT NULL,
`ttl` int(11) NOT NULL DEFAULT '3600',
`mx_priority` int(11) DEFAULT NULL,
`view` enum('any', 'CHINANET', 'Unicom', 'CNC', 'ours') NOT NULL DEFAULT "any" ,
`priority` tinyint UNSIGNED NOT NULL DEFAULT '255',
`refresh` int(11) NOT NULL DEFAULT '28800',
`retry` int(11) NOT NULL DEFAULT '14400',
`expire` int(11) NOT NULL DEFAULT '86400',
`minimum` int(11) NOT NULL DEFAULT '86400',
`serial` bigint(20) NOT NULL DEFAULT '2015050917',
`resp_person` varchar(64) NOT NULL DEFAULT 'ddns.net',
`primary_ns` varchar(64) NOT NULL DEFAULT 'ns.ddns.net.',
PRIMARY KEY (`id`),
KEY `type` (`type`),
KEY `host` (`host`),
KEY `zone` (`zone`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
插入SOA数据:
INSERT INTO `dns_records` (`zone`, `host`, `type`, `data`, `ttl`,`mx_priority`,`refresh`, `retry`, `expire`, `minimum`, `serial`, `resp_person`, `primary_ns`) VALUES(‘xieyugui.com’, ‘@’, ‘SOA’, ‘ns1.xieyugui.com.’, 10, NULL, 600, 3600, 86400,10, 2017060801, ‘root.xieyugui.com.’, ‘ns1.xieyugui.com.’);
插入@ NS数据:
INSERT INTO `dns_records` (`zone`, `host`, `type`, `data`) VALUES(‘xieyugui.com’, ‘@’, ‘NS’, ‘ns1.xieyugui.com.’),(‘xieyugui.com’, ‘@’, ‘NS’, ‘ns2.xieyugui.com.’);
插入NS A数据:
INSERT INTO `dns_records` (`zone`, `host`, `type`, `data`) VALUES(‘xieyugui.com’, ‘ns1’, ‘A’, ‘192.168.10.5’),(‘xieyugui.com’, ‘ns2’, ‘A’, ‘192.168.1.111’);
插入www A记录:
INSERT INTO `dns_records` (`zone`, `host`, `type`, `data`, `ttl`, `view`) VALUES(‘xieyugui.com’, ‘www’, ‘A’, ‘192.168.1.111’, 360, ‘any’),(‘xieyugui.com’, ‘app’, ‘A’, ‘192.168.1.112’, 360, ‘CHINANET’),(‘xieyugui.com’, ‘dev’, ‘A’, ‘192.168.1.113’, 360, ‘any’),(‘xieyugui.com’, ‘db’, ‘A’, ‘192.168.1.114’, 360, ‘any’);
插入CNAME 记录:
INSERT INTO dns_records (zone,host,type,DATA,view) VALUES(‘xieyugui.com’, ‘blog’, ‘CNAME’, ‘www’,’CNC’);
5.etc 目录结构
[root@TEST_MASTER etc]# ls
aclkeysnamed.confrndc.confview.confzone
vim named.conf
include “/xxx/bind/etc/acl/CHINANET.acl”;
include “/xxx/bind/etc/acl/CNC.acl”;
include “/xxx/bind/etc/view.conf”;
vim view.conf
view “CHINANET_view” {
match-clients{ CHINANET; };
allow-query-cache { none; };
allow-recursion { none; };
allow-transfer { none; };
recursion no;
dlz “Mysql zone” {
database “mysql
{host=127.0.0.1 dbname=bind ssl=false port=3306 user=root pass=xxx}
{select zone from dns_records where zone = ‘$zone$’ andview = ‘any’ limit 1}
{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 dns_records where zone = ‘$zone$’ and host = ‘$record$’ and view=(select view from dns_records where zone = ‘$zone$’ and host = ‘$record$’ and (view=’CHINANET’ or view=’any’) order by priority asc limit 1)}”;
};
};
view “CNC_view” {
match-clients{ CNC; };
allow-query-cache { none; };
allow-recursion { none; };
allow-transfer { none; };
recursion no;
dlz “Mysql zone” {
database “mysql
{host=127.0.0.1 dbname=bind ssl=false port=3306 user=root pass=xxx}
{select zone from dns_records where zone = ‘$zone$’ andview = ‘any’ limit 1}
{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 dns_records where zone = ‘$zone$’ and host = ‘$record$’ and view=(select view from dns_records where zone = ‘$zone$’ and host = ‘$record$’ and (view=’CNC’ or view=’any’) order by priority asc limit 1)}”;
};
};
view “any_view”{
match-clients{ any; };
allow-query-cache { none; };
allow-recursion { none; };
allow-transfer { none; };
recursion no;
dlz “Mysql zone” {
database “mysql
{host=127.0.0.1 dbname=bind ssl=false port=3306 user=root pass=xxx}
{select zone from dns_records where zone = ‘$zone$’ andview = ‘any’ limit 1}
{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 dns_records where zone = ‘$zone$’ and host = ‘$record$’ and view = ‘any’}”;
};
};
貌似上面的view.conf里面的select逻辑有点问题,但是整体还是能跑通的,后面有空再整理一下
赞过:
赞 正在加载……
相关
centos 6.2 bind dlz mysql 驱动,bind9 dlz mysql 配置 – daemon相关推荐
- django安装mysql驱动_django安装mysql驱动
django目前支持三种mysql驱动来进行mysql的链接MySQLdb is a native driver that has been developed and supported for o ...
- qt4.8 mysql 驱动_Qt-4.8.5配置mysql驱动
一.安装mysql和Qt 安装mysql我们只需要他的include和lib文件夹即可 二.编译mysql驱动 打开qt目录D:\Qt\4.8.5\plugins\sqldrivers,里面包含了qt ...
- qt下生成mysql驱动_Qt编译MySQL驱动
最近项目用到mysql数据库,程序是在Qt中开发的,在网上找了资料,随便写了两句, myDB = new QSqlDatabase(QSqlDatabase::addDatabase("QM ...
- hive安装mysql驱动_hive安装与配置
1.先决条件 要先安装hadoop,安装详细见:http://blog.csdn.net/hwwn2009/article/details/39889465 2.安装hive 1)下载hive,注意h ...
- linux安装mysql驱动_Linux 安装mysql
环境配置 操作系统 :CentOS 7.5 64位 mysql版本:8.0.13 步骤 1.卸载系统自带的mariadb-lib 查看mariadb版本 rpm-qa | grepmariadb 卸载 ...
- mysql驱动profilesql_java连接mysql的驱动配置问题
想用java访问mysql数据库,下载了一个驱动,然后根据网上说的,配置了classpath,结果失败,原因是ClassNotFoundException,然后继续往上搜索,最后将该驱动放置到jdk\ ...
- 通过jdbc的mysql驱动连接oceanbase mysql模式数据库
oceanbase mysql模式的实例是完全兼容mysql jdbc驱动的. 如下为tomcat的jdbc.properties的配置: 应用连接mysql数据库的jdbc配置: [ess@loca ...
- datagrip mysql 驱动_Datagrip2020下载MySQL驱动失败的问题
我就废话不多说了,大家还是直接看代码吧~create or replace function aa1(a1 integer[],a2 bigint) returns void AS $$declare ...
- spark mysql 驱动_spark读取mysql数据库的驱动问题
连接关系型数据库转换为DF对象. 上传mysql-connector-java-5.1.28-bin.jar包 启动参数方式: bin/spark-shell--master=local[4] --d ...
最新文章
- 花卉世界大观园和杂技之游
- php in_array 遍历,in_array大数组查询性能问题
- Ubuntu 16.04 amd64 bond mode6 配置
- 没有JS的前端:体积更小、速度更快!
- 在word上写博客直接发到CSDN博客
- linux搜索关键字并定位,Linux系统中文件定位与查找(示例代码)
- MySQL 导出命令
- java事件大全_JavaScript事件大全
- Android性能优化典范第一季
- 现在小餐厅的推广视频
- 拼接字符串时的引号嵌套
- f分布表完整图_标准正态分布函数数值表怎么查?(加完整分布函数表)
- IDEA整合Spring Boot项目访问jsp文件
- HDU4505 小Q系列故事——电梯里的爱情【水题】
- 2017蓝桥杯C++B:等差素数列(枚举优化)
- 爬虫实例5 爬取58房源信息(xpath)
- nuc980使用教程--2--spi nor flash(W25Q256)启动
- 边缘检测-Canny
- 一个js写的爱心表白神器
- 打印机与计算机接口大多数,打印机接口-西北师范大学.PPT