Search
j0ke.net Open Build Service
>
Projects
>
home:opeter
>
powerdns
> pdns-3.2-slavedb.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File pdns-3.2-slavedb.patch of Package powerdns (Revision 51)
Currently displaying revision
51
,
show latest
--- modules/gmysqlbackend/gmysqlbackend.cc.orig 2013-01-07 11:29:06.321972721 +0100 +++ modules/gmysqlbackend/gmysqlbackend.cc 2013-01-07 12:04:56.456515547 +0100 @@ -31,6 +31,24 @@ throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason()); } L<<Logger::Info<<mode<<" Connection successful"<<endl; + + if(!getArg("slave-socket").empty() || !getArg("slave-host").empty()) { + try { + setDBReadonly(new SMySQL(getArg("slave-dbname"), + getArg("slave-host"), + getArgAsNum("slave-port"), + getArg("slave-socket"), + getArg("slave-user"), + getArg("slave-password"))); + L<<Logger::Warning<<mode<<" Slave connection successful."<<endl; + } catch(ArgException &e) { + // Ignore exception, slave not + L<<Logger::Warning<<mode<<" Slave configuration."<<endl; + } catch(SSqlException &e) { + // Ignore exception, slave not + L<<Logger::Warning<<mode<<" Unable to connect to slave."<<endl; + } + } } class gMySQLFactory : public BackendFactory @@ -49,6 +67,13 @@ declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client"); declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no"); + declare(suffix,"slave-dbname","Pdns backend database name to connect to",""); + declare(suffix,"slave-user","Database backend user to connect as",""); + declare(suffix,"slave-host","Database backend host to connect to",""); + declare(suffix,"slave-port","Database backend port to connect to","0"); + declare(suffix,"slave-socket","Pdns backend socket to connect to",""); + declare(suffix,"slave-password","Pdns backend password to connect with",""); + declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'"); declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d"); declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");