Databases
In this article:
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.
ClickHouse — колоночная система управления базами данных с открытым исходным кодом, предназначенная для интерактивной аналитической обработки данных (OLAP). Она обеспечивает высокую скорость выполнения сложных запросов на огромных массивах данных. Более подробно узнать о возможностях СУБД можно в документации ClickHouse.
Billing#
PaaS-сервисы баз данных ClickHouse, MongoDB, MySQL, PostgreSQL и Redis не тарифицируются. Оплата взимается за фактически потреблённые тарифицируемые ресурсы: экземпляры, диски, Elastic IP-адреса и иные ресурсы.
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#
В K2 Cloud можно запустить отказоустойчивый сервис в кластере из нескольких узлов (3 или более в зависимости от сервиса). Это позволяет решить проблему раздвоения сознания (split brain).
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 the resources involved. Therefore, a configuration with two full-featured nodes and a cluster arbitrator is more cost-effective, because the arbitrator neither stores nor processes data and is launched with the minimum set of resources required to maintain cluster quorum.
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 attach 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 subnets that have Internet access. For this purpose, the VPC must have an internet gateway and a NAT gateway attached, and a default route must be created in the route table. When creating the service, only VPCs with an attached internet gateway and NAT gateway are available for selection.
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:
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 <lb-name>-<lb-id>.lb.<region>.k2.cloud DNS service zone for an Internet-facing load balancer and in the <lb-name>-<lb-id>.lb.vpc-xxxxxx.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 <lb-name>-<lb-id>.lb.<region>.k2.cloud DNS service zone for an Internet-facing load balancer and in the <lb-name>-<lb-id>.lb.vpc-xxxxxx.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 <lb-name>-<lb-id>.lb.<region>.k2.cloud DNS service zone for an Internet-facing load balancer and in the <lb-name>-<lb-id>.lb.vpc-xxxxxx.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.
To configure a cluster, where the service will be deployed, you can select the following number of 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, 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 <lb-name>-<lb-id>.lb.<region>.k2.cloud DNS service zone for an Internet-facing load balancer and in the <lb-name>-<lb-id>.lb.vpc-xxxxxx.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.
Click Next to proceed to the next step.
Задайте параметры экземпляров сервиса:
Если для сервиса MySQL была выбрана конфигурация с кластерным арбитром, то в блоке Мастер-узел задайте конфигурацию экземпляра, который будет использоваться в качестве мастер-узла. Выберите тип экземпляра и характеристики диска для данных: тип, размер и IOPS (если это доступно для данного типа).
Конфигурация экземпляра, который будет использоваться в качестве арбитра, устанавливается автоматически и не может быть изменена.
Если на предыдущем шаге была выбрана конфигурация кластера
от трёх до шести мастер-узлов, то вы можете задать количество мастер-узлов в кластере. Однако если были указаны сетевые интерфейсы, то количество экземпляров фиксировано и равно числу выбранных сетевых интерфейсов.Если была выбрана конфигурация с кластерным арбитром, то в блоке Мастер-узел задайте конфигурацию экземпляра, который будет использоваться в качестве мастер-узла. Выберите тип экземпляра и характеристики диска для данных: тип, размер и IOPS (если это доступно для данного типа). Конфигурация экземпляра, который будет использоваться в качестве арбитра, устанавливается автоматически и не может быть изменена.
Если для сервиса MongoDB была выбрана конфигурация с кластерным арбитром, то в блоке Мастер-узел задайте конфигурацию экземпляра, который будет использоваться в качестве мастер-узла. Выберите тип экземпляра и характеристики диска для данных: тип, размер и IOPS (если это доступно для данного типа).
Конфигурация экземпляра, который будет использоваться в качестве арбитра, устанавливается автоматически и не может быть изменена.
Если для сервиса ClickHouse на предыдущем шаге была выбрана отказоустойчивая конфигурация, то вы можете задать количество экземпляров с ролью Сервер в кластере. Задайте конфигурацию экземпляров в блоках Сервер, Совмещённый узел или Координатор для узлов с соответствующими ролями. Для узлов с ролью Сервер или Совмещённый узел возможно задать тип экземпляра и характеристики диска для данных: тип, размер и IOPS (если это доступно для данного типа диска). В конфигурации
три совмещённых узла и до двенадцати сервероввсе узлы будут использовать одни и те же характеристики. Для узлов с ролью Координатор возможно задать только тип экземпляра. В конфигурациитри координатора и от трёх до двенадцати серверовнадо отдельно задать характеристики узлов с ролью Координатор и Сервер.Note
Database performance depends on the selection of node components. We recommend using high performance volumes gp2: Universal (SSD) or io2: Maximum (SSD).
You can enable automatic expansion of the data volume.
To do this, tick the Enable auto-expansion checkbox and specify:
maximum volume size — its value cannot exceed the quota for the maximum volume size in the project;
utilization threshold — the range of possible values is from 70% to 90%.
Click Next to proceed to the next step.
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.11percona
5.7
8.0mysql
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.
Vendor — PostgreSQL DBMS storage subsystem engine. Valid values:
pgsql,pgsql1c.Version — The DBMS engine version. Depending on the engine vendor, the following versions are supported:
Vendor
Version
pgsql
14
15
16
17
18pgsql1c
16
17Replication 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.
Version — The supported DBMS versions are 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.
Version — The up-to-date list of supported versions is available in the web interface.
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.
Service name — An arbitrary unique name of the database service.
Версия ClickHouse — Актуальный список поддерживаемых версий доступен в веб-интерфейсе. Поддерживаются следующие LTS-версии: 24.8, 25.3.
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.
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.
Click Next to proceed to the next step.
Configure backup.
Note
This step is currently available for MongoDB, MySQL and 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.
Set the maintenance window (see Configuring the maintenance window). 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
Scheduledvalue 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.
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.
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.
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
On the Instances tab, click Add instances.
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.
Click Add to complete the operation.
Delete service nodes#
If the three to six master nodes cluster configuration was selected when creating a PostgreSQL or MongoDB service and the cluster consists of more than three nodes, you can decrease the number of master nodes when the load decreases. Nodes can be deleted only when the service is in the Running state.
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Instances tab.
In the resource table, select the instances to be deleted that host master nodes and click Delete.
Important
After deletion, the number of nodes must not be less than the minimum allowed number of nodes in the cluster.
Click Delete 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:
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
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.
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:
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
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.
Click to save changes.
Configuring automatic volume expansion#
Note
This feature is not available if the service uses nv1 volumes (non-replicated NVMe volumes).
When automatic expansion is enabled, the volume size will increase every time the utilization of the data volume on at least one node equals or exceeds the threshold value within 10 minutes.
During expansion, ~20% is added to the volume (the resulting volume size is rounded up to a multiple of 8 GiB). The volume size increases immediately, without waiting for the nearest maintenance window. The service remains available to users during expansion.
Important
The fee for volume usage is proportional to its size. Expansion is irreversible — the volume size cannot be reduced.
After each automatic volume expansion, a cooldown period is provided — a pause of 30 minutes, during which the next utilization check is not performed.
Once the preset maximum size is reached, automatic expansion is disabled.
To enable, configure, or disable automatic expansion:
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
In the Information tab, click the editing icon next to the Auto-expansion field.
To disable auto-expansion, clear the Enable auto-expansion checkbox. To enable auto-expansion, tick the checkbox and configure the auto-expansion parameters:
maximum volume size — its value cannot exceed the quota for the maximum volume size in the project;
utilization threshold — the range of possible values is from 70% to 90%.
Once you have made all the required modifications, click Save.
Управление ресурсами баз данных#
Вы можете создавать и удалять базы данных, пользователей и иные ресурсы, а также менять некоторые их настройки непосредственно из веб-интерфейса облака.
Создание и удаление пользователей, баз данных и иных ресурсов возможно для сервисов в состоянии Запущен или Обновление. Данные операции доступны для баз данных ClickHouse, MongoDB, MySQL и PostgreSQL.
Users#
Create user#
Note
Создание пользователя возможно, только когда сервис находится в состоянии Запущен.
To create a new user:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Пользователи (или Ресурсы Пользователи для СУБД ClickHouse) и нажмите Создать.
Set the required parameters:
Имя — Имя пользователя. Должно начинаться с латинской буквы, не должно быть длиннее 32 символов, может состоять из цифр, латинских букв, символа подчёркивания _. Нельзя использовать зарезервированные имена clustercheck, mariadb.sys, monitoring, mysql, root.
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.
Имя — Имя пользователя. Имя должно начинаться с латинской буквы, не должно быть длиннее 31 символа и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированные имена os_admin, postgres, replicator, root.Password – User password.
Алгоритм хранения пароля — Алгоритм шифрования пароля. Доступные значения:
MD5иScram SHA-1.Разрешить репликацию — Возможность запуска логической репликации от имени этого пользователя.
Лимит подключений — Максимальное число одновременных подключений к базе данных.
Роли — Одна или более доступных пользователю ролей.
Параметры роли — Выберите параметры роли, назначаемой пользователю, из раскрывающегося списка.
application_name — Название приложения, отображающееся в логах, мониторинге и статистике PostgreSQL (
pg_stat_activity).default_transaction_isolation — Уровень изоляции новых транзакций по умолчанию.
default_transaction_read_only — Указывает, будут ли транзакции по умолчанию запускаться в режиме «только чтение».
idle_in_transaction_session_timeout — Максимальное время, в течение которого открытая транзакция может оставаться неактивной.
idle_session_timeout — Максимальное время, в течение которого открытая сессия может оставаться неактивной.
lock_timeout — Максимальное время, в течение которого запрос может ожидать получения блокировки на объект базы данных.
search_path — Список схем и порядок их перебора для поиска объектов базы данных.
statement_timeout — Максимальное время, отведённое на выполнение запроса.
timezone — Часовой пояс сессии пользователя.
Имя — Имя пользователя. Имя должно начинаться с латинской буквы, не должно быть длиннее 63 символов и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированные имена admin, root.Password – User password.
Имя — Имя пользователя. Имя должно начинаться с латинской буквы, не должно быть длиннее 63 символов и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированные имена cluster_user, default.Пароль — Пароль пользователя. Вы можете задать пароль вручную или сгенерировать его автоматически, нажав Сгенерировать пароль.
Кодирование пароля — Алгоритм шифрования пароля. Возможное значение:
Double SHA-1Профиль — Профиль настроек СУБД, применяемый к пользователю. Доступные значения:
default,readonlyи созданные пользователем профили.Квота — Квота, применяемая к пользователю. Возможные значения:
defaultи созданные пользователем квоты.Права — Права, назначаемые пользователю. Должны указываться в формате запроса GRANT, например,
GRANT SELECT ON analytics.*Сетевые ограничения — Ограничения сетевого доступа, налагаемые на подключение к базе данных. Виды ограничений:
IP-адреса и подсети — IP-адрес и/или блок IP-адресов в нотации CIDR, например,
10.0.0.1,10.0.0.0/24.Имена хостов — DNS-имена хостов в формате FQDN, например, example.com.
Регулярные выражения — Регулярное выражение для имён хостов. Например, регулярное выражение
\bex[a-z0-9-]*\.com\bсоответствует доменным именам в зоне .com, начинающимся сexи далее содержащим любое количество допустимых символов.
Click Create.
Изменить настройки пользователя#
Note
Имя пользователя базы данных ClickHouse, MySQL и PostgreSQL, а также имя и пароль пользователя для базы данных MongoDB изменить нельзя.
Чтобы изменить настройки пользователя для баз данных MySQL, PostgreSQL и ClickHouse, выполните следующие действия:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Пользователи (или Ресурсы Пользователи для СУБД ClickHouse) и нажмите Изменить.
Set the required parameters:
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.
Password – User password.
Алгоритм хранения пароля — Алгоритм шифрования пароля. Доступные значения:
MD5иScram SHA-1.Разрешить репликацию — Возможность запуска логической репликации от имени этого пользователя.
Лимит подключений — Максимальное число одновременных подключений к базе данных.
Роли — Одна или более доступных пользователю ролей.
Параметры роли — Выберите параметры роли, назначаемой пользователю, из раскрывающегося списка.
application_name — Название приложения, отображающееся в логах, мониторинге и статистике PostgreSQL (
pg_stat_activity).default_transaction_isolation — Уровень изоляции новых транзакций по умолчанию.
default_transaction_read_only — Указывает, будут ли транзакции по умолчанию запускаться в режиме «только чтение».
idle_in_transaction_session_timeout — Максимальное время, в течение которого открытая транзакция может оставаться неактивной.
idle_session_timeout — Максимальное время, в течение которого открытая сессия может оставаться неактивной.
lock_timeout — Максимальное время, в течение которого запрос может ожидать получения блокировки на объект базы данных.
search_path — Список схем и порядок их перебора для поиска объектов базы данных.
statement_timeout — Максимальное время, отведённое на выполнение запроса.
timezone — Часовой пояс сессии пользователя.
Пароль — Пароль пользователя. Вы можете задать пароль вручную или сгенерировать его автоматически, нажав Сгенерировать пароль.
Кодирование пароля — Алгоритм шифрования пароля. Возможное значение:
Double SHA-1Профиль — Профиль настроек СУБД, применяемый к пользователю. Возможные значения:
default,readonlyи созданные пользователем профили.Квота — Квота, применяемая к пользователю. Возможные значения:
defaultи созданные пользователем квоты.Права — Права, назначаемые пользователю. Должны указываться в формате запроса GRANT, например,
GRANT SELECT ON analytics.*Сетевые ограничения — Ограничения сетевого доступа, налагаемые на подключение к базе данных. Виды ограничений:
IP-адреса и подсети — IP-адрес и/или блок IP-адресов в нотации CIDR, например,
10.0.0.1,10.0.0.0/24.Имена хостов — DNS-имена хостов в формате FQDN, например, example.com.
Регулярные выражения — Регулярное выражение для имён хостов. Например, регулярное выражение
\bex[a-z0-9-]*\.com\bсоответствует доменным именам в зоне .com, начинающимся сexи далее содержащим любое количество допустимых символов.
Click Save.
Delete user#
To delete a user:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Пользователи (или Ресурсы Пользователи для СУБД ClickHouse) и выберите пользователя, которого хотите удалить.
Click Delete.
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.
Databases#
Create a database#
Note
Создание пользователя возможно, только когда сервис находится в состоянии Запущен.
To create a new database:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Databases tab and click Create.
Specify a database name and other parameters. The exact set of parameters depends on the selected database service.
Имя — Имя базы данных. Имя должно начинаться с латинской буквы, не должно быть длиннее 64 символов и может состоять из цифр, латинских букв и символов
$и_. Нельзя использовать зарезервированные имена 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.
Имя — Имя базы данных. Имя должно начинаться с латинской буквы, не должно быть длиннее 31 символа и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированные имена postgres, template0, template1.Владелец — Владелец базы данных. Должен быть одним из существующих пользователей, добавленных на шаге создать пользователя. Такого пользователя нельзя удалить, пока он является владельцем базы данных.
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.
Имя — Имя базы данных. Имя должно начинаться с латинской буквы, не должно быть длиннее 63 символов и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированное имя admin.Enable backup — Enables daily backup. Backups will only be created if this option is enabled for the service.
(Only during database recovery) Source database name — The name of the database for which the backup was created.
Important
The Source database name parameter must be specified only when a different name is entered for the database being recovered.
Имя — Имя базы данных. Имя должно начинаться с латинской буквы, не должно быть длиннее 63 символов и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированные имена default, readonly.
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.
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.
To add other users, click Add User.
Click Create.
Change database settings#
Once database has been created, you can modify some of its settings and create/delete users. To do this:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Databases tab, find the database whose settings you want to change, and click Change.
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).
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.
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 database#
To delete a database:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Базы данных (или Ресурсы Базы данных для СУБД ClickHouse) и выберите базу данных, которую хотите удалить.
Click Delete.
In the window that opens, confirm the deletion.
Шарды#
Note
Управление шардами доступно только для баз данных ClickHouse.
Шард в ClickHouse — это логическая единица горизонтального масштабирования, представляющая собой набор данных, размещённый на одном или нескольких серверных узлах. Каждый шард содержит свою часть общей таблицы и отвечает за хранение конкретного диапазона или подмножества данных. Шардинг позволяет распределить большие объёмы информации между разными серверами и, таким образом, увеличить производительность, снизить нагрузку на отдельные узлы и обеспечить масштабируемость системы по мере роста данных.
Для обеспечения отказоустойчивости внутри каждого шарда обычно используется репликация: несколько узлов содержат идентичные копии данных, и ClickHouse автоматически выбирает доступную реплику при выполнении запросов. Таким образом, шарды обеспечивают эффективное распределение данных, а реплики внутри шардов — высокую доступность и защиту от сбоев.
Шард может состоять из одной и более реплик. После создания шарда количество реплик можно увеличивать, но нельзя уменьшать. При создании шарда нельзя явно указать, какие именно экземпляры или зоны доступности следует использовать для шардирования или репликации.
Создать шард#
Go to the PaaS section Running services and open the Databases tab.
Найдите нужный сервис ClickHouse в таблице и нажмите на идентификатор сервиса для перехода на его страницу.
Откройте вкладку Ресурсы Шарды и нажмите Добавить.
Set the required parameters:
Внутренняя репликация — Включает использование внутренней репликации при работе через распределённые (distributed) таблицы.
Вес — Вес шарда при распределении данных в распределённых таблицах. Параметр используется для балансировки — шард с большим весом получает больше данных. По умолчанию вес шарда равен 1.
Реплики — Количество реплик в шарде, соответствует количеству серверов. По умолчанию количество реплик равно 1.
Для завершения создания шарда нажмите Создать.
Note
Добавленный шард нельзя удалить.
Для PaaS-сервисов СУБД ClickHouse без отказоустойчивости можно создать один шард, состоящий из одной реплики. Для отказоустойчивых сервисов количество реплик ограничено количеством серверов.
Изменить шард#
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Шарды.
В таблице ресурсов выберите шард, который требуется изменить, и нажмите Изменить.
Укажите новые значения параметров Внутренняя репликация, Вес и/или Реплики.
Для завершения редактирования шарда нажмите Сохранить.
Note
Уменьшить количество реплик в шарде нельзя.
Удалить шард#
Добавленный шард нельзя удалить.
Профили#
Note
Управление профилями доступно только для баз данных ClickHouse.
Профиль настроек — это набор настроек базы данных, объединённых под одним именем. Один и тот же профиль можно назначить разным пользователям. В профиле можно указать пользовательские настройки ClickHouse (user-level settings). Более подробно узнать о настройках можно в документации СУБД Clickhouse.
Создать профиль#
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Профили и нажмите Добавить.
Set the required parameters:
Имя — Имя профиля. Имя должно начинаться с латинской буквы и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированные имена default и readonly.
Чтобы задать настройки для профиля, нажмите Добавить настройку и задайте настройку и её значение. Чтобы задать несколько настроек, повторите это действие необходимое количество раз.
После задания всех необходимых параметров и настроек нажмите Создать для создания профиля.
Изменить профиль#
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Профили.
В таблице ресурсов выделите профиль, который требуется изменить, и нажмите Изменить.
Задайте новые параметры профиля. Вы можете добавить дополнительные настройки, изменить значение имеющихся или удалить их.
Note
Имя профиля изменить нельзя.
Для завершения редактирования профиля нажмите Сохранить.
Удалить профиль#
Note
Профиль, связанный с пользователем базы данных, удалить нельзя. Следует сначала отвязать этот профиль от пользователя. Для этого отредактируйте настройки соответствующего пользователя по инструкции и укажите другой профиль в поле Профиль.
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Профили.
В таблице ресурсов выделите профиль, который требуется изменить, и нажмите Удалить.
In the dialog window, confirm the action.
Quotas#
Note
Управление квотами доступно только для баз данных ClickHouse.
Квоты в ClickHouse позволяют ограничивать или отслеживать использование ресурсов за определённый период времени, а именно:
Ограничивают объём запросов, который можно выполнить за период времени, вместо ограничения одного запроса.
Учитывают ресурсы, затраченные на всех удалённых серверах при распределённой обработке запросов.
Для квоты задаётся один или более интервалов времени в секундах, каждый со своими настройками. Отсчёт интервала ведётся от некоторого фиксированного момента времени. Когда интервал заканчивается, все накопленные значения обнуляются, и для следующего интервала вычисление квоты начинается заново. Если лимит превышен хотя бы для одного временного интервала, генерируется исключение с текстом о том, какой именно лимит был превышен, для какого интервала и когда начинается новый интервал (то есть когда возможно будет снова отправлять запросы). После генерации исключение передаёт указанную информацию в журналы ClickHouse.
Создать квоту#
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Квоты и нажмите Добавить.
Set the required parameters:
Имя — Имя квоты. Имя должно начинаться с латинской буквы и может состоять из цифр, латинских букв и символов подчёркивания
_. Нельзя использовать зарезервированное имя default.
В блоке Интервалы задайте требуемые значения. Для создания квоты необходимо задать значение параметра duration и хотя бы одного параметра из списка предлагаемых. Если необходимо добавить дополнительные интервалы квот, нажмите Добавить интервал. Информация о параметрах интервалов квот размещена в документации.
Нажмите Создать для создания квоты.
Изменить квоту#
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Квоты.
В таблице ресурсов выделите квоту, которую требуется изменить, и нажмите Изменить.
Задайте новые параметры квоты (имя квоты изменить нельзя). Информация о параметрах интервалов квот размещена в документации.
Для завершения редактирования профиля нажмите Сохранить.
Удалить квоту#
Note
Квоту, связанную с пользователем базы данных, удалить нельзя. Следует сначала отвязать эту квоту от пользователя. Для этого отредактируйте настройки соответствующего пользователя по инструкции и укажите другую квоту в поле Квота.
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Откройте вкладку Ресурсы Квоты.
В таблице ресурсов выделите квоту, который требуется изменить, и нажмите Удалить.
In the dialog window, confirm the action.
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
Backup is now available for MongoDB, MySQL and PostgreSQL database services. In the future, we plan to deploy it for other database services.
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:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
In the Information tab, click Backup settings.
If backup has not been enabled, check the Enable backup checkbox.
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.
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:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Databases tab and select the database in the resource table.
Click Edit.
Check the Enable backup checkbox, while leaving all other parameters unchanged.
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:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Databases tab and click Create from backup.
In the database creation wizard that opens, select the required backup from the list. To make the search easier, you can select the service where the database whose backup you are looking for was created. Click Select to go to the next step.
Select the database you want to restore. Click Select to proceed to the next step.
Задайте параметры базы данных и, если необходимо, добавьте пользователей. Данные шаги аналогичны шагам 4–6 при создании базы данных и более подробно описаны в инструкции по созданию базы данных.
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:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Databases tab and select the database in the resource table.
Click Edit.
Uncheck the Enable backup checkbox, while leaving all other parameters unchanged.
Click Save.
To disable backup for all databases:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
In the Information tab, click Backup settings.
Uncheck the Enable backup checkbox.
To confirm, click Change.
Delete backups#
You can delete either specific or all unnecessary backups.
To delete specific backups:
Go to PaaS Service backups.
In the resource table, select the service whose database backups you want to delete. To make the search easier, you can select the service category or use table search.
Click the service ID. It corresponds to the name of the folder in the bucket where database backups for this service are stored.
Open the Backups tab and select the backups for deletion in the resource table.
Click Delete and confirm the action in the dialog window.
Go to PaaS Running services.
In the resource table, select the service whose database backups you want to delete. To make the search easier, you can select the service category or use table search.
Go to the service page and open the Backups tab.
In the resource table, select the backups to be deleted.
Click Delete and confirm the action in the dialog window.
To delete all backups:
Go to PaaS Service backups.
In the resource table, select the service whose database backups you want to delete. To make the search easier, you can select the service category or use table search.
Click Delete service backups and confirm the action in the dialog window.
Go to the section PaaS Running services and open the Databases tab.
In the resource table, select the service whose database backups you want to delete. To make the search easier, you can select the service category or use table search.
Go to the service page and open the Backups tab.
Click Delete all backups and confirm the action in the dialog window.
Go to the section PaaS Service backups and open the Databases tab.
In the resource table, select the service whose database backups you want to delete. To make the search easier, you can select the service category or use table search.
Click the service ID. It corresponds to the name of the folder in the bucket where database backups for this service are stored.
Open the Backups tab.
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.
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Load balancers tab and click Create.
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 <lb-name>-<lb-id>.lb.<region>.k2.cloud DNS service zone for an Internet-facing load balancer and in the <lb-name>-<lb-id>.lb.vpc-xxxxxx.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.
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.
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Load balancers tab and click Delete.
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.
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:
Go to the PaaS section Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Parameters tab and click Modify.
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.
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.
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:
Go to PaaS Running services and open the Databases tab.
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.
Open the Tags tab.
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.
Click Apply to save the changes.
Managing security groups#
Note
Security groups can be changed only for a service in the Running status.
If you want to change security groups for a service:
Go to PaaS Running services and open the Databases tab.
In the resource table, find the service whose security groups you want to change and click the service ID to go to its page.
Open the Information tab.
To change the security groups assigned to the service, click next to the Security groups field.
Select one or more security groups from the drop-down list.
To cancel the selection or remove a group from the list, click next to the security group.
Note
If a security group is created automatically with the service, it cannot be deleted.
To save changes, click .
Note
The list of security groups cannot be empty.
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.
Go to PaaS Running services and open the Databases tab.
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.
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.
Go to PaaS Running services and open the Databases tab.
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.
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).
Go to PaaS Running services and open the Databases tab.
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.
In the dialog window, confirm the action.
Start the service#
You can only start the service, when it is in the Stopped state.
Go to PaaS Running services and open the Databases tab.
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.
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:
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
In the Maintenance tab, click Set up.
In the window that opens, specify the maintenance interval that is convenient for you. To do so, select the following parameters:
the
Scheduledvalue 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
Customvalue for the Maintenance window option, if maintenance can be performed at any time.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:
Go to PaaS Running services and open the Databases tab.
Find the desired service in the table and click the service ID to go to its page.
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 consists in deleting all instances, volumes, and placement groups created together 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.