Re: [Dovecot] overriding userdb connection host for doveadm-user

2011-12-10 Thread Timo Sirainen
On Thu, 2011-12-08 at 08:58 -0500, micah anderson wrote:
> On Thu, 08 Dec 2011 06:22:58 +0200, Timo Sirainen  wrote:
> > On Wed, 2011-12-07 at 13:02 -0500, Micah Anderson wrote:
> > > I've got my users in a replicated database setup and dovecot configured
> > > with two connect lines in dovecot-sql.conf:
> > > 
> > > connect = host=127.0.0.1 port=3306 dbname=users user=user password=pass
> > > connect = host=127.0.0.2 port=3306 dbname=users user=user password=pass
> > > 
> > > this works really well to help balance the load. 
> > 
> > If you actually have it like that, it should only be using 127.0.0.2, as
> > the second connect setting overrides the first one.. 
> 
> What I actually have is:
> 
> connect = host=127.0.0.1 port=3306 dbname=users user=user password=pass
> connect = host=127.0.0.1 port=3307 dbname=users user=user password=pass
> 
> two different port configurations (I'm running stunnel), rather than two
> different host entries[0]. 

The only port Dovecot should be connecting with the above config is
3307.

> >The right way would have been:
> > 
> > connect = host=127.0.0.1 host=127.0.0.2 port=...
> 
> So, if I just have two different ports, would the right way be:
> 
> connect = host=127.0.0.1 port=3306 port=3307 dbname...
> 
> ?

There's actually no way to load balance between multiple ports. If there
were, the config would probably have to be changed to something like
host=127.0.0.1:3306 host=127.0.0.1:3307, because otherwise it would be
confusing what should happen when there are multiple hosts and multiple
ports.

Anyway, maybe you could use multiple IPs instead of multiple ports?
"host=127.0.0.1 host=127.0.0.2".



Re: [Dovecot] overriding userdb connection host for doveadm-user

2011-12-08 Thread micah anderson
On Thu, 08 Dec 2011 06:22:58 +0200, Timo Sirainen  wrote:
> On Wed, 2011-12-07 at 13:02 -0500, Micah Anderson wrote:
> > I've got my users in a replicated database setup and dovecot configured
> > with two connect lines in dovecot-sql.conf:
> > 
> > connect = host=127.0.0.1 port=3306 dbname=users user=user password=pass
> > connect = host=127.0.0.2 port=3306 dbname=users user=user password=pass
> > 
> > this works really well to help balance the load. 
> 
> If you actually have it like that, it should only be using 127.0.0.2, as
> the second connect setting overrides the first one.. 

What I actually have is:

connect = host=127.0.0.1 port=3306 dbname=users user=user password=pass
connect = host=127.0.0.1 port=3307 dbname=users user=user password=pass

two different port configurations (I'm running stunnel), rather than two
different host entries[0]. 

>The right way would have been:
> 
> connect = host=127.0.0.1 host=127.0.0.2 port=...

So, if I just have two different ports, would the right way be:

connect = host=127.0.0.1 port=3306 port=3307 dbname...

?

micah


0. When I was anonymizing the db connection information in the original
post, I accidentally changed the ip and decided it didn't matter for the
question I was asking, so just left it. Now I see that might be
confusing.


pgpN0jQlsZCIa.pgp
Description: PGP signature


Re: [Dovecot] overriding userdb connection host for doveadm-user

2011-12-07 Thread Timo Sirainen
On Wed, 2011-12-07 at 13:02 -0500, Micah Anderson wrote:
> I've got my users in a replicated database setup and dovecot configured
> with two connect lines in dovecot-sql.conf:
> 
> connect = host=127.0.0.1 port=3306 dbname=users user=user password=pass
> connect = host=127.0.0.2 port=3306 dbname=users user=user password=pass
> 
> this works really well to help balance the load. 

If you actually have it like that, it should only be using 127.0.0.2, as
the second connect setting overrides the first one.. The right way would
have been:

connect = host=127.0.0.1 host=127.0.0.2 port=...

> I would like a way to see if the new user's information has been
> replicated yet before sending the email. I was thinking I could use
> 'doveadm user' to lookup the user, but I am not sure that I can specify
> one of the specific 'connect' lines in my configuration to check. Is
> there a way to override that configuration variable to do this test? I
> tried various incarnations of passing '-o connect=host='... but doveadm
> user would just ignore them.

doveadm does the lookup via auth-userdb socket. You have two
possibilities:

a) Have doveadm use another auth-userdb socket that points to another
dovecot installation with different configuration.

b) Use a different userdb configuration for doveadm:

protocol !doveadm {
  userdb {
driver = sql
args = /.../dovecot-sql.conf.ext
  }
}
protocol doveadm {
  userdb {
driver = sql
args = /.../dovecot-sql-slave.conf.ext
  }
}