Re: [Pdns-users] mongodb backend

2013-06-01 Thread fredrik danerklint

The problem is that both pdns and mongodb exports same functions with
different implementations:


This is the same problem that I have with the luabackend.

Since PowerDNS links lua directly into to executable, you need
to run the same lua version in the luabackend aswell.

When I was trying to figure out why I couldn't have the Luabackend
using version 5.2, it was due to that PowerDNS itself was using
version 5.1.

Both Lua 5.1 and Lua 5.2 export the same function-names but some 
functions has different parameters/return-values with these two

versions.

This same problem could also happening for the others backends which is 
included with PowerDNS. It is more or less matter of time.


--
//fredan

___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] mongodb backend

2013-05-26 Thread fredrik danerklint

I'm the author for the mongodb backend.

It was me who told Peter and Bert to delete the backend from PowerDNS.

The reason for this was simple. When the client of Mongodb 
(libmongoclient.a) initialize, it will run through a number of internal 
test to see that everything is ok. One of those tests is to check for a 
MD5 sum. This will fail with an assert if you would try it, since

libmongoclient.a will call the function in PowerDNS with the same name,
but with differents parameters, so the result will not be the expected, 
and therefor will terminate with an assert.




Hello. What happened with mongodb backend? Why nobody cares of it?
Is that posible to revert it into official status of supported backends?

--
//fredan


___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] PowerDNS backend

2013-02-05 Thread fredrik danerklint

one silly question. even I need to write my own backend, I still need to use
pipebackend option, rite?


Or you can use the Luabackend, which was written precisely to solve 
issues like yours.


--
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] The Luabackend

2013-01-13 Thread fredrik danerklint

Peter,

Can you also make sure that you do not include the Luabackend as a 
static module when compiling PowerDNS?


Otherwise, it would not be possible to load the Luabackend as a shared 
library.



Yes, that would be nice!

2013-01-11 08:42, Peter van Dijk skrev:

Hello Fredrik,

On Jan 10, 2013, at 19:39 , fredrik danerklint wrote:


Can now be found at

https://github.com/fredan/luabackend



Would you like the docs and/or README on our end to say something
about that?

Kind regards,







--
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Starting recursor on freebsd 8.2

2012-01-15 Thread fredrik danerklint

Trying to start recursor on FreeBSD 8.2

Please tell me what I have missed in the configuration.

# netstat -ln -p udp
# /usr/local/etc/rc.d/pdns-recursor start
Starting pdns_recursor.
Jan 15 17:41:40 PowerDNS recursor 3.3 (C) 2001-2010 PowerDNS.COM BV (Jan 
 9 2011, 05:22:37, gcc 4.2.1 20070719  [FreeBSD]) starting up
Jan 15 17:41:40 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms 
of the GPL version 2.

Jan 15 17:41:40 Operating in 64 bits mode
Jan 15 17:41:40 Reading random entropy from '/dev/urandom'
Jan 15 17:41:40 Only allowing queries from: 127.0.0.0/8, ::1/128
Jan 15 17:41:40 Will not send queries to: 127.0.0.0/8, 10.0.0.0/8, 
192.168.0.0/16, 172.16.0.0/12, ::1/128, fe80::/10, 0.0.0.0, ::

Jan 15 17:41:40 Enabling IPv6 transport for outgoing queries
Jan 15 17:41:40 Reading zone forwarding information from 
'/usr/local/etc/pdns/forward-zone'
Jan 15 17:41:40 Done parsing 16 forwarding instructions from file 
'/usr/local/etc/pdns/forward-zone'

Jan 15 17:41:40 Inserting rfc 1918 private space zones
Jan 15 17:41:40 Exception: Resolver binding to server socket on port 53 
for 127.0.0.1: Address already in use

/usr/local/etc/rc.d/pdns-recursor: WARNING: failed to start pdns_recursor
# netstat -ln -p udp
#


recursor.conf:

# Drop uid
#setuid=pdns_recursor
# Drop gid
#setgid=pdns
# Don't log queries
quiet=on
local-address=127.0.0.1
# Local port to bind to
local-port=53
# Change root for safety
#chroot=/var/empty
allow-from=127.0.0.0/8, ::1/128
forward-zones-file=/usr/local/etc/pdns/forward-zone
-additional-processing


--
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Starting recursor on freebsd 8.2

2012-01-15 Thread fredrik danerklint
sorry about the noise. didn't think clear enough to realize that I 
already using port 53 on that machine! nothing to see here! move along!


2012-01-15 17:46, fredrik danerklint skrev:

Trying to start recursor on FreeBSD 8.2

Please tell me what I have missed in the configuration.

# netstat -ln -p udp
# /usr/local/etc/rc.d/pdns-recursor start
Starting pdns_recursor.
Jan 15 17:41:40 PowerDNS recursor 3.3 (C) 2001-2010 PowerDNS.COM BV (Jan
9 2011, 05:22:37, gcc 4.2.1 20070719 [FreeBSD]) starting up
Jan 15 17:41:40 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it according to the terms
of the GPL version 2.
Jan 15 17:41:40 Operating in 64 bits mode
Jan 15 17:41:40 Reading random entropy from '/dev/urandom'
Jan 15 17:41:40 Only allowing queries from: 127.0.0.0/8, ::1/128
Jan 15 17:41:40 Will not send queries to: 127.0.0.0/8, 10.0.0.0/8,
192.168.0.0/16, 172.16.0.0/12, ::1/128, fe80::/10, 0.0.0.0, ::
Jan 15 17:41:40 Enabling IPv6 transport for outgoing queries
Jan 15 17:41:40 Reading zone forwarding information from
'/usr/local/etc/pdns/forward-zone'
Jan 15 17:41:40 Done parsing 16 forwarding instructions from file
'/usr/local/etc/pdns/forward-zone'
Jan 15 17:41:40 Inserting rfc 1918 private space zones
Jan 15 17:41:40 Exception: Resolver binding to server socket on port 53
for 127.0.0.1: Address already in use
/usr/local/etc/rc.d/pdns-recursor: WARNING: failed to start pdns_recursor
# netstat -ln -p udp
#


recursor.conf:

# Drop uid
#setuid=pdns_recursor
# Drop gid
#setgid=pdns
# Don't log queries
quiet=on
local-address=127.0.0.1
# Local port to bind to
local-port=53
# Change root for safety
#chroot=/var/empty
allow-from=127.0.0.0/8, ::1/128
forward-zones-file=/usr/local/etc/pdns/forward-zone
-additional-processing





--
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] [Patch] SLAVE refresh performance

2011-09-16 Thread fredrik danerklint
I think you have missed the point of the luabackend.

This backend does not have any kind of logic in it. 

It only calls functions in Lua with the parameters received from PDNS:s 
backend.

That means that you will have to implement to hole logic, by yourself, in Lua.

I did this backend since it can be easier to implement a backend for PDNS 
within Lua than it can be with c++. 

Take the ldapbackend for an example. If I have understand the development of 
it it has stalled. Implement it in Lua, and I think, you can have even more 
people working on it and have better support etc within Lua, since it is 
easier to understand Lua syntax than c++ (well, ok. let's not have that as an 
discussion now!). Basically this was the argument that I had with myself to 
make the Luabackend.


So now back to your question. Take a look at line 184 in slave.cc (with the 
patch applied). You will see thisone:

lua_pushnumber(lua, refresh);

Here the luabackend push the refresh number to the backend in Lua. You can use 
it if you want since it actually optional.Until PDNS itself does make use of 
this extra parameter, the refresh parameters will be zero (0).


 Does this patch actually implement the improved behavior? It seems this
 patch only extends the setFresh() function to accept the refresh value,
 but do not use it.
 
 klaus
 
 On 15.09.2011 16:41, fredrik danerklint wrote:
  Here is a patch for the luabackend.
  
  
  
  
  ___
  Pdns-users mailing list
  Pdns-users@mailman.powerdns.com
  http://mailman.powerdns.com/mailman/listinfo/pdns-users

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Update of MongoDB backend

2011-09-16 Thread fredrik danerklint
Hi!

This is an update to make the function getUpdatedMasters a little faster since 
it now use server-side processing instead of client processing.

(and also the performance increase for slave discussed earlier -  remember: 
there is no slave functionality in the backend - yet.).

For reference, see http://groups.google.com/group/mongodb-
user/browse_frm/thread/40d606279084eed4

-- 
//fredan
Index: test/mongodb.example.com.generate-hosts
===
--- test/mongodb.example.com.generate-hosts	(revision 2261)
+++ test/mongodb.example.com.generate-hosts	(arbetskopia)
@@ -1,4 +1,4 @@
-#!/usr/local/bin/bash
+#!/usr/bin/env bash
 
 h=0
 i=0
Index: master.cc
===
--- master.cc	(revision 2261)
+++ master.cc	(arbetskopia)
@@ -25,7 +25,7 @@
 virtual void getUpdatedMasters(vectorDomainInfo* domains);
 virtual void setNotifed(int id, u_int32_t serial);
 */
-
+/*
 void MONGODBBackend::getUpdatedMasters(vectorDomainInfo* domains) {
 //please see the function getTheFreshOnes in private.cc 
 
@@ -34,7 +34,38 @@
 
 getTheFreshOnes(domains, type, f_name);
 }
+*/
+void MONGODBBackend::getUpdatedMasters(vectorDomainInfo* domains) {
+string f_name = (getUpdatedMasters);
 
+mongo::Query mongo_q = QUERY( type  MASTER  $where  this.notified_serial != this.SOA.serial );
+
+auto_ptrmongo::DBClientCursor mongo_c;
+mongo_c = m_db.query(collection_domains, mongo_q);
+
+string m_q = mongo_q.toString();
+
+if(logging)
+LLogger::Info  backend_name  f_name   Query:  m_q  endl;
+
+if (!mongo_c-more()) 
+return;
+
+while(mongo_c-more()) {
+DomainInfo di;
+SOAData sd;
+
+mongo::BSONObj mongo_r = mongo_c-next();
+
+string domain = mongo_r.getStringField(domain);
+
+if (checkDomainInfo(domain, mongo_r, f_name, m_q, di, sd)) {
+di.serial = sd.serial;
+domains-push_back(di);
+}
+}
+}
+
 void MONGODBBackend::setNotifed(int id, u_int32_t serial) {
 mongo::Query mongo_q = QUERY( domain_id  id );
 bson::bo update = BSON( $set  BSON(notified_serial  serial ));
Index: schema.mongodb.sql
===
--- schema.mongodb.sql	(revision 2261)
+++ schema.mongodb.sql	(arbetskopia)
@@ -5,6 +5,7 @@
 { 	domain_id : int, 
 	name : string, 
 	last_check : int, 
+	next_check : int,
 	notified_serial : int, 
 	type : string, 
 	ttl : int,
Index: mongodbbackend.hh
===
--- mongodbbackend.hh	(revision 2261)
+++ mongodbbackend.hh	(arbetskopia)
@@ -37,6 +37,7 @@
 bool isMaster(const string name, const string ip);
 void getUnfreshSlaveInfos(vectorDomainInfo* domains);
 void setFresh(int id);
+void setFresh(uint32_t id, uint32_t refresh);
 /*
 bool startTransaction(const string qname, int id);
 bool commitTransaction();
Index: slave.cc
===
--- slave.cc	(revision 2261)
+++ slave.cc	(arbetskopia)
@@ -36,18 +36,28 @@
 */
 
 void MONGODBBackend::setFresh(int id) {
+SOAData soadata;
+DomainInfo di;
+string empty;
+
+if (getDomainInfo(empty, di, soadata, id)) 
+	setFresh(id, ((unsigned int) time(0) + soadata.refresh));
+}
+
+void MONGODBBackend::setFresh(uint32_t id, uint32_t refresh ) {
 mongo::Query mongo_q = QUERY( domain_id  id );
-bson::bo update = BSON( $set  BSON(last_check  (unsigned int) time(0) ) );
+bson::bo update = BSON( $set  BSON(last_check  (unsigned int) time(0)  next_check  refresh) );
 
 if(logging) {
-LLogger::Info  backend_name  (setFresh)   Query:  mongo_q.toString()  endl;
+LLogger::Info  backend_name  (setFresh) Query:   mongo_q.toString()  endl;
 	if(logging_content)
-	LLogger::Info  backend_name  (setFresh)   Update:  update.toString()  endl;
+	LLogger::Info  backend_name  (setFresh) Update:   update.toString()  endl;
 }
 
 m_db.update(collection_domains, mongo_q , update, false );
 }
 
+/*
 void MONGODBBackend::getUnfreshSlaveInfos(vectorDomainInfo* domains) {
 //please see the function getTheFreshOnes in private.cc
 
@@ -56,7 +66,44 @@
 
 getTheFreshOnes(domains, type, f_name);
 }
+*/
 
+void MONGODBBackend::getUnfreshSlaveInfos(vectorDomainInfo* domains) {
+string f_name = (getUnfreshSlaveInfos);
+
+stringstream t;
+t  (unsigned int) time(0);
+
+mongo::Query mongo_q = QUERY( type  SLAVE  next_refresh  {$lte: + t.str() + });
+
+auto_ptrmongo::DBClientCursor mongo_c;
+mongo_c = m_db.query(collection_domains, mongo_q);
+
+string m_q = mongo_q.toString();
+
+if(logging)
+LLogger::Info  backend_name  f_name   Query:   m_q  endl;
+
+if (!mongo_c-more()) 
+return;
+
+while(mongo_c-more()) {
+DomainInfo 

Re: [Pdns-users] [Patch] SLAVE refresh performance

2011-09-15 Thread fredrik danerklint
Here is a patch for the luabackend.

-- 
//fredan
Index: test/powerdns-luabackend.lua
===
--- test/powerdns-luabackend.lua	(revision 2261)
+++ test/powerdns-luabackend.lua	(arbetskopia)
@@ -32,8 +32,10 @@
 
 records[www.test.com] = { {domain_id = 11, name = www.test.com, type = CNAME, ttl = 120, content = host.test.com} }
 records[host.test.com] = {
-{domain_id = 11, name = host.test.com, type = A, ttl = 120, content = 10.11.12.13},
-{domain_id = 11, name = host.test.com, type = , ttl = 120, content = 1:2:3:4:5:6:7:8}
+--{domain_id = 11, name = host.test.com, type = A, ttl = 120, content = 10.11.12.13},
+--{domain_id = 11, name = host.test.com, type = , ttl = 120, content = 1:2:3:4:5:6:7:8},
+{domain_id = 11, name = host.test.com, type = A, ttl = 120, content = 10.11.12.16},
+{domain_id = 11, name = host.test.com, type = , ttl = 120, content = 1:2:3:4:5:6:7:11}
 }
 
 
Index: luabackend.hh
===
--- luabackend.hh	(revision 2261)
+++ luabackend.hh	(arbetskopia)
@@ -52,6 +52,7 @@
 bool isMaster(const string name, const string ip);
 void getUnfreshSlaveInfos(vectorDomainInfo* domains);
 void setFresh(int id);
+void setFresh(uint32_t id, uint32_t refresh);
 
 bool startTransaction(const string qname, int id);
 bool commitTransaction();
@@ -150,8 +151,6 @@
 int f_lua_updatednssecorderandauth;
 
 
-//int my_lua_panic (lua_State *lua);
-
 //  FUNCTIONS TO THIS BACKEND
 bool getValueFromTable(lua_State *lua, const std::string key, string value);
 bool getValueFromTable(lua_State *lua, uint32_t key, string value);
@@ -176,54 +175,6 @@
 //dnssec.cc
 bool updateDomainKey(const string name, unsigned int id, bool toowhat);
 
-
-/*
-//minimal.cc
-bool content(DNSResourceRecord* rr);
-
-void getTheFreshOnes(vectorDomainInfo* domains, string *type, string *f_name);
-bool checkDomainInfo(const string *domain, mongo::BSONObj *mongo_r, string *f_name, string *mongo_q, DomainInfo *di, SOAData *soadata = NULL);
-
-
-//crc32.cc
-int generateCRC32(const string my_string);
-
-string mongo_db;
-string collection_domains;
-string collection_records;
-
-string collection_domainmetadata;
-string collection_cryptokeys;
-string collection_tsigkeys;
-
-mongo::DBClientConnection m_db;
-
-auto_ptrmongo::DBClientCursor cursor;
-
-string q_name;
-
-//long long unsigned int count;
-mongo::Query mongo_query;
-mongo::BSONObj mongo_record;
-bool elements;
-DNSResourceRecord rr_record;
-string type;
-mongo::BSONObjIterator* contents;
-
-
-
-unsigned int default_ttl;
-
-bool logging_cerr;
-bool logging_content;
-
-bool checkindex;
-
-bool use_default_ttl;
-
-bool axfr_soa;
-SOAData last_soadata;
-*/
 };
 
 #endif 
Index: slave.cc
===
--- slave.cc	(revision 2261)
+++ slave.cc	(arbetskopia)
@@ -167,6 +167,11 @@
 
 void LUABackend::setFresh(int id) {
 
+setFresh(id, 0);
+}
+
+void LUABackend::setFresh(uint32_t id, uint32_t refresh) {
+
 if (f_lua_setfresh == 0)
 return;
 
@@ -176,8 +181,9 @@
 lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setfresh);
 
 lua_pushnumber(lua, id);
+lua_pushnumber(lua, refresh);
 
-if(lua_pcall(lua, 1, 0, f_lua_exec_error) != 0) {
+if(lua_pcall(lua, 2, 0, f_lua_exec_error) != 0) {
 string e = backend_name + lua_tostring(lua, -1);
 lua_pop(lua, 1);
 
@@ -187,7 +193,6 @@
 
 if (logging)
 	L  Logger::Info  backend_name  (setFresh) END  endl;
-
 }
 
 void LUABackend::getUnfreshSlaveInfos(vectorDomainInfo* domains) {
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] The Lua Backend for PowerDNS

2011-06-05 Thread fredrik danerklint
  Fun news (I hope for all of you out there)!
 
 It is to me ;-) My love affair with Lua is not ending yet!

Me too. I probably have a few other things that I can see that benefits of 
Lua.

 I've merged this contribution in 2208, and added it to the default deb and
 rpm builds. To be fair, this is going to be 'experimental' in 3.0 (which
 really needs to be released).
 
 Thanks Fredrik!

Your welcome!

 Can you test if I got the merge right in tarball, rpm  deb?

I've checked out the source code and it compiled fine for me. 

I think that the include directory in 'Makefile.am' for Lua should be an 
parameter from the configurations script. You allready have this, don't you? 

It would be very nice if there was an ./configure --with-luajit as well, since 
that will give a good boost too. There is two things that needs to be changed 
to have this to work. 

First the include directory with the -DUSE_LUAJIT (for two more libraries to 
be loaded at startup: 'bit' and 'jit') and also the -llua5.1changed to 
-lluajit-5.1 in both 'Makefile.am' and 'OBJECTLIBS'.

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] MongoDB Backend merged Re: Mongo DB and PowerDNS part 3: Now with DNSSEC

2011-05-29 Thread fredrik danerklint
 So, please, be so kind as to answer one more question: When PDNS queries
 backends for updated serials, does it provide them with a list of the
 'notified_serial's (as per your explanation in a previous post of
 yours), that is, a list of all serials which it has previously used in
 notifications

Yes. Everytime PowerDNS asks a backend it will get back a list of domains that 
has a different notified_serial than the serial for the domain.

It's the seventh linefrom bottom in the file private.cc that has the logic 
for including a domain to that list.

Until Bert has applied the patch that I sent him, you need to apply the 
following to get masterfunctionallity to work with MongoDB backend:

Index: private.cc
===
--- private.cc  (revision 2199)
+++ private.cc  (arbetskopia)
@@ -28,6 +28,7 @@

di-id = mongo_r-getIntField(domain_id);
di-last_check = mongo_r-getIntField(last_check);
+   di-notified_serial = mongo_r-getIntField(notified_serial);
 
if (soadata == NULL) 
for( bson::bo::iterator i(mongo_r-getObjectField(masters)); 
i.more(); ) {


-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] MongoDB Backend merged Re: Mongo DB and PowerDNS part 3: Now with DNSSEC

2011-05-26 Thread fredrik danerklint
Nick,

To answer all of your questions, please take a look at the source file 
'communicator.cc'. At the end of that file there is a function called 
void CommunicatorClass::mainloop(void) that checks slave and master every 
other 'slave-cycle-interval' seconds (parameter taken from the pdns.conf 
file). I assume that this function is running in a seperate thread.

This is how PowerDNS knows when to send a update to other nameservers.


 On 25/5/2011 11:25 μμ, fredrik danerklint wrote:
  PowerDNS ask each backend for domains which has a different
  'notified_serial' than 'serial' for the domain.
 
 Thanks Fredrik for the info. If I understand it right, 'notified_serial'
 is the one PowerDNS knows as current for a domain, and 'serial' is the
 one stored in the same domain (in the backend), which may be updated or
 not.
 
 But how/when is this question from PowerDNS triggered? I mean, how
 PowerDNS knows *when* to ask the backend for an updated serial?
 
  This function is called getUpdatedMasters(vectorDomainInfo* domains)
  and exists in the source file 'master.cc' for MongoDB backend.
 
 I understand that the above function is part of the master (if I name it
 correctly) process (i.e. not the backend). So, how is it in a file of
 the backend?
 
  What PowerDNS except after a call to this function is a list of all
  domains that has a different serialnumber than notified serialnumber.
  
  Every backend can implement this functionallity differently since
  PowerDNS does not know how the information about a domain is stored.
 
 That's trivial to retrieve, whatever the backend.
 
  The good part that you asked about this is that I (you!) found a bug
  which would not fill out the domains that has a different serial number
  against the real serial number. I've sent Bert a patch to be included in
  the source code to fix this.
 
 I am glad I helped (even without knowing it) for a fix!
 
 
 Nick

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] MongoDB Backend merged Re: Mongo DB and PowerDNS part 3: Now with DNSSEC

2011-05-26 Thread fredrik danerklint

 On 26/5/2011 3:44 μμ, fredrik danerklint wrote:
  Nick,
  
  To answer all of your questions, please take a look at the source file
  'communicator.cc'. At the end of that file there is a function called
  void CommunicatorClass::mainloop(void) that checks slave and master
  every other 'slave-cycle-interval' seconds (parameter taken from the
  pdns.conf file). I assume that this function is running in a seperate
  thread.
  
  This is how PowerDNS knows when to send a update to other nameservers.
 
 Actually, I am afraid things do not work like that. 

And I'm afraid that it does work like this. Hopefully Bert can answer better 
than I can on this.

Please take a look at the file that I sad earlier that you should.

Have you read the documentation about writeing a backend?
http://doc.powerdns.com/master-backends.html

It says that the backend only needs to have these two function to functions as 
a master backend and that what's I have done with the MongoDB backend.

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] MongoDB Backend merged Re: Mongo DB and PowerDNS part 3: Now with DNSSEC

2011-05-25 Thread fredrik danerklint
Nikolas,

PowerDNS ask each backend for domains which has a different 'notified_serial' 
than 'serial' for the domain. 

This function is called getUpdatedMasters(vectorDomainInfo* domains) and 
exists in the source file 'master.cc' for MongoDB backend. 

What PowerDNS except after a call to this function is a list of all domains 
that has a different serialnumber than notified serialnumber.

Every backend can implement this functionallity differently since PowerDNS 
does not know how the information about a domain is stored.


The good part that you asked about this is that I (you!) found a bug which 
would not fill out the domains that has a different serial number against the 
real serial number. I've sent Bert a patch to be included in the source code 
to fix this.


 On 14/4/2011 9:30 μμ, bert hubert wrote:
  Hi Fredrik,
  I have just merged it with the build system based on your latest version.
  It is part of build 2163, and will be shipped as 'experimental' with
  version 3.0.
 
 Hi Fredrik and all,
 
 I see here: http://doc.powerdns.com/mongo.html that pdns/mongodb
 supports Master functionality. I assume this means that it detects zone
 serial changes and sends Notify messages as needed (and then sends AXFR
 as requested by slaves).
 
 My question is: how to you implement this functionality (conceptually),
 since Mongo DB (as far as I know) doesn't support triggers?
 
 Can you provide some feedback on this please?
 
 Thanks,
 Nick

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Performance of LUABackend

2011-05-12 Thread fredrik danerklint
This is just a test to see how fast it can be with only two records in lua:

records[host.test.com] = {domain_id = 11, name = host.test.com, type = 
A, ttl = 120, content = 10.11.12.13}
records[www.test.com] = {domain_id = 11, name = www.test.com, type = 
CNAME, ttl = 120, content = host.test.com}

PowerDNS was running with only one thread and all cache-values set to zero!

$ dig a www.test.com @127.0.0.1 -p5300 +multiline

;  DiG 9.7.1-P2  a www.test.com @127.0.0.1 -p5300 +multiline
;; global options: +cmd
;; Got answer:
;; -HEADER- opcode: QUERY, status: NOERROR, id: 63792
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;www.test.com.  IN A

;; ANSWER SECTION:
www.test.com.   120 IN CNAME host.test.com.
host.test.com.  120 IN A 10.11.12.13

;; Query time: 0 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Thu May 12 15:56:26 2011
;; MSG SIZE  rcvd: 65



dnsperf is asking for www.test.com

$ ./dnsperf

DNS Performance Testing Tool

Nominum Version 1.0.1.0

[Status] Processing input data
[Status] Sending queries (to 127.0.0.1)
[Status] Testing complete

Statistics:

  Parse input file: multiple times
  Run time limit:   60 seconds
  Ran through file: 1398285 times

  Queries sent: 1398285 queries
  Queries completed:1398285 queries
  Queries lost: 0 queries

  Avg request size: 30 bytes
  Avg response size:65 bytes

  Percentage completed: 100.00%
  Percentage lost:0.00%

  Started at:   Thu May 12 15:49:24 2011
  Finished at:  Thu May 12 15:50:24 2011
  Ran for:  60.03 seconds

  Queries per second:   23304.748835 qps

Latency: Min: 0.00 s; Max: 0.022691 s; Avg: 0.43 s; StdDev: 0.41

Response latency distribution (total 1398285 responses):

Latency   Success  Fail |
0.100s1398285 0 |

0.200s 0 0 |
0.300s 0 0 |
0.400s 0 0 |
0.500s 0 0 |
0.600s 0 0 |
0.700s 0 0 |
0.800s 0 0 |
0.900s 0 0 |
1.000s 0 0 |
=   1.000s 0 0 |

Legend:

# = success responses (RCODE was NOERROR or NXDOMAIN)
- = failure responses (any other RCODE)

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Performance of LUABackend

2011-05-12 Thread fredrik danerklint
  This is just a test to see how fast it can be with only two records in 
lua:
 So you have a Lua backend? ;-) Can you share?

Not yet since it only can handle the minimal (ie: no slave, master or 
dnssec) or would you like to have this at this stage with just the bare 
minimal ? If so, no problem. I do need some help to be able to understand 
what cause it to crash if there is more than one thread in PowerDNS. When I 
tried with luajit for one thread it sad something like stackoverflow... So I 
have done something that I don't quiet understand at this moment.
 
Queries per second:   23304.748835 qps
 
 To validate  understand such numbers it is good to do a cached run too,
 since that provides a baseline how fast the 'bare' PowerDNS is.

This is with only one thread and default cache-values:

Queries per second:   43843.606436 qps
Latency: Min: 0.00 s; Max: 0.009435 s; Avg: 0.23 s; StdDev: 0.27


-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Performance of LUABackend

2011-05-12 Thread fredrik danerklint
  Not yet since it only can handle the minimal (ie: no slave, master or
  dnssec) or would you like to have this at this stage with just the bare
  minimal ? If so, no problem. I do need some help to be able to
  understand what cause it to crash if there is more than one thread in
  PowerDNS. When I tried with luajit for one thread it sad something like
  stackoverflow... So I have done something that I don't quiet understand
  at this moment.
 
 Are you trying to use a single lua_State from multiple threads?

Well, no. It's basiclly an structure in the backend itself so when PowerDNS 
creates new threads, I hope, that the backend structure is a new one and not a 
copy of another one..

cat luabackend.hh:
class LUABackend : public DNSBackend {
public:
lua_State *lua;
etc...
}

and I have this in the reload function:

void LUABackend::reload() {
if (lua)
lua_close(lua);

lua = lua_open();

etc...
}
-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Some DNS performance tests with various PDNS backends and BIND9

2011-05-11 Thread fredrik danerklint
Nick,

Can you send me the examplecom.txt file so that I can test the mongodb 
backend?

 Hello,
 
 Just in case someone would like to examine some comparative performance
 results re. various PowerDNS backends with ref. to BIND9, I am posting
 the following tests.
 

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Performance of MongoDBBackend

2011-05-11 Thread fredrik danerklint
All test performed on the same machine, which has 16GB of ram and 6 core amd 
3,2 Ghz processor. The database is on a raid5 on 6 sata disks.

The database has 16M records for the example.com zone and there is also 
another 16M zones too. 

I've also run pdnssec secure-zone example.com and it took some time to do 
that!


This is what was running at the same time:

One instance importing dns.records at minimum 7500 inserts per second (!)
One instance running pdnssec secure-zone.

Three instances of dnsperf:

One with the first 500k records from the example.com zone.
One with the last 500k records from the example.com zone.
One with the first 736 records from the example.com zone.

These test was running for 600 seconds (10 minutes).
PowerDNS had threads=6 and all the default values for the cache.

The first one:
Queries per second:   4359.149303 qps
Latency: Min: 0.00 s; Max: 1.040222 s; Avg: 0.004588 s; StdDev: 0.011593

Second :
Queries per second:   4375.941063 qps
Latency: Min: 0.00 s; Max: 1.040598 s; Avg: 0.004570 s; StdDev: 0.011539

And the third:
Queries per second:   35714.362440 qps
Latency: Min: 0.00 s; Max: 1.040378 s; Avg: 0.000560 s; StdDev: 0.002787

Yes, that's right. I've even come close to 99 000 qps with only 736 records to 
test on one instance of dnsperf.

This is the same without any cache-values at all:

The first one:
Queries per second:   2429.863022 qps
Latency: Min: 0.00 s; Max: 1.610033 s; Avg: 0.008151 s; StdDev: 0.016539

Second:
Queries per second:   2431.379185 qps
Latency: Min: 0.000586 s; Max: 2.088204 s; Avg: 0.008166 s; StdDev: 0.016887

And the third again:
Queries per second:   2424.202366 qps
Latency: Min: 0.000576 s; Max: 1.609879 s; Avg: 0.008154 s; StdDev: 0.016426

So that is at least 7 200 qps with no cache-values in PowerDNS.

Without any cache-values the qps is more or less always 11 000 if you don't 
insert anything at the same time and running only one instance of dnsperf!

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] mysql-tests

2011-05-01 Thread fredrik danerklint
erkan,

if you used a script to generate all the data, do you think that you can post 
that so I also can run these test against the mongodbbackend?


 Moin Bert,
 
 On Wed, Apr 27, 2011 at 03:15:27PM +0200, bert hubert wrote:
  On Sat, Apr 23, 2011 at 01:04:51AM +0200, erkan yanar wrote:
   As Im missing any good data I created 6*10^6 entries for domains and
   for every domain some entries in the records-table (about 66*10^6)
  
  That is a pretty good test! 6 million domains is around 2 million domains
  smaller than the largest deployment we know of.
  
 Queries per second:   10923.212970 qps
  
  Interesting. Post 3.0 we will be focussing on performance for a few
  releases. It may well be that we'll add guidance on which indexes to use.
 
 In fact I did a new test (on sunday azlev forced me to use -q :):
 
  # ./dnsperf -d /var/tmp/pdns.list -q 4000 -s localhost
 
 DNS Performance Testing Tool
 
 Nominum Version 1.0.1.0
 
 [Status] Processing input data
 [Status] Sending queries (to 127.0.0.1)
 [Status] Testing complete
 
 Statistics:
 
   Parse input file: once
   Ended due to: reaching end of file
 
   Queries sent: 494969 queries
   Queries completed:494969 queries
   Queries lost: 0 queries
 
   Avg request size: 55 bytes
   Avg response size:81 bytes
 
   Percentage completed: 100.00%
   Percentage lost:0.00%
 
   Started at:   Sun Apr 24 02:50:44 2011
   Finished at:  Sun Apr 24 02:51:05 2011
   Ran for:  21.518132 seconds
 
   Queries per second:   23002.414894 qps
 
 With pdns-cache it was easy doubled (with up to 1% Packet lost).
 
   As I miss live/real data I would like to get into contact with some
   live/real-data.
  
  You can use tcpdump  dnsreplay perhaps?
 
 Naa Im just a little dba. In fact I own 5 domains:)
 
 Erkan
 
 ___
 Pdns-users mailing list
 Pdns-users@mailman.powerdns.com
 http://mailman.powerdns.com/mailman/listinfo/pdns-users

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Mongo DB and PowerDNS part 3: Now with DNSSEC

2011-04-05 Thread fredrik danerklint
Heh!

I will release the source very soon, now! Just some documentation left before 
bert gets it...

 Fredrik,
 
  $ dig +dnssec -t A www.example.com @127.0.0.1 -p5300 +multiline
 
 The first thing I did was to check the date on your message, expecting
 you to have sent it on April 1st. :-)
 
 Congratulations, and I very much hope you'll make the source available
 once you feel confident.
 
 -JP

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Mongo DB and PowerDNS part 3: Now with DNSSEC

2011-04-05 Thread fredrik danerklint
Hi!

I've just send the sourcecode of the backend to Bert!


//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] wildcards in backend and wrong any answer

2011-04-01 Thread fredrik danerklint
I think you forgott to update the packethandler.hh ;-)

packethandler.cc:311: error: prototype for ‘bool 
PacketHandler::getBestWildcard(DNSPacket*, SOAData, const string, 
std::vectorDNSResourceRecord, std::allocatorDNSResourceRecord *)’ does not 
match any in class ‘PacketHandler’
packethandler.hh:113: error: candidate is: std::vectorDNSResourceRecord, 
std::allocatorDNSResourceRecord  PacketHandler::getBestWildcard(DNSPacket*, 
SOAData, const string)
packethandler.cc:1078: error: prototype for ‘bool 
PacketHandler::tryWildcard(DNSPacket*, DNSPacket*, SOAData, string, bool, 
bool)’ does not match any in class ‘PacketHandler’
packethandler.hh:114: error: candidate is: bool 
PacketHandler::tryWildcard(DNSPacket*, DNSPacket*, SOAData, string, bool)
packethandler.cc: In member function ‘DNSPacket* 
PacketHandler::questionOrRecurse(DNSPacket*, bool*)’:
packethandler.cc:1291: error: no matching function for call to 
‘PacketHandler::tryWildcard(DNSPacket*, DNSPacket*, SOAData, string, 
bool, bool)’
packethandler.hh:114: note: candidates are: bool 
PacketHandler::tryWildcard(DNSPacket*, DNSPacket*, SOAData, string, bool)

 
 On Fri, Apr 01, 2011 at 10:11:44PM +0400, Vasiliy G Tolstov wrote:
  Some new problem with pdsn trunk:
  Simple test - create domain, create subdomain with *.domain.tld IN A
 
 Fixed in commits 2111 and 2112. These commits also add regression tests so
 this error can't crop up again unnoticed.
 
 http://wiki.powerdns.com/trac/changeset/2112
 http://wiki.powerdns.com/trac/changeset/2111
 
 Apologies for having such a horrible bug at this stage!
 
 New packages are building for http://powerdnssec.org/downloads
 
   Bert
 ___
 Pdns-users mailing list
 Pdns-users@mailman.powerdns.com
 http://mailman.powerdns.com/mailman/listinfo/pdns-users

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Mongo DB and PowerDNS part 2

2011-03-26 Thread fredrik danerklint
This is from native backend with MongoDB!

$ dig www.example.com A @127.0.0.1 -p5300

;  DiG 9.7.1-P2  www.example.com A @127.0.0.1 -p5300
;; global options: +cmd
;; Got answer:
;; -HEADER- opcode: QUERY, status: NOERROR, id: 55603
;; flags: qr aa rd; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;www.example.com.   IN  A

;; ANSWER SECTION:
www.example.com.3600IN  CNAME   webserver.example.com.
webserver.example.com.  3600IN  A   1.2.3.4
webserver.example.com.  3600IN  A   1.2.3.5
webserver.example.com.  3600IN  A   1.2.3.6

;; Query time: 7 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Sat Mar 26 16:06:15 2011
;; MSG SIZE  rcvd: 105

The content of the database looks like this:
 
{ domain_id : 1, name : example.com, type : SOA, ttl : 3600, 
content : [ahu.example.com ns1.example.com 2008080300 1800 3600 604800 
3600] }
{ domain_id : 1, name : example.com, type : TXT, ttl : 3600, 
content : [ hallo allemaal!] }
{ domain_id : 1, name : example.com, type : NS, ttl : 3600, 
content : [ns1.example.com, ns2.example.com] }
{ domain_id : 1, name : webserver.example.com, type : A, ttl : 
3600, content : [1.2.3.4, 1.2.3.5, 1.2.3.6 ] }
{ domain_id : 1, name : www.example.com, type : CNAME, ttl : 3600, 
content : [webserver.example.com] }

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] PowerDNS + Redis, using PyPdnsRedis

2011-03-18 Thread fredrik danerklint
I'm working on it. It's gonna be a pipe backend (in c++) because I couldn't 
get it to compile as a native backend with the include files from MongoDB at 
this moment.

What I need right now is some data to test with. 

The readme file in directory regression-tests sad that there should be a file 
called testzone.

fredagen den 18 mars 2011 17.26.46 skrev  Jan-Piet Mens:
  Python pipe-backend for using Redis with PowerDNS
 
 Very interesting. Thanks for the heads-up! That's the second NoSQL
 implementation that I know of. (Wonders if frederik has had luck with
 MongoDB...)
 
 -JP
 ___
 Pdns-users mailing list
 Pdns-users@mailman.powerdns.com
 http://mailman.powerdns.com/mailman/listinfo/pdns-users

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Use recursor to block phishing

2008-07-25 Thread fredrik danerklint

You can use my NoMoreAds for that. 

http://www.fredan.org/os/

 Hi,

 How I create a zone on recursor to block phishing sites ?

 eg.: point the phishing.com domain to my loopback interface 127.0.0.1

 zone file exemple

 a1964.g.akamai.net.   127.0.0.1
 abakos.com.es.127.0.0.1
 abisource.com.127.0.0.1
 abrarsignage.com. 127.0.0.1
 absi2008.netfirms.com.127.0.0.1
 abssair.no.sapo.pt.   127.0.0.1
 academico.cefetpi.br. 127.0.0.1
 acces-direct.net. 127.0.0.1
 acceso.masminutos.com.127.0.0.1
 acecoti.com.ar.   127.0.0.1
 ad.uu500.com. 127.0.0.1


-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] No More Ads - Updated

2008-06-29 Thread fredrik danerklint
There is now a new version of the noads for the pdns_recursor!

This new version now has the possibility to automatically reload one of the 
files if they are changed! So all you have to do now is to change the file 
and do nothing more. 

The patch for the pdns_recursor itself includes a new log function so that you 
can log messages in the log file from the lua scripts.

You can find the new version here 
http://www.fredan.org/os/nomoreads-20080630.tar

Please see the included readme file of how to do this.

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] No More Ads!

2008-06-25 Thread fredrik danerklint
Since the release of pdns-recursor 3.1.7 you can make externa function with 
the help of the LUA language...

Well, what I've done is to take the host file from the site 
http://www.mvps.org/winhelp2002/hosts.htm to work with pdns-recursor.

So from now on you don't have to see those annoying ads anymore!

http://www.fredan.org/nomoreads_pdns-recursor.tar 

Please see the included readme file for instuction of how to do this.

-- 
//fredan
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users