API: Move DNS zone from one server to another

Discussion in 'ISPConfig 3 Priority Support' started by KoS, Aug 16, 2017.

  1. KoS

    KoS Member HowtoForge Supporter

    I have a new DNS server in a multiserver setup and would like to move the existing DNS zones to the new server via the API.
    Is it possible in general to "move" the zone to another server? at least in the UI I couldn't find an option.
    I tried with the dns_zone_get and dns_zone_update functions. Is it possible to move the zone that way?
    • use the "id" from get as "primary_id" for update
    • provide the right server_id in the params for update
    • i didn't provide a client_id for the update. is it needed? may that be the issue? which of the values in dns_zone_get is the client_id?
    Thanks for a hint in the right direction.
     
  2. KoS

    KoS Member HowtoForge Supporter

    As i want to move all multi-servers to a new server, my plan was to first "move" the dns/web/mail server and afterwards move the main/admin/ispconfig-server. what is the right way to move all the services etc?
    I thought i had read a while ago that e.g. i should setup the new web server machine, add it to ispconfig, rsync all the /var/www data, and then re-assign the websites in ispconfig? and similar for emails.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    A dns zone has no data, so you can use the api for that in this case. delete the zone on the old system and create it on the new one with the api.
     
  4. KoS

    KoS Member HowtoForge Supporter

    @till thank you. i am aware of the fact that the zone has no data and that is the reason why i have choosen the DNS to be first moved.
    but for obvious reason i want to MOVE the zones (one by one) via the API to the new server, and not RE-CREATE them with all the records in there. so is the dns_zone_update function not supposed to re-assign the whole zone (with all its records) to another server?

    but i see that i should probably get the migration tool as the API is not supposed to provide any support on moving the configuration of a dns zone/website/mail etc from one to another multi-server, even without the data on the file system. could that please be noted somewhere, as i suppose i am not the only one that was mislead? :-(
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The remote API is a way to add or update records in ISPConfig with a script, we nowhere state that the remote API is for moving data.

    It might be possible that you can use the dns update function to change the server_id of the record but youl probably have to update the sub records as well, have not tested that yet, but in case you want to move all dns zons in that ay, I would simply run an SQL query that changes the server_id in the dns_rr and dns_soa table and then do a resync.
     
    KoS likes this.
  6. KoS

    KoS Member HowtoForge Supporter

    @till: i tried exactly that, i changed the server_id in all the dns_rr and dns_soa records. -> as there is no zone left on the old server, a re-sync can only be selected for the new server -> the zones get created on the new server, as expected. but on the old server, neither the zones get deleted automatically (even after adding a dummy domain so to have the re-sync option available again), nor does it help to remove them from the bind-conf-file -> conf file get populated again with all the zones. from where does it take that domain/zone list?

    FYI: i changed the dns_rr/dns_soa entries on the MAIN server and NOT in the sql db of the old dns server. how can i re-sync the DBs to get the changes populated?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    A resync cannot be used to remove a zone from an old server as it works just with the data that exists on the master at the time you run the resync and due to the change of the IF, the master does not know that the zone was assigned to another server before. In your case, you'll have to use the remote api functions to delete the zone first on the old node and then use the remote api to add it on the new node.
     
  8. KoS

    KoS Member HowtoForge Supporter

    @till thanks for the info. happy that i will take the old server anyways offline, so i just removed the zones manually from the bind configuration and stopped the ispconfig cron jobs.

    as i will have to do the same for my multisite webserver, e.g. move all websites from one host to another, is there a recommended way how to do that?
     

Share This Page