Databases#

General information#

K2 Cloud databases are automated services which help you to quickly and easily create, configure, and manage popular DBMSs, using cloud platform tools. We currently support MongoDB, MySQL, PostgreSQL, and Redis.

MySQL is the most popular open-source relational DBMS. To learn more about MySQL DBMS capabilities, read the documentation.

PostgreSQL is a Postgres-based object-relational DBMS. It supports most of the SQL standard and offers many advanced features. To learn more about its capabilities, read the PostgreSQL documentation.

Redis is an open-source resident DBMS. It handles key-value data structures and can be used as a database, cache, message broker, or queue. To learn more about Redis capabilities, visit the official website.

MongoDB is a universal NoSQL database that stores data of any structure and supports indexing, sharding, and replication. To learn more about MongoDB features, see the MongoDB official website.

Billing#

The PaaS database services MongoDB, MySQL, PostgreSQL and Redis are free of charge. Payment is charged for actually consumed billable resources: instances, volumes, Elastic IP addresses, and other resources.

Databases in K2 Cloud#

Using K2 Cloud automated databases is a powerful alternative to installing and configuring databases manually. The database service can be deployed on a single instance or multiple instances (3- or 6-node cluster).

The cluster service option ensures high availability for critical workloads by placing nodes in multiple availability zones. If any of these nodes fails, the cluster will continue to run on the remaining nodes. This prevents data loss, and there is no interruption in service, or it is reduced to a minimum delay required for failover.

In the Databases service web interface, you can perform the following actions:

What is the Database service good for?

  • For quick creation of a ready-to-work database.

  • For simplifying database provisioning and maintenance.

  • For accelerating time-to-market.

Cluster with an arbitrator#

In K2 Cloud, you can launch a high-availability service in a multi-node cluster (3 or 6 depending on the service). This solves the split brain problem.

If you use a database cluster and connectivity between nodes is lost, the cluster gets partitioned. Each part of the cluster decides whether to continue processing data or stop. If each part of the cluster considers itself the only survivor and continues running and changing data, then there is the split-brain problem that can cause data corruption. To avoid this, clusters use a quorum rule stating that only one part of the cluster (the one with a larger number of nodes) continues operating. This is only possible if the total number of nodes in the cluster is odd.

However, running three full-fledged nodes is redundant in terms of resources involved. Therefore, a cluster with two full-featured nodes and an arbitrator is more cost-effective, since the arbitrator neither stores nor processes data and uses minimum resources to maintain a cluster forum.

Before you begin#

We advise to preliminarily read the recommendations on how to work with the service in the cloud.

Required privileges#

To be able to work with the database service, a user needs to have PaaSFullAccess project grants. For instance, such grants are available to administrators in the CloudAdministrators group. If necessary, you can create a separate user, add the user to the project, and either attach the PaaSFullAccess policy to the user or add the user to the group of cloud administrators in this project.

Note

If database backup is required, then the PaaSBackupPolicy policy should be attached to the user (see to learn more about IAM policies).

The PaaSFullAccess project grants provide the user with permissions to all PaaS services. To provide permissions to the database service only, create a policy with the following grants:

  • paas:CreateDatabase;

  • paas:CreateUser;

  • paas:ListUsers;

  • paas:ListDatabases;

  • paas:ModifyUser;

  • paas:ModifyDatabase;

  • paas:DescribeService;

  • paas:ListServices;

  • paas:ListBackupUsers;

and assign it to the user.

To allow a user only to work with database backups, but not delete them, create a policy with the following grants:

  • paas:DescribeBackup;

  • paas:ListBackupUsers;

  • paas:ListBackups;

  • paas:ModifyBackup;

  • paas:DescribeService;

  • paas:ListServices;

  • paas:ModifyService;

and assign it to the user.

For details, see the IAM documentation on how to create a policy and assign it to the user.

Required resources#

There should be the following resources in the project:

Creating database service#

The database service creation process can be divided into two parts:

  • infrastructure creation;

  • software installation and configuration.

Currently, the infrastructure creation consists of launching the required number of instances with the specified configuration from a given image and setting up security groups so that the databases can connect to each other.

After the successful launch of the instances, software installation inside VMs begins. Upon the successful installation, the database service enters the running status. Any other status means that the creation process is not completed. The database service in the running status is ready for operation.

Important

The database service can be launched only in those subnets that have Internet access. To configure such access, you might need to attach an internet gateway to a VPC and create a default route in a route table.

Note

Creating a high-availability service also automatically creates placement groups for every three nodes. For example, in case of a five-node cluster in one availability zone, two placement groups are created, containing three and two nodes, respectively. Should it be a five-node cluster across three availability zones, one placement group is created in each zone, with two groups containing two nodes each, and one group containing only one node. Instances from the same group are deployed on different physical servers, which improves the service availability.

To configure the service, select the DBMS in the Service store or Running services subsection, click Create and follow the steps below:

  1. Set the required network parameters:

    Note

    To run the service in the selected VPC, you must first create a subnet in the preferred availability zone (in a configuration with one zone), or one subnet in each availability zone (in a configuration with three zones). In addition, the same volume types must be supported in the availability zones used.

    Note

    The ability to attach network interfaces may be useful, for example, when you need to recreate a database service. If you delete the service, do not delete attached network interfaces, you will be able to reuse them for connecting nodes of the new cluster to subnets, where the new cluster will be deployed. Thus, you can keep previous network settings, such as private IP addresses and security groups, rather than configure them again.

    • To configure a cluster, where the service will be deployed, you can select the following number of nodes:

      • one master node (the service without high availability);

      • two master nodes and one arbitrator node;

      • three master nodes.

    • VPC where the database service will be deployed.

    • Security groups to control traffic through interfaces of the instances on which the database service will run.

    • Subnets to which instances with the running service will be attached, or network interfaces through which cluster nodes will be attached to subnets.

      Note

      When selecting subnets, you may specify either one or three subnets in different availability zones. In the former case, the service will be deployed in the same availability zone as the selected subnet.

      When selecting network interfaces for a multi-node configuration, you must specify one interface per availability zone.

    • Internal and/or internet-facing load balancers (for details, see Load balancer management).

      In the DNS name field, you can specify an arbitrary subdomain name in the paas.<region>.web.c2.croc.ru DNS service zone for an Internet-facing load balancer and in the paas.<vpc-id>.internal zone for an internal load balancer. The name may contain Latin letters, digits, and hyphens.

      If the DNS name field is left blank, the name will be specified automatically.

    Important

    It is not recommended to create a four-node cluster as otherwise any connectivity loss may lead to quorum loss due to split brain.

    • To configure a cluster, where the service will be deployed, you can select the following number of nodes:

      • one master node (the service without high availability);

      • two master nodes and one arbitrator node;

      • three to six master nodes 1.

      1

      We recommend selecting this configuration if the cluster scalability may be required in the future.

    • VPC where the database service will be deployed.

    • Security groups to control traffic through interfaces of the instances on which the database service will run.

    • Subnets to which instances with the running service will be attached, or network interfaces through which cluster nodes will be attached to subnets.

      Note

      When selecting subnets, you may specify either one or three subnets in different availability zones. In the former case, the service will be deployed in the same availability zone as the selected subnet.

      When selecting network interfaces for a multi-node configuration, you must specify as many interfaces as there are nodes in the cluster.

      Network interfaces should be evenly distributed across all availability zones where the service will be deployed, if possible. For example, if you plan to create a cluster with five master nodes across three availability zones, you should specify two interfaces in each of two availability zones and one interface in the remaining zone.

    • Internal and/or internet-facing load balancers (for details, see Load balancer management).

      In the DNS name field, you can specify an arbitrary subdomain name in the paas.<region>.web.c2.croc.ru DNS service zone for an Internet-facing load balancer and in the paas.<vpc-id>.internal zone for an internal load balancer. The name may contain Latin letters, digits, and hyphens.

      If the DNS name field is left blank, the name will be specified automatically.

    • To configure a cluster, where the service will be deployed, you can select the following number of nodes:

      • one master node (the service without high availability);

      • three master nodes;

      • six master nodes.

    • VPC where the database service will be deployed.

    • Security groups to control traffic through interfaces of the instances on which the database service will run.

    • Subnets to which instances with the running service will be attached, or network interfaces through which cluster nodes will be attached to subnets.

      Note

      When selecting subnets, you may specify either one or three subnets in different availability zones. In the former case, the service will be deployed in the same availability zone as the selected subnet.

      When selecting network interfaces for a multi-node configuration, you must specify as many interfaces as there are nodes in the cluster.

      Network interfaces should be evenly distributed across all availability zones where the service will be deployed.

    • Internal and/or internet-facing load balancers (for details, see Load balancer management).

      In the DNS name field, you can specify an arbitrary subdomain name in the paas.<region>.web.c2.croc.ru DNS service zone for an Internet-facing load balancer and in the paas.<vpc-id>.internal zone for an internal load balancer. The name may contain Latin letters, digits, and hyphens.

      If the DNS name field is left blank, the name will be specified automatically.

    Important

    It is not recommended to create a four-node cluster as otherwise any connectivity loss may lead to quorum loss due to split brain.

    • To configure a cluster, where the service will be deployed, you can select the following number of nodes:

      • one master node (the service without high availability);

      • two master nodes and one arbitrator node;

      • three to six master nodes. 2

      2

      We recommend selecting this configuration if the cluster scalability may be required in the future.

    • VPC where the database service will be deployed.

    • Security groups to control traffic through interfaces of the instances on which the database service will run.

    • Subnets to which instances with the running service will be attached, or network interfaces through which cluster nodes will be attached to subnets.

      Note

      When selecting subnets, you may specify either one or three subnets in different availability zones. In the former case, the service will be deployed in the same availability zone as the selected subnet.

      When selecting network interfaces for a multi-node configuration, you must specify as many interfaces as there are nodes in the cluster.

      Network interfaces should be evenly distributed across all availability zones where the service will be deployed, if possible. For example, if you plan to create a cluster with five master nodes across three availability zones, you should specify two interfaces in each of two availability zones and one interface in the remaining zone.

    Click Next to proceed to the next step.

  2. If a cluster configuration with three to six master nodes was selected for PostgreSQL or MongoDB in the previous step, you can set the number of master nodes in the cluster. However, if network interfaces were specified, the number of instances is fixed and equal to the number of selected network interfaces.

    В блоке Мастер-узел задайте конфигурацию экземпляров, которые будут использоваться в качестве мастер-узлов. Выберите тип экземпляра и характеристики диска для данных: тип, размер и IOPS (если это доступно для данного типа).

    Note

    Database performance depends on the selection of node components. We recommend using high performance volumes gp2: Universal (SSD) or io2: Maximum (SSD).

    Если для сервиса MySQL, PostgreSQL или MongoDB была выбрана конфигурация с кластерным арбитром, то в блоке Арбитр задайте конфигурацию экземпляра, который будет использоваться в качестве арбитра. Выберите тип экземпляра.

    Click Next to proceed to the next step.

  3. Set the main parameters of the service (the specific set of options depends on the selected service).

    • Name tag — Optional arbitrary description of the service.

    • Service name — An arbitrary unique name of the database service.

    • Vendor — MySQL DBMS engine. Valid values: mariadb, percona, mysql.

    • Version — The DBMS engine version. Depending on the engine vendor, the following versions are supported:

      Vendor

      Version

      mariadb

      10.4
      10.5
      10.6
      10.11

      percona

      5.7
      8.0

      mysql

      8.0

    • Enable monitoring – For centralized monitoring of a database service, first deploy the Prometheus-based monitoring service.

      • Monitoring service – The selection of a monitoring service is only available when the Enable monitoring checkbox is checked.

      • Monitoring labels — Optionally, you can set monitoring labels, which the installed monitoring agents will assign to the collected metrics (for details, see Using labels). Labels can only be set when the Enable monitoring checkbox is selected.

    • Enable logging – For centralized PaaS service logging, first create a logging service. Once a PaaS service is created, you will be able to install logging agents manually only.

      • Logging service – The selection of a logging service is only available when the Enable logging checkbox is checked.

      • Logging tags – Tags are assigned to logs when the latter are imported by the logging service. They simplify search for the required logs. Tags can only be set when the Enable logging checkbox is selected.

    • Name tag — Optional arbitrary description of the service.

    • Service name — An arbitrary unique name of the database service.

    • Вендор — Вендор подсистемы хранения СУБД PostgreSQL. Возможные значения: pgsql, pgsql1c.

    • Version — The DBMS engine version. Depending on the engine vendor, the following versions are supported:

      Vendor

      Version

      pgsql

      14
      15
      16
      17
      18

      pgsql1c

      16
      17

    • Replication option — The replication mode in the Patroni cluster. Available only when the High-availability service option is selected.

      Valid values: asynchronous, synchronous, synchronous_strict.

    • Enable monitoring – For centralized monitoring of a database service, first deploy the Prometheus-based monitoring service.

      • Monitoring service – The selection of a monitoring service is only available when the Enable monitoring checkbox is checked.

      • Monitoring labels — Optionally, you can set monitoring labels, which the installed monitoring agents will assign to the collected metrics (for details, see Using labels). Labels can only be set when the Enable monitoring checkbox is selected.

    • Enable logging – For centralized PaaS service logging, first create a logging service. Once a PaaS service is created, you will be able to install logging agents manually only.

      • Logging service – The selection of a logging service is only available when the Enable logging checkbox is checked.

      • Logging tags – Tags are assigned to logs when the latter are imported by the logging service. They simplify search for the required logs. Tags can only be set when the Enable logging checkbox is selected.

    • Name tag — Optional arbitrary description of the service.

    • Service name — An arbitrary unique name of the database service.

    • Версия — Поддерживаются следующие версии СУБД: 7.0, 7.2, 8.0, 8.2, 8.4.

    • Clustering option. Valid values: native, sentinel. Available only when a three node cluster configuration is selected. For a six node cluster configuration, only the native option is supported.

    • RDB Persistence — The RDB storage mode.

    • AOF Persistence — The AOF storage mode.

    • Enable monitoring – For centralized monitoring of a database service, first deploy the Prometheus-based monitoring service.

      • Monitoring service – The selection of a monitoring service is only available when the Enable monitoring checkbox is checked.

      • Monitoring labels — Optionally, you can set monitoring labels, which the installed monitoring agents will assign to the collected metrics (for details, see Using labels). Labels can only be set when the Enable monitoring checkbox is selected.

    • Enable logging – For centralized PaaS service logging, first create a logging service. Once a PaaS service is created, you will be able to install logging agents manually only.

      • Logging service – The selection of a logging service is only available when the Enable logging checkbox is checked.

      • Logging tags – Tags are assigned to logs when the latter are imported by the logging service. They simplify search for the required logs. Tags can only be set when the Enable logging checkbox is selected.

    • Password — User password 8 - 128 characters long. It can be set manually or generated automatically.

    • Name tag — Optional arbitrary description of the service.

    • Service name — An arbitrary unique name of the database service.

    • Версия — Актуальный список поддерживаемых версий доступен в веб-интерфейсе.

    • Enable monitoring – For centralized monitoring of a database service, first deploy the Prometheus-based monitoring service.

      • Monitoring service – The selection of a monitoring service is only available when the Enable monitoring checkbox is checked.

      • Monitoring labels — Optionally, you can set monitoring labels, which the installed monitoring agents will assign to the collected metrics (for details, see Using labels). Labels can only be set when the Enable monitoring checkbox is selected.

    • Enable logging – For centralized PaaS service logging, first create a logging service. Once a PaaS service is created, you will be able to install logging agents manually only.

      • Logging service – The selection of a logging service is only available when the Enable logging checkbox is checked.

      • Logging tags – Tags are assigned to logs when the latter are imported by the logging service. They simplify search for the required logs. Tags can only be set when the Enable logging checkbox is selected.

    Click Next to proceed to the next step.

  4. Configure backup.

    Note

    Данный шаг доступен для баз данных MongoDB, MySQL и PostgreSQL.

    When you select Enable backup, the following settings are available:

    • Bucket where the recovery points will be stored.

    • User with PaaSBackupUser privileges; backups will be written to the bucket under this user.

    • Daily backup start time.

    • Backup retention period.

    • Email (optional) – the email address to which notifications will be sent if the backup fails. If not specified, notifications will be sent to the email address of the user you have selected above.

    Click Next to proceed to the next step.

  5. Set the maintenance window (see подробнее). If scheduled maintenance can be performed at any time, leave the Maintenance window option set to Custom. If there are time restrictions when maintenance can be performed, select the interval that is convenient for you. To do so, specify the following parameters:

    • the Scheduled value for the Maintenance window option;

    • a day of the week for the maintenance to take place;

    • hour interval for the maintenance window.

    To set additional parameters or tags for the service, click the respective button to move to the required step — Additional parameters or Add tags. If neither need to be set, click Create to launch the service.

  6. Specify additional parameters, that will become part of the DBMS configuration (optional). The supported parameters depend on the type of database service you launch. You can read more about supported parameters in the recommendations for a particular database.

    You can also specify advanced settings of your choice at this step. To do this, click advanced settings and specify the desired settings and their values.

    Important

    The specified parameters and settings will be part of the DBMS configuration and, therefore, will affect its operation. Add only the parameters you really need.

    To set tags for the service, click Add tags to go to the next step. If no tags are required, click Create to launch the service.

  7. To add a tag, click Add tag and enter tag key and value.

    Note

    If no tags have been set yet, you can add the Name tag by clicking Add Name tag and specifying its value.

    When done, click Create to launch the service.

Important

The database service creation process usually takes 5 to 15 minutes. Single-node installations are deployed faster than multi-node ones.

To ensure the correct operation of a database service, a new security group is automatically created together with the cluster. It includes the following rules:

  • the rule to permit inbound traffic from interfaces that are in the same security group;

  • the rule to enable all outbound IPv4 traffic.

If the database service is deleted, the security group will also be deleted.

Modifying service node options#

Add nodes for the service#

If the cluster configuration three to six master nodes was selected at the PostgreSQL or MongoDB service creation and the cluster has fewer than six nodes, you can scale it out by adding extra nodes. Scaling is only possible when the service is in the Running state.

Important

For the databases service created before 30.01.2026, cluster scaling is not supported.

  1. Go to PaaS Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Information tab and click Add instances.

  4. In the window that opens, specify the number of instances to be added. If network interfaces were specified at the service creation, you can either create interfaces automatically by pushing Create automatically or specifying the existing ones by pushing Select manually and selecting the interfaces in the specified availability zones.

  5. Click Add to complete the operation.

Modify the instance type for the node#

You can modify the instance type for cluster nodes running the databases service. You can do it only when the service is in the Ready state.

Important

Instance type cannot be modified for nodes with the arbitrator role.

To modify the instance type:

  1. Go to PaaS Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. In the Information tab, edit the Instance type field in the configuration section of master node. To do this, click the edit icon and selecting the instance type.

  4. Click to save changes.

Modify data volume parameters#

You can only change the data volume parameters when the service is in the Ready state.

You can configure the data volume size and its performance in IOPS right from the cloud web interface.

Important

You can change IOPS only for a data volume of the type io2.

To change the volume parameters, follow these steps:

  1. Go to PaaS Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. In the Information tab, edit the required fields (Data volume size and/or Data volume IOPS) by clicking the edit icon .

    Important

    The new data volume size must exceed the current one.

  4. Click to save changes.

User and database management#

You can create and delete databases and users, as well as edit some of their settings, directly from the cloud web interface.

Создание и удаление пользователей и баз данных возможно для сервисов в состоянии Запущен или Обновление. Данные операции доступны для баз данных MongoDB, MySQL и PostgreSQL.

Create user#

To create a new user:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Users tab and click Create.

  4. Set the required parameters:

    • Name — User name. It should start with a Latin letter, should not exceed 32 characters, can consist of numbers, Latin letters, and underscore _. You cannot use reserved names, such as root, mysql, monitoring, mariadb.sys, clustercheck.

    • Host – name of the host from which the user is allowed to connect to the database. For MySQL, you can also specify the IP address of the host from which the user is allowed to connect to the database. If this field is left blank, the user will be allowed to connect from any IP address and the default value (%) will be set as the host.

    • Password – User password.

    • Name — User name. It should start with a Latin letter, should not exceed 31 characters, can consist of numbers, Latin letters, and underscore _. You cannot use reserved names, such as os_admin, postgres, root, replicator.

    • Password – User password.

    • Name — User name. It should start with a Latin letter, should not exceed 63 characters, can consist of numbers, Latin letters, and underscore _. You cannot use reserved names, such as admin, root.

    • Password – User password.

  5. Click Create.

Create a database#

To create a new database:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Databases tab and click Create.

  4. Specify a database name and other parameters. The exact set of parameters depends on the selected database service.

    • Name — Database name. It should start with a Latin letter, should not exceed 64 characters, can consist of numbers, Latin letters, and $ and _ characters. You cannot use reserved names, such as information_schema, mysql, performance_schema.

    • Charset – database encoding.

    • Collation — Database collation parameters or collation parameter normalization operation.

    • Enable backup — Enables daily backup. Backups will only be created if this option is enabled for the service.

    • Name — Database name. It should start with a Latin letter, should not exceed 31 characters, can consist of numbers, Latin letters, and underscore _. You cannot use reserved names, such as postgres, template0, template1.

    • Owner — The database owner. This must be one of existing users added at the create user step. This user cannot be deleted as long as it remains the database owner.

    • Locale — The database locale.

    • Encoding — The database encoding.

    • Extensions — The extensions to be installed for the database.

    • Enable backup — Enables daily backup. Backups will only be created if this option is enabled for the service.

    • Name — Database name. It should start with a Latin letter, should not exceed 63 characters, can consist of numbers, Latin letters, and underscore _. You cannot use the reserved name admin.

    • Enable backup — Enables daily backup. Backups will only be created if this option is enabled for the service.

    • (Только при восстановлении базы данных) Имя исходной базы данных — Имя базы данных, из которой была сделана резервная копия.

      Important

      Параметр Имя исходной базы данных необходимо указывать, только когда для восстанавливаемой базы данных указано другое имя.

  5. You can grant users access to a database right away or later. To add users later and create a database right away, click Create. To add users, click Edit Users to go to the next step.

  6. Click Add User and select the previously created user from the list. For MySQL database, you can also assign the necessary rights to the user. For PostgreSQL, you cannot add the database owner as a user.

    • Privileges — The user privileges in the database.

    • Options — Operations that the user can perform on the database.

    To add other users, click Add User.

  7. Click Create.

Change user password#

To change a user’s password after creating it, follow these steps:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Users tab, select the user whose password you want to change, and click Change.

  4. In the window that opens, set or generate a new password.

  5. Click Save.

Change database settings#

Once database has been created, you can modify some of its settings and create/delete users. To do this:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Databases tab, find the database whose settings you want to change, and click Change.

  4. Specify new parameters for the database.

    Note

    Once a database has been created, its name and language settings cannot be modified. Which parameters you can change depend on the selected database service (MySQL or PostgreSQL).

  5. To allow or deny user access to the database, go to the next step by clicking Edit Users. If no user has been previously granted access to the database, click Add User.

    Note

    For PostgreSQL, you cannot add the database owner as a user.

    • To replace one user with another, select the user from the list.

    • To deny user access to the database, click the icon next to the user name.

    • To grant access to the database to additional users, click Add User.

    For MySQL and MongoDB users, you can also change their access rights.

  6. Click Save.

The database service switches to the Updating state. Users can continue working with the database as long as the changes do not affect their database access privileges.

Delete user#

To delete a user:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Users tab and select the user you want to delete.

  4. Click Delete.

  5. In the window that opens, confirm the deletion.

Note

The user will also be removed from all databases to which he/she was granted access.

Delete database#

To delete a database:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Databases tab and select the database you want to delete.

  4. Click Delete.

  5. In the window that opens, confirm the deletion.

Database backup and recovery#

Scheduled backups can be enabled for a database service so that full backups of the specified databases are created daily at the specified time. If necessary, you can quickly restore the desired database as of a specific date from the saved backup.

Note

Резервное копирование доступно для сервисов баз данных PostgreSQL, MySQL и MongoDB. В дальнейшем мы планируем реализовать его и для других сервисов баз данных.

To enable backup, configure the schedule for the database service and enable the appropriate option for each database you want to backup. Backups are only created for running services and are written to the object storage.

To free up space from no-longer-needed backups, we recommend limiting their retention period or regularly deleting them. Certain backups can be protected from automatic deletion.

Along with the backup, a log is created to store information about the backup utility operation. If the backup has failed, you can use the log to find out why. We recommend checking the log for warnings on successful backups also to make sure that there were no problems during the backup process.

Attention

To avoid backup problems caused by lack of space for temporary files, we recommend that you leave 20 MB of free space in the root partitions on cluster instance volumes.

Information about database services for which backups are available can be found in the Service backups subsection of the PaaS section.

Note

Before configuring backup, make sure that the project has both a bucket for storing backups and a user with PaaSBackupPolicy privileges. This is a special user, and only this policy should be assigned to him/her.

Setup service backup#

Backup can be enabled when you create a database service. If you have not done this and want to enable it, or if you need to change the settings for an already enabled backup, then:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. In the Information tab, click Backup settings.

  4. If backup has not been enabled, check the Enable backup checkbox.

  5. Set or change backup settings:

    • Bucket where the recovery points will be stored.

    • User with PaaSBackupPolicy privileges; backups will be written to the bucket under this user.

    • Daily backup start time.

    • Backup retention period.

    • Email (optional) – the email address to which notifications will be sent if the backup fails. If not specified, notifications will be sent to the email address of the user you have selected above.

  6. To confirm, click Change.

Note

To back up specific databases, enable the respective option for each of them.

Enable database backup#

Note

Database backups will only be created if backup for the database service is enabled.

If you want to enable backup for a specific database:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Databases tab and select the database in the resource table.

  4. Click Edit.

  5. Check the Enable backup checkbox, while leaving all other parameters unchanged.

  6. Click Save.

Recover a database from a backup#

Important

To avoid problems when recovering the database, we recommend that you recover it to a service with the same DBMS version as that used to create the database.

To recover a database:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Databases tab and click Create from backup.

  4. In the database creation wizard that opens, select the required backup from the list. To simplify the search, you can select the service from which originates the database, whose backup you are looking for. Click Select to go to the next step.

  5. Select the database you want to restore. Click Select to proceed to the next step.

  6. Specify the database parameters and, if necessary, add users. These steps are the same as the steps 4-6 when creating a database and are described in more detail in database creation instructions.

    Attention

    If parameters other than default ones were specified when creating the database, such as PostgreSQL locale, we recommend that you enter the same parameters for the correct recovery.

Disable backup#

To disable backup for a specific database:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Databases tab and select the database in the resource table.

  4. Click Edit.

  5. Uncheck the Enable backup checkbox, while leaving all other parameters unchanged.

  6. Click Save.

To disable backup for all databases:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. In the Information tab, click Backup settings.

  4. Uncheck the Enable backup checkbox.

  5. To confirm, click Change.

Delete backups#

You can delete either specific or all unnecessary backups.

To delete specific backups:

  1. Go to PaaS Service backups.

  2. In the resource table, select the service whose database backups you want to delete. To speed up the search, you can select the service category or use table search.

  3. Click the service ID. It corresponds to the name of the folder in the bucket where database backups for this service are stored.

  4. Open the Backups tab and select the backups for deletion in the resource table.

  5. Click Delete and confirm the action in the dialog window.

  1. Go to PaaS Running services.

  2. In the resource table, select the service whose database backups you want to delete. To speed up the search, you can select the service category or use table search.

  3. Go to the service page and open the Backups tab.

  4. In the resource table, select the backups to be deleted.

  5. Click Delete and confirm the action in the dialog window.

To delete all backups:

  1. Go to PaaS Service backups.

  2. In the resource table, select the service whose database backups you want to delete. To speed up the search, you can select the service category or use table search.

  3. Click Delete service backups and confirm the action in the dialog window.

  1. Go to the section PaaS Running services and open the Databases tab.

  2. In the resource table, select the service whose database backups you want to delete. To speed up the search, you can select the service category or use table search.

  3. Go to the service page and open the Backups tab.

  4. Click Delete all backups and confirm the action in the dialog window.

  1. Go to the section PaaS Service backups and open the Databases tab.

  2. In the resource table, select the service whose database backups you want to delete. To speed up the search, you can select the service category or use table search.

  3. Click the service ID. It corresponds to the name of the folder in the bucket where database backups for this service are stored.

  4. Open the Backups tab.

  5. Click Delete all backups and confirm the action in the dialog window.

Note

When you delete all the backups of the service, the folder that was automatically created in the bucket to store them is also deleted.

Automatic backup deletion#

In the backup settings, you can set the backup retention period for the service. By default, backups are retained permanently. You can specify the number of days, weeks, months or even years for how long the created backups should be retained.

Individual backups can be protected from automatic deletion. To do this, find the required backup in the list of backups and turn on the Deletion protection switch.

Note

When you delete a database service, automatic deletion of backups will no longer be performed. Backups of the deleted service will be retained permanently. In this case, no-longer-needed backups will have to be deleted manually.

Load balancer management#

For MySQL, PostgreSQL and Redis services, you can create an internal and/or internet-facing load balancer (for details, see load balancers). They automatically distribute incoming requests among fully functional cluster nodes (requests are not sent to the arbitrator if there is one).

Load balancers are created automatically; their parameters and associated resources cannot be modified. To modify the DNS name of an existing load balancer, delete it first and then create a new one. For information about the created load balancers and, in particular, the service addresses, open the Load balancers tab on the service page.

Attention

A load balancer running together with a PaaS service can be deleted only on the page of this service.

Important

To run the internet-facing load balancer, give external access to HAProxy ports, which is denied by default. Add enabling rule for tcp/5000 port to the security group that was specified when creating the service.

Depending on the service, you may also need to open access to other ports. You can see the ports listened to by the service in the Information tab on its page.

Create a load balancer#

A load balancer for a database service can only be created when the service is in Running status. You can create one internal and one internet-facing load balancer per service.

Important

You can create an internal load balancer only if route propagation is enabled in VPC.

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Load balancers tab and click Create.

  4. In the window that opens, select a balancer you want to create. If none has been created yet, you can create both internal and internet-facing balancers at once.

    In the DNS name field, you can specify an arbitrary subdomain name in the paas.<region>.web.c2.croc.ru DNS service zone for an Internet-facing load balancer and in the paas.<vpc-id>.internal zone for an internal load balancer. The name may contain Latin letters, digits, and hyphens.

    If the DNS name field is left blank, the name will be specified automatically.

  5. Click Create to complete the action.

Delete load balancer#

Load balancer associated with the service can only be deleted when the service is in Running status.

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Load balancers tab and click Delete.

  4. In the window that opens, select a load balancer you want to delete. If two load balancers have been created for the service, you can delete both at the same time.

  5. Click Delete to confirm the action.

Database service configuration#

If you have not enabled monitoring and/or logging when creating the database service, or you want to disable them, you can do it when the service is in the Ready state. You can also change Redis and MongoDB additional parameters.

Note

To enable monitoring and logging, first deploy Prometheus-based monitoring service and ELK-based logging service.

Important

If an attempt to modify some settings fails, then the service will be reset to default ones.

To set up the database service:

  1. Go to the PaaS section Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Parameters tab and click Modify.

  4. In the window that opens, you can configure monitoring and logging (or disable them if they are already enabled). You can also change RDB Persistence and AOF Persistence parameters for the Redis service.

  5. To set up other parameters for Redis and MongoDB services, click Additional parameters.

    You can also change advanced settings at this step. To do this, click advanced settings and specify the desired settings and their values.

  6. To save new settings, click Modify.

Assigning tags#

Important

Tags are only supported for PaaS services with an fm-cluster-xxxxxxxxxxx ID. If you want to add tag support for the installed services with a UUID as an ID, please contact the support service.

Tags allow you to classify PaaS services by various attributes, such as purpose, owner, etc. Their usage simplifies the management of many similar resources.

To add, modify or delete tag for the databases service:

  1. Go to PaaS Running services and open the Databases tab.

  2. In the resource table, find the service for which you want to assign tags, and click on its ID to go to the service page.

  3. Open the Tags tab.

  4. To add a tag, click Add tag and specify the Key and Value fields.

    To modify a tag, edit the required fields (Value and/or Key) of the respective tag.

    To delete a tag, click the icon next to the tag you no longer need.

    Note

    If no tags have been set earlier, you can add the Name tag by clicking Add Name tag.

  5. Click Apply to save the changes.

Service start and stop#

You can stop the databases service, if you don’t need it, and start it when necessary, thus saving money on computing resources, because only attached volumes (and database backups, if any) are billed when the service is stopped.

You can also restart the service in case of an error, and synchronize the service status with those of the instances where it is installed.

Stop service#

The service can be stopped when it is in the Running or Error state.

  1. Go to PaaS Running services and open the Databases tab.

  2. In the resource table, find the service you want to stop and click the shutdown icon in the Actions field. Alternatively, click the service ID to go to its page and then click Stop in the Information tab.

  3. In the dialog window, confirm the action.

Restart the service#

Note

You can only restart services with the environment version 3.6 or higher. You can find out the current version of the environment in the Information tab on the service page.

The service can be restarted when it is in the Running or Error state.

  1. Go to PaaS Running services and open the Databases tab.

  2. In the resource table, find the service you want to restart and click the restart icon in the Actions field. Alternatively, click the service ID to go to its page and then click Restart in the Information tab.

  3. In the dialog window, confirm the action.

Synchronize the service with instances#

Synchronization allows you to match the states of the service and the instances on which it is installed, when instances were manually started after the service was stopped. It can also be used to match the states if an error occurred when stopping, starting, or restarting the service and instances had to be manually stopped/started.

Attention

Synchronization is not possible if the error cannot be eliminated (the error status can be viewed, for example, using the DescribeService method).

  1. Go to PaaS Running services and open the Databases tab.

  2. In the resource table, find the service you want to synchronize and click the synchronization icon in the Actions field. Alternatively, click the service ID to go to its page and then click Synchronize with confirmation in the Information tab.

  3. In the dialog window, confirm the action.

Start the service#

You can only start the service, when it is in the Stopped state.

  1. Go to PaaS Running services and open the Databases tab.

  2. In the resource table, find the service you want to start and click the start icon in the Actions field. Alternatively, click the service ID to go to its page and then click Start in the Information tab.

  3. In the dialog window, confirm the action.

Configuring the maintenance window#

During scheduled maintenance, critical security patches and other important updates are installed.

Attention

During maintenance, operations with the service, including its deletion, are not available, but the service itself will continue to operate. In some cases, it may be necessary to stop and restart the cluster nodes.

Maintenance is carried out strictly during a preset time period (if a maintenance window is specified). All actions of K2 Cloud specialists during maintenance are logged.

Note

You can modify the maintenance window settings when the service is in the Running state only.

To modify the maintenance window settings:

  1. Go to PaaS Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. In the Maintenance tab, click Set up.

  4. In the window that opens, specify the maintenance interval that is convenient for you. To do so, select the following parameters:

    • the Scheduled value for the Maintenance window option;

    • a day of the week for the maintenance to take place;

    • hour interval for the maintenance window.

    Or select the Custom value for the Maintenance window option, if maintenance can be performed at any time.

  5. Click Save to modify the maintenance window.

Viewing metrics#

Depending on the service type, you can view the following metrics:

Metrics

Description

mysql_global_status_aborted_clients

Number of aborted client connections

mysql_global_status_aborted_connects

Number of failed connection attempts

mysql_global_status_innodb_row_lock_current_waits

Current number of expected row locks

mysql_global_status_slow_queries

Number of slow queries

mysql_global_status_threads_connected

Current number of connected threads

mysql_global_status_threads_running

Number of threads that are not sleeping

mysql_global_variables_max_connections

Maximum permitted number of connections

mysql_info_schema_innodb_metrics_buffer_pool_pages

Number of pages in InnoDB buffer pool

mysql_up

Indicates whether MySQL server is up

Metrics

Description

pgbouncer_pools_client_maxwait_seconds

Max wait time for client connections

pgbouncer_pools_client_waiting_connections

Number of client connections currently waiting for a free server connection in the pool

pgbouncer_pools_server_active_connections

Number of active server connections in the pool

pgbouncer_up

Indicates whether the PgBouncer server is up

pg_locks_count

Number of locks currently held in database

pg_replication_lag

Replication lag (in seconds) between primary and standby nodes

pg_up

Indicates whether the PostgreSQL server is up

Metrics

Description

mongodb_mongod_replset_my_state

Current node state in MongoDB replica set

mongodb_mongod_wiredtiger_cache_pages

Number of pages in WiredTiger cache by page type

mongodb_ss_connections

Number of current connections

mongodb_ss_mem_resident

Resident memory used by MongoDB

mongodb_ss_mem_virtual

Virtual memory usage

mongodb_up

Indicates whether the MongoDB server is up

Metrics

Description

redis_connected_clients

Number of connected clients

redis_evicted_keys_total

Total number of evicted keys due to the max memory size limit

redis_expired_keys_total

Total number of expired keys

redis_memory_max_bytes

Max memory available for Redis

redis_memory_used_bytes

Total memory used by Redis

redis_memory_used_rss_bytes

Resident memory used by Redis (RSS)

redis_replication_connected_slaves

Number of connected replicas

redis_up

Indicates whether the Redis server is up

redis_uptime_in_seconds

Uptime of Redis server

To view the metrics of a specific service:

  1. Go to PaaS Running services and open the Databases tab.

  2. Find the desired service in the table and click the service ID to go to its page.

  3. Open the Monitoring tab and select:

    • metrics,

    • instance to collect metric from.

    Note

    Instances available for a particular metric depend on their role. For certain metrics, there can be additional selectors apart from instance choice.

    Go to Display parameters to set the period the metric graph covers, statistics, and metric calculation interval. To automatically refresh the graph, enable Auto-refresh; to refresh it manually, click Refresh.

Deleting database service#

Deleting a database service deletes all instances, volumes and placement groups created with it.

To delete a service, go to PaaS Running services, open the Databases tab and click the icon in the table or the Delete button on the service page. If you want to use network interfaces in the future, for example, to recreate a service with the same network parameters, then in the dialog window, clear Delete associated network interfaces checkbox.

Note

When a service is deleted, stored backups of its databases are retained.