2

I am trying to migrate samba domain controller (version 3.6, passdb backend = tdbsam) to a new clustered environment with CTDB (same samba version). I have a functional ceph storage and the ctdbd configured according to the documentation.

However, all available guides are for the fresh installations and I can't migrate current data into the CTDB.

Simply restoring tdb database into the CTDB doesn't work and it ends with the following error:

2015/05/25 22:25:04.849302 [ 5636]: Invalid version of database dump. File is version 7308332182664266836 but expected version was 1

Converting tdb database with ltdbtool doesn't bring any joy too.

How to import tdb samba databases into the ctdb? Thanks, Marko

biology.info
  • 3,500
  • 2
  • 28
  • 39
Marko
  • 46
  • 2
  • Seems that samba 3.6 doesn't work properly with ctdb 2.5 on centos 6.6. Samba4 from official repository works fine. – Marko May 27 '15 at 08:36

1 Answers1

1

Firstly a few words of warning: It is not common to cluster a domain controller with CTDB. Clustering/CTDB is made for file servers which are usually member servers in a domain. The domain controller's primary purpose is to offer logon services for the clients and usually different replication services are used (e.g. storing the DB in ldap instead of TDB). Clustering a domain controller can be problematic since the whole cluster needs to present itself consistently as a single server to the clients. This may pose problems with nmbd / NetBIOS name resolution. Furthermore, one problem is that you need to make sure in the cluster that all underying user accounts are created on all ctdb cluster nodes with the same user IDs.

Generally, it is best practice to separate file servers roles from domain controller roles as much as possible. Also keep in mind that starting with Samba 4.0 there is now the functionality of a Active Directory domain controller which comes with multi-master replication of the user database at the protocol level.

All that being said, the important bit is that you can not freely replace samba and ctdb versions. Samba 3.6 should work with ctdb 2.5, but Samba needs to be recompiled against the ctdb version to be used. I.e. if Samba has been compiled against an older version of CTDB (like 1.0.114.X), then this binary package won't work with CTDB 2.5.

If you have a working set of samba and ctdb packages, then the process of migrating a previous install into this new install depends on whether the previous install was also a CTDB-cluster. If so, you can do

ctdb getdbmap

on the old install and then run

ctdb backupdb

on all databases marked PERSISTENT. On the new install you use

ctdb restoredb

to restore all these DBs.

If the previous install is a non-clustered Samba, then your hint to use ltdbtool is correct. You have to

  • copy the important databases off the old install, at least:

    secrets.tdb passdb.tdb winbindd_idmap.tdb group_mapping.tdb account_policy.tdb share_info.tdb

  • convert them to ctdb format with ltdbtool

  • make sure ctdb is OFF on all nodes
  • copy the converted dbs to /var/lib/ctdb/persistent/ on node number 0 suffixing the file name with .0 e.g. `/var/lib/ctdb/persistent/secrets.tdb.0'
  • start ctdb on node 0
  • start ctdb on all other nodes

after that, the these DBs should be in sync on the cluster.

Michael Adam
  • 741
  • 7
  • 7