tigase-server icon indicating copy to clipboard operation
tigase-server copied to clipboard

Tigase Server and Multiple Databases

Open dnuob opened this issue 5 years ago • 1 comments

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?

dnuob avatar Mar 14 '20 12:03 dnuob

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 () {}
}

woj-tek avatar Mar 17 '20 17:03 woj-tek