Accidentally removed server from config (single server)

Discussion in 'General' started by tijn, Jul 6, 2017.

  1. tijn

    tijn New Member

    Hi All,
    I accidentally removed the only server via the ISPconfig3 interface (System -> Server Config).
    Every service is still working but i'm not sure what the impact is...
    I checked the ISPconfig manual but can't find anything related (importance of restoration).
    So, how bad is this and how can i restore the server in the interface?
    Thanks in advance!

    Version: 3.0.5.4p8 on Ubuntu 15.04
    ispconfig.png
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    That's really bad, don't use ISPConfig until you restored it as this holds the complete global server config. When you installed an ISPConfig update recently, then there should be a backup of the dbispconfig database in /var/backup. These backups contain a sql file with the content of the dbispconfig database at the time point of the backup, open this sql file and search for the sql insert statement that inserts the data into the table named 'server'. Copy this sql staement and execute it inside your dbispconfig database with e.g. phpmyadmin. Before you do that, better take a backup of the dbispconfig database with phpmyadmin, just to be sure.
     
  3. tijn

    tijn New Member

    Thanks for your quick reply!
    At this moment i'm restoring the backup from a day earlier and going to extract the 'server' table.
    I will keep you updated :D
     
  4. tijn

    tijn New Member

    Works again!
    What i did:
    (0. Mess things up)
    1. restore a backup of the (in my case) virtual server with a different IP
    2. Login to the restored server and: mysqldump -u root -p dbispconfig server > server.sql
    3. Copy server.sql to the original server
    4. Make a backup of the current table: mysqldump -u root -p dbispconfig server >oldserver.sql
    5. Import the copied server.sql: mysql -u root -p dbispconfig <server.sql

    Remember kids, Back-ups matter!

    Thanks again Till!
     
  5. sjau

    sjau Local Meanie Moderator

    You should always have backups and in addition offsite backups :)
     
  6. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    To avoid this and similar scenarios for others in the future, wouldn't there be a few checks that could be made and present a warning before allowing a user to remove servers which are in use? (ie. as a web server, mail server, etc...) Maybe even consider a database level constraint ("on delete no action" on foreign key) to ensure this?
     

Share This Page