Re: [exim] Different MySQL connections for different jobs

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Mike Cardwell
Data:  
Para: exim-users
Asunto: Re: [exim] Different MySQL connections for different jobs
* on the Tue, Sep 05, 2006 at 07:34:28PM +0800, W B Hacker wrote:

>> I have a master database. I replicate that out to slave databases that
>> sit locally on each mail server. Exim then reads configuration from
>> those local copies.
>> I now have a need to write to the database from exim as well. I obviously
>> can't write to the local read only slave copies of the database.
>>
> With minor modification, perhaps you can do.
>
> Presuming you auto-timestamp entries, edits, updates, simply write to the local
> copy.
>
> Then - before the master pushes new data, it can query the local copies for any
> entry newer than its last 'pushed update' timestamp, retreive only the altered
> records, if any, merge them into the master, THEN push a new update.


I'm not sure this method is workable with MySQL replication, but thanks
for the suggestion.

>> Is there a way of setting up more than one MySQL
>> server in an exim configuration and then explicitly choosing which one
>> to use when you run a query? I'm guessing not, but still thought I'd
>> ask...
>>
>> I could hack around it by writing a daemon which listens for socket
>> connections from exim, and then "proxies" commands to the master db. That
>> would be nasty though.
>>
>> I nice solution would be for you to be able to do:
>>
>> hide mysql_servers = named_database1=localhost/dbname1/dbuser1/dbpass1: \
>>                      named_database2=otherhost/dbname2/dbuser2/dbpass2

>>
>> And then name your database in the lookup:
>>
>> ${lookup mysql{named_database1}{THE QUERY}{$value}}
>>
>> Or similar.
>>
> Now *that* would be generally useful indeed....
>
> Wonder what happens with present code if one were to have a
>
> 'hide mysql_servers..'
>
> AND a
>
> 'hide pgsql_servers...'
>
> (or other, different RDBMS...)


A similiar method to what I'd find useful in MySQL already exists with SQLite:

${lookup sqlite{/path/to/sqlitedb SELECT blah FROM blah WHERE blah}}

somelist blah = sqlite;/path/to/sqlitedb SELECT blah FROM blah WHERE
blah;

Mike