Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new backup mechanism for Wazuh-DB databases - Implementation #11389

Closed
8 tasks done
pereyra-m opened this issue Dec 16, 2021 · 1 comment · Fixed by #11451
Closed
8 tasks done

Create a new backup mechanism for Wazuh-DB databases - Implementation #11389

pereyra-m opened this issue Dec 16, 2021 · 1 comment · Fixed by #11451
Assignees
Labels
module/db Wazuh DB engine type/enhancement New feature or request

Comments

@pereyra-m
Copy link
Member

pereyra-m commented Dec 16, 2021

Description

As part of the changes introduced in the epic #10771, the agents' groups files will be migrated to global.db. Until now, this database could be safely removed because it was always recreated with information from other sources. But now it will be the only place where the groups assignation will be stored, so a configurable mechanism should be implemented to store this information regularly.

Requirements

This implementation will be based in the final design described in #11317.

  • A new block of configurations should be added for this feature
<wdb>
    <backup database='global'> 
        <enabled>yes</enabled>
        <interval>1d</interval>
        <max_files>3</max_files>
    </backup>
</wdb>
  • The default values for these settings should be the ones specified in the XML block above.

  • A new set of commands for Wazuh-DB should be implemented to manage the database backup and restore

  • global backup create will generate a new backup of the global.db database.

  • global backup get will return the list of backups already created in JSON format.

  • global backup restore {"snapshot": "<backup_file_name>","save_pre_restore_state": true/false} will restore the specified backup file. In addition, if required, it will generate a backup of the database previous to the restoration.

Risks

It is important to analyze different use cases, for example, database corruption, full disk, etc.
Consider the case of restoring a backup DB in which a database could get damaged.

  • The current wdb_backup_global() should be analyzed, to determine if it'll be still working the same way and with the same name.

Testing required

  • The new command saves the database correctly
  • The new command restores the selected DB
  • The max files setting work as expected
  • Wazuh-DB performs the backups according to the defined interval
@DProvinciani
Copy link
Contributor

Closing the issue as the pull #11451 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/db Wazuh DB engine type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants