Backup and Restore¶
This section provides instructions on how to back up and restore your NetEye configuration and data. Regular backups are essential to prevent data loss and ensure quick recovery in case of system failures or other issues.
Supported services¶
Currently, the backup and restore procedures support out-of-the box the following services:
- Core:
NetEye base configuration files, e.g.
/etc/neteye-cluster,/etc/neteye-satellite.dand SSH keys
- Elastic Stack:
Elasticsearch
Kibana
Supported providers¶
The backup and restore procedures currently support AWS S3 buckets as remote storage providers. Support for additional providers will be added in future releases.
Configuring S3 buckets for backup and restore¶
In order to use an S3 bucket as remote storage for backup and restore operations, you need to perform the following steps:
Create an S3 bucket in your AWS account.
Create a KMS key for encrypting the backup data server side. To do so, please follow the official AWS documentation.
Using the AWS Console, create an IAM user. When is time to assign permissions, choose the option to attach existing policies directly, and create a new policy with the permissions as outlined below (replace the placeholders with your actual bucket name, region, account id, and key id):
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "s3:ListBucketMultipartUploads", "s3:ListBucketVersions", "s3:ListBucket", "s3:GetBucketLocation", "s3:CreateBucket" ], "Resource": [ "arn:aws:s3:::<your-bucket-name>" ] }, { "Sid": "VisualEditor1", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:AbortMultipartUpload", "s3:DeleteObject", "s3:ListMultipartUploadParts", "s3:CreateBucket" ], "Resource": [ "arn:aws:s3:::<your-bucket-name>/*" ] }, { "Sid": "AllowUseOfKMSKey", "Effect": "Allow", "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": [ "arn:aws:kms:<region>:<account-id>:key/<key-id>", ] } ] }
From the IAM user management console, generate a new access key for the user. You will need the access key ID and secret access key to configure the backup and restore procedures in NetEye.
How to configure the NetEye backup and restore and take scheduled backups¶
The configuration of the backup and restore procedures is done via YAML files in the /etc/neteye-backup.d directory.
The basic and common configuration can be found in the /etc/neteye-backup.d/common.yaml file.
It is so possible to configure various aspects of the backup and restore procedures, such as:
Which items to include in the backup (configurations, data and logs)
The schedule for automatic backups.
Note
Please note that for backup schedules simple ranges (e.g., “0-1”) are supported while step values (e.g., “/5”) are **NOT* supported.
The remote storage provider settings (e.g., S3 bucket details, access keys, encryption settings)
The backup node in a cluster setup, which defaults to the first node specified in the cluster configuration file (
/etc/neteye-cluster). This node is responsible to perform the scheduled backups and collect the data from the other nodes in the cluster.
Besides the common configuration file, a specific configuration file for each supported service is present in the
corresponding feature module directory, e.g., /etc/neteye-backup.d/elastic-stack/elasticsearch.yaml.
In the specific configuration file it is possible to overide some of the common settings, such as which items to include in the backup for that specific service and also specify service-specific settings, such as the Elasticsearch indices to include in the backup.
After the configuration files have been set up, you can apply the configuration using the following command, that can be run on one of the cluster nodes:
neteye backup config apply
This command will validate the configuration files and apply the settings to the backup and restore procedures, scheduling also the automatic backups as specified on the backup node.
How to take a manual backup¶
Sometimes, you may want to take a manual backup outside the scheduled automatic backups. To do so, you can use the following command, on a node of your installation, to take a manual backup:
neteye backup run
Furthermore, in case you would like to take a manual backup of a specific service only, you can use the --restrict-services-to option, as shown in the example below:
neteye backup run --restrict-services-to core
How to restore a backup¶
Warning
Restoring a backup will overwrite the current configuration and data of the selected services with those from the MOST RECENT backup available in the remote storage.
Warning
The restore operation is primarily intended to recover from failures or data loss on the system from which a backup was taken.
It is possible to restore a backup on a different system, if the following conditions are met:
The NetEye version on the target system is the same as the one on the source system from which the backup was taken.
The target system has already performed the initial configuration using the neteye install command.
The number of nodes in the cluster (if applicable) is the same on both systems and the hostnames of the nodes match those in the backup.
The target system has network connectivity to the remote storage where the backup is stored.
The target system has sufficient resources (disk space, memory, etc.) to accommodate the restored data.
Furthermore, depending on the specific services being restored, additional considerations may apply, especially regarding network configurations.
To restore a backup, the first step is to ensure the backup configuration that will allow the connection to the remote storage where the backups are correctly configured.
This can be done either by manually editing the configuration files in the /etc/neteye-backup.d directory,
in particular the /etc/neteye-backup.d/common.yaml file, or by restoring manually the backup configuration files from a previous backup.
By default, the backup configuration files are stored in the tar.gz archive that can be found in the core/conf folder inside the remote storage.
After that, the restore operation can be initiated, on a node of your installation, using the following command:
neteye backup restore
As mentioned also above, this command will restore the most recent backup available in the remote storage.
Also in this case, it is possible to restore a specific service only by using the --restrict-services-to option, as shown in the example below:
neteye backup restore --restrict-services-to core