1. Home
  2. Docs
  3. Backup Ninja
  4. User Guide
  5. Servers
  6. Adding a New Server

Adding a New Server

Backup Ninja supports either Database & Files Backups or Only Files Backups (beta). These options are mutually exclusive. So you can either select one at a time between the two.

To add a database server into Backup Ninja, go to Servers →  Add Server and you will be presented with a step-by-step configuration wizard.

Adding Server As A Database & Files Backups

1) Select Database

Click on the supported database software that the database server is running on. If you are not sure about the database’s version and its vendor, you can retrieve the information by using the following commands:

  • MySQL/Percona/MariaDB
mysql> SHOW VARIABLES LIKE 'version%';
+-------------------------+------------------------------------------------------+
| Variable_name           | Value                                                |
+-------------------------+------------------------------------------------------+
| version                 | 5.6.45-86.1                                          |
| version_comment         | Percona Server (GPL), Release 86.1, Revision 5bc37b1 |
| version_compile_machine | x86_64                                               |
| version_compile_os      | Linux                                                |
| version_suffix          |                                                      |
+-------------------------+------------------------------------------------------+
  • PostgreSQL/TimeScaleDB
postgres=> SELECT version();
version
-------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.1 (Debian 11.1-3.pgdg80+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10+deb8u2) 4.9.2, 64-bit
(1 row)
  • MongoDB
$ mongod --version
Mongodb version 4.2
Attention
Note that finding out the correct database vendor is important since Backup Ninja will perform all the assigned jobs by following the best-practice provided by the database vendor.

Note

For Oracle and Percona MySQL-based versions, there are additional two options to choose from when selecting the vendor: pre 8.0 (<8.0) or 8.0 and later (8.0+).

Click on the respective database vendor and version and click Continue to proceed to the next step.

2) Create Database User

Backup Ninja can perform backup operations and as well as restore operations on the same server where the backup was taken.

In this stage, you will get a set of commands that need to be executed on the chosen database server to allow the Backup Ninja agent to access the database server and perform backup-restore related operations. If you would like to customize the database username, specify the name under Username textbox. Otherwise, Backup Ninja will use the default username, “s9s“. The database username must be 3 characters and more and the character limit is depending on the database server:

Database Maximum characters
MySQL/Percona <5.7 16
MySQL/Percona 5.7+ 32
MariaDB 80
PostgreSQL 63

By default, Backup Ninja will generate a fairly strong random password. However, this might not satisfy the password policy of the target server. You may specify a custom password in the Password  textbox with a maximum of 32 characters.

Attention

The provided commands must be executed by a database user that has the ability to create user, role, and grant privileges e.g, root user.

For MySQL, Percona, and MariaDB database servers, you can optionally create a user with a very privileged grant:

GRANT ALL ON *.* TO 's9s'@'127.0.0.1';

which is required for the Backups and Restore option. Alternatively, you can set lightweight privileges but you need to choose Backups Only option. The Backups Only  option will set the following privileges:

SUPER, RELOAD, PROCESS, SELECT, LOCK TABLES, SHOW VIEW, EVENT, TRIGGER, REPLICATION CLIENT

Even you have chosen lightweight privileges but later on, you wanted to support a restore capability using Backup Ninja, then you need to modify your database user privileges so you can automatically restore the backup based on the backup method you are using. Please refer to Restore page to learn more on how to restore a backup.

For the PostgreSQL server, the database user must be allowed in PostgreSQL’s pg_hba.conf file to connect via localhost and 127.0.0.1:

host all {username} 127.0.0.1/32 md5
host all {username} localhost md5

Reload PostgreSQL to apply the changes:

postgres=> SELECT pg_reload_conf();

The required user privileges and roles for Backup Ninja usage are described in the next sections.

MySQL 8.0+ User Privileges

For MySQL 8.0 and later, the following privileges are required on all databases and tables:

  • RELOAD to perform global flush operations.
  • LOCK TABLES to lock tables that have SELECT the privilege.
  • REPLICATION CLIENT to retrieve the binary log position, which stored in the backup.
  • EVENT to retrieve Event Scheduler information.
  • CREATE TABLESPACE to create tablespaces when restoring a physical backup.
  • PROCESS to see all database processes while taking the backup.
  • CREATE to create new databases and tables.
  • INSERT to insert data into tables in a database or to run table-maintenance statements.
  • SELECT to read column values, columns referenced in UPDATE or columns named in WHERE of DELETE or UPDATE.
  • SUPER to optimize locking and minimize disruption to database processing.
  • SHOW VIEW to retrieve View information via SHOW CREATE VIEW.
  • BACKUP_ADMIN to be able to use LOCK INSTANCE FOR BACKUP statement and access to the Performance Schema log_status table.

MySQL <8.0 and MariaDB User Privileges

For MySQL pre 8.0 and MariaDB, the following privileges are required on all databases and tables:

  • RELOAD to perform global flush operations.
  • LOCK TABLES to lock tables that have SELECT the privilege.
  • REPLICATION CLIENT to retrieve the binary log position, which stored in the backup.
  • EVENT to retrieve Event Scheduler information.
  • CREATE TABLESPACE to create tablespaces when restoring a physical backup.
  • PROCESS to see all database processes while taking the backup.
  • CREATE to create new databases or tables when restoring a backup.
  • INSERT to insert rows when restoring a backup.
  • SELECT to select rows from tables in a database.
  • SUPER to optimize locking and minimize disruption to database processing.
  • SHOW VIEW to retrieve View information via SHOW CREATE VIEW.

PostgreSQL and TimescaleDB User Privileges

For a PostgreSQL-based database server, the following privileges and roles are required:

  • SELECT ON ALL TABLES
  • SELECT ON ALL SEQUENCES
  • SUPERUSER ROLE

MongoDB User Privileges

For MongoDB-based database server, the following role and privileges are required:

  • Roles:
roles: ["backup", "restore", "s9sBackupRole"]
  • Privileges:
privileges: [{
  resources: { anyResource: true },
  actions: ["anyAction"]
}]

3) Installation

In this stage, you will be provided with a one-liner command to perform the agent installation. Copy the generated command line and execute it on the target database server. You can customize some installation parameters depending on the selected database server:

Database Options Description
MySQL/MariaDB MySQL Port The default value is 3306. Specify the port number to which the database server is listening to.
MySQL Socket Default value is /var/lib/mysql/mysql.sock. Specify the path to the MySQL UNIX socket file of the database server. You can get the socket path by using  SELECT @@socket;
MongoDB MongoDB Port The default value is 27017. Specify the port number to which the database server is listening to.
PostgreSQL/TimescaleDB PostgreSQL Port The default value is 5432. Specify the port number to which the database server is listening to.

In some environments, you might need to run the above command as a non-root user. Click on the sudo user button and use the generated command instead.

The installation command follows the following format:

wget -q -O - {script-url} | \
  bash -s -- install \
  {security-token} \
  {database-connection-string}

Where:

  • {script-url} – The installer script URL.
  • {security-token} – Auto-generated security token for agent authentication.
  • {database-connection-string} – Database connection string that will be used by the agent to connect to the database node to perform a backup. The format is:
    {db-type}://{db-user}:{db-password}@{db-host}:{db-port}
Attention

Internet connection is required on the database node for this installation to succeed.

If you would like to see what the installation does, click on Check installation script source.

For example, the following one-liner command is generated for a MongoDB installation:

wget -q -O - https://agents-api.s9s.io/static/install/linux.sh | bash -s -- install xxxxxxx-2f76-bbbbb-bbbb-aaaaaaaaaaa mongodb://s9s:[email protected]:27017

Simply copy the above line and paste it into the target MongoDB server that you want to back up. A Backup Ninja agent called “bartender” will be installed, configured, and started on the corresponding host. If the installation is successful, you should see the following lines:

The agent installation of Backup Ninja has been successfully completed.
Please go back to your browser and check the Server Discovery step to verify that this host has appeared which might take a few seconds.
If you have any issues getting the agent to install and be discovered then please contact support at https://support.severalnines.com for assistance.

Click on Continue to proceed to the last step.

4) Host/Server Discovery

Here you will see the host discovery status whereby the Backup Ninja agent will report its status back to the API gateway endpoints. It will display the host or server you have just set up or added as the target source for backup. This means that it will show up only once the script for the installation of the agent is done successfully. Otherwise, it will always just keep in progress until the server is successfully added (Backup Ninja agent is successfully installed). After a while, the database node should appear in the list. Click on Finish Installation to complete the steps.

Adding a new server is now complete.

Note

The discovery process usually takes seconds and less than a minute. If you get into trouble at this phase, see Troubleshooting.

Adding Server As A Only Files Backups

Note

When adding a server and choose as file backup, you can configure this server database connection later to enable database backups.

1) Agent Installation

Adding a server for file backup is a straightforward process. Once you select Only Files Backups, click the button Continue will proceed to the installation of the bartender agent. Just follow the instructions and execute the command either as a sudoer user or as a root system user into the target server where you want to add as a file backup server.

2) Host/Server Discovery

Same as the host/server discovery for your Database & Files Backups server, all you have to do is to wait once the agent installation is done from the target server you wish to add. Once done and successfully installed, you will see the host discovery status whereby the Backup Ninja agent will report its status back to the API gateway endpoints. It will display the host or server you have just set up or added as the target source for backup. This means that it will show up only once the script for the installation of the agent is done successfully. Otherwise, it will always just keep in progress until the server is successfully added (Backup Ninja agent is successfully installed). After a while, the database node should appear in the list. Click on Finish Installation to complete the steps.

Adding a new server is now complete.

See also

The discovery process usually takes seconds and less than a minute. If you get into trouble at this phase, see Troubleshooting.

Was this article helpful to you? Yes No