possible domain_id mismatch in master database.

Discussion in 'General' started by nhybgtvfr, Dec 13, 2017.

  1. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    Hi,

    as the title suggests, I believe that there is a mismatch for the domain_ids in our master database.
    our multi-server system is configured with 'use the domain limits in client module to add new domains' enabled.
    it wasn't always enabled.

    however, looking directly at the db contents to find the easiest way to split one account with two websites into two separate accounts with 1 website each, I found the following (unrelated to my initial search):

    from the domain table:
    +-----------+------------+-------------+---------------+----------------+----------------+---------------+
    | domain_id | sys_userid | sys_groupid | sys_perm_user | sys_perm_group | sys_perm_other | domain |
    +-----------+------------+-------------+---------------+----------------+----------------+---------------+
    | 1717 | 1 | 719 | riud | ru | | *****sory.net |
    +-----------+------------+-------------+---------------+----------------+----------------+----------------+
    | 1911 | 1 | 483 | riud | ru | | *****ians.net |
    +-----------+------------+-------------+---------------+----------------+----------------+---------------+
    | 2044 | 1 | 595 | riud | ru | | *******park.co.uk |
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------------+

    however, from the web_domain table:
    | domain_id | sys_userid | sys_groupid | sys_perm_user | sys_perm_group | sys_perm_other | server_id | ip_address | ipv6_address | domain | type | parent_domain_id | vhost_type | document_root | web_folder | system_user | system_group
    | 1587 | 723 | 719 | riud | riud | | 12 | * | | *****isory.net | vhost | 0 | name | /var/www/clients/client718/web1587 | | web1587 | client718
    | 1717 | 1 | 483 | riud | riud | | 9 | NULL | NULL | ****ians.net | alias | 745 | NULL | NULL | NULL | NULL | NULL
    | 1911 | 1 | 595 | riud | ru | | 9 | * | | *******park.co.uk | vhost | 0 | name | /var/www/clients/client594/web1911 | | web1911 | client594
    domain_id 2044 doesn't exist in web_domain

    can the domain_id's in those tables be different for any particular reason? should they be?
    is there any easy way to get it all back into sync? although I've not checked a lot of domains, I suspect there will be similar mismatches for a lot of domains, and have been for an extended period of time.
    this now has me worried that having to run a full system resync, or even a resync on just one server will cause a lot more issues.

    thanks.
    lee.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    That's fine. The domain_id column in both tables is not related to each other, it's not the same ID.
     
  3. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    thank F*** for that. :) was worried it was a problem and the data would be fubar'd going back far too long to restore. :eek:

    so what would be the best way to split an account then? what I believe at the moment is:
    create a new client account;
    change the sys_groupid for the domain to be moved to the new account to the new account's id in the domain table;
    change the sys_groupid for the domain to be moved to the new account to the new account's id in the web_domain table;
    same for web_database, web_database_user, dns_rr, dns_soa, ftp_user, mail_domain, mail_user etc, etc.
    and then resync.
    what about the client id part for document_root and php_open_basedir in web_domain, should they be changed directly in the db before resyncing, or do they get changed during the resync?
    or is there an even easier way to do all this, other than backup up the site/db/dns/email, deleting it, and restoring it under a new account.
     

Share This Page