[Exim] Multiple MySQL databases and hosts

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Ollie Cook
Dátum:  
Címzett: exim-users
Tárgy: [Exim] Multiple MySQL databases and hosts
Hi,

It seems to me that there is a bit of a issue with Exim
with regards to MySQL databases, *if* you want to look things
up in different databases on a variety of hosts.

I know that you can specify more that one MySQL connection:

 mysql_servers = host1::3306/database1/user1/password1\
                 host2::3306/database2/user2/password2


But imagine a situation where you have:

# main config
DOMAINS = SELECT domain FROM domains WHERE domain='$key'
USERS = SELECT login FROM users WHERE login='${quote_mysql:$local_part}'
local_domains = mysql;DOMAINS

  # director
  valid_users:
    driver = smartuser
    transport = local_delivery
    local_parts = mysql;USERS


If the "domains" table is on host2 and the "users" table is on host1
when a mail arrives Exim will do three lookups:

  1)  DOMAINS lookup on host1 which will fail because that table
      doesn't exist on host1
  2)  DOMAINS lookup on host2 which will succeed if the domain
      is in the table on host2
  3)  USERS lookup on host1 if #2 succeeds


It seems wasteful to do query #1, here.

As far as I can tell there is no way to specify that a particular
query should use a particular connection, although I'd like to be
corrected!

Might I suggest for Exim 4 something where users could give
host+database+user+password combinations an identifier:

  mysql_servers = domains/host1::3306/database1/user1/password1\
                  users/host2::3306/database2/user2/password2


                #  ^^^ identifier


and then use things like:

local_domains = mysql;domains;DOMAINS
local_parts = mysql;users;USERS

to specify which host to look up a particular query with?

I think it would save rather a lot of lookups which administrators know
are going to fail, reducing load on the database servers, and would speed
up the handling of mail on busy servers.

Ollie
-- 
Oliver Cook    Systems Administrator, ClaraNET
ollie@???               020 7903 3065