Creating a PostgreSQL cluster for 1С:Enterprise
Managed Service for PostgreSQL allows you to create fault-tolerant PostgreSQL clusters optimized for 1C:Enterprise. To this end, the service supports PostgreSQL versions 13-1c, 14-1c, 15-1c, and 16-1c with all the required extensions installed and the connection pooler configuration modified.
Warning
You can only connect 1C:Enterprise to version 13-1c, 14-1c, 15-1c, and 16-1c clusters.
Select your host class based on the number of users in your 1C:Enterprise installation. The s2.small hosts can accommodate up to 50 users at a time. We recommend using the s2.medium class if 50 or more users are going to access the database. Choose the storage size based on your expected data scope and allow for possible growth in your data volumes.
Create a Managed Service for PostgreSQL cluster
Create a Managed Service for PostgreSQL cluster of any suitable configuration with the following settings:
- Environment:
PRODUCTION
- Version: PostgreSQL version used for working with 1C:Enterprise. The names of such versions end with
-1c
. - Host class: At least
s2.small
. - Hosts: Add at least two more hosts in different availability zones. This provides the fault tolerance of the cluster. The database is automatically replicated. For more information, see Replication in Managed Service for PostgreSQL.
-
If you do not have Terraform yet, install it.
-
Get the authentication credentials. You can add them to environment variables or specify them later in the provider configuration file.
-
Configure and initialize a provider. There is no need to create a provider configuration file manually, you can download it
. -
Place the configuration file in a separate working directory and specify the parameter values. If you did not add the authentication credentials to environment variables, specify them in the configuration file.
-
Download the postgresql-1c.tf
configuration file to the same working directory.This file describes:
- Network.
- Subnet.
- Security group and rule enabling cluster connections.
- Managed Service for PostgreSQL cluster for 1C:Enterprise with the database and user.
-
Specify the infrastructure settings under
locals
in thepostgresql-1c.tf
configuration file:cluster_name
: Cluster name.pg_version
: PostgreSQL version used for working with 1C:Enterprise. The names of such versions end with-1c
.db_name
: Database name.username
andpassword
: Database owner username and password.
-
Make sure the Terraform configuration files are correct using this command:
terraform validate
If there are any errors in the configuration files, Terraform will point them out.
-
Create the required infrastructure:
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
All the required resources will be created in the specified folder. You can check resource availability and their settings in the management console
. -
Creating a DB cluster may take a few minutes.
Connect the database to 1C:Enterprise
Add the created database as an information base to 1C:Enterprise. When adding the database, use the following parameters:
- Secure connection: Disabled.
- DBMS type:
PostgreSQL
. - Database server:
c-<cluster_ID>.rw.mdb.yandexcloud.net port=6432
. - Database name: Name of the database you specified when creating the cluster.
- Database user: Username of the database owner.
- User password: Password of the database owner.
- Create database if none present: Disabled.
PostgreSQL extensions for 1C:Enterprise support
List of extensions installed in PostgreSQL 13-1c, 14-1c, 15-1c, and 16-1c clusters:
Delete the resources you created
Delete the resources you no longer need to avoid paying for them:
To delete the infrastructure created with Terraform:
-
In the terminal window, go to the directory containing the infrastructure plan.
-
Delete the
postgresql-1c.tf
configuration file. -
Make sure the Terraform configuration files are correct using this command:
terraform validate
If there are any errors in the configuration files, Terraform will point them out.
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
All resources described in the
postgresql-1c.tf
configuration file will be deleted. -