tigase / tigase-server

(M) Highly optimized, extremely modular and very flexible XMPP/Jabber server
https://tigase.net
GNU Affero General Public License v3.0
322 stars 107 forks source link

Tigase Server and Multiple Databases #24

Open dnuob opened 4 years ago

dnuob commented 4 years ago

Hi, below is sample from tigase administration guide,

dataSource {
    default () {
        uri = 'jdbc:mysql://db2.tigase/dbname?user&password'
    }
    'default-auth' () {
        uri = 'jdbc:mysql://db1.tigase/dbname?user&password'
    }
  }
userRepository {
    default () {}
}
authRepository {
    default () {
        cls = 'tigase.db.jdbc.TigaseCustomAuth'
        'data-source' = 'default-auth'
    }
}

what is the difference between default datasource and default-auth datasource? do they have the same tables, functions and procedures? or another saying, are they clonable structure to each other?

woj-tek commented 4 years ago

what is the difference between default datasource and default-auth datasource?

In above example - they use completely different databases (db1.tigase vs db2.tigase)

do they have the same tables, functions and procedures? or another saying, are they clonable structure to each other?

They are mapped to AuthRepository and UserRepository and respective functionality defined in them. Now, depending on repository used, data structures may be different. In case of MySQL all structures would be effectively the same (tig_users, tig_nodes and tig_pairs being the basis). However, if you consider 'cloning' then you should just use single data-source for both UserRepository and AuthRepository:

dataSource {
    default () {
        uri = 'jdbc:mysql://db2.tigase/dbname?user&password'
    }
}
userRepository {
    default () {}
}
authRepository {
    default () {}
}