Geo-Distributed 1C-Bitrix Cluster Setup

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Showing 1 of 1All 1626 services
Geo-Distributed 1C-Bitrix Cluster Setup
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1368
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    956
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    699
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    843
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    737
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1086

A single data center in Moscow gives 80–120 ms latency for users from Novosibirsk and 150–200 ms from Almaty. Under highload across multiple regions, this accumulates: a page with 30+ API requests opens in 3–4 seconds instead of 1. A multi-region setup (also called geo-distributed cluster) solves this by routing users to the nearest node—cutting load time by 2–3x compared to a single-server deployment. For Bitrix, this is nontrivial because it requires working with distributed state. Our experience shows that a properly designed multi-region 1C-Bitrix cluster with database replication and Redis solves state distribution challenges. Savings on hosting with this distributed architecture reach 40% compared to renting capacity in each region separately, potentially saving between $500 and $2,000 per month depending on traffic, with typical savings of $1,200 per month. We have 5+ years of experience and 50+ successful Bitrix clustering projects. For a multi-region cluster with Bitrix, database replication, Redis cluster, GeoDNS, and CDN are essential.

We offer a consultation on your cluster architecture and will evaluate your project within two days after an audit. The project cost for a geo-cluster setup is $12,000 to $18,000 depending on complexity.

How does a multi-region cluster reduce latency?

To deploy a geo-distributed Bitrix cluster, follow these steps:

  1. Design architecture.
  2. Set up database replication.
  3. Configure Redis.
  4. Synchronize files.
  5. Set up GeoDNS.
  6. Test failover.

What is the best architecture for two regions?

Typical scheme for two regions (Moscow + another):

           [GeoDNS / Anycast BGP]
          /                       \
   [Region-MSK]               [Region-EKB]
   Web-1, Web-2               Web-3, Web-4
   Redis-1 (master)           Redis-2 (replica)
   [DB Master]      <-->      [DB Replica]
   [File Storage]    rsync    [File Storage Mirror]

Key decisions:

  • DB Master is placed in only one region. Writes go to master, reads can be distributed to replicas.
  • File synchronization—via S3-compatible storage (recommended) or one-way rsync from master, uploads to regional nodes are prohibited.
  • Sessions—via Redis with replication between regions, sessions are written to the master region.
  • If the link breaks, work only from the master region to avoid data divergence.

Limitations of GeoDNS

The simplest level is DNS by geolocation. Use Cloudflare, AWS Route 53, or Yandex Cloud DNS. For example, with Cloudflare, you can create geo-routing records: EU points to 185.10.1.100, RU-east to 195.20.2.100.

GeoDNS limitation: TTL affects failover speed. For fast failover, use Anycast BGP (one IP, different servers in different locations, network-level routing).

Configuring the Cluster Module in Bitrix

Bitrix ships the cluster module (Bitrix Web Cluster) that manages distributed nodes. Key settings are in /bitrix/.settings.php. Below is an example configuration for connections to master and replica:

'connections' => [
    'value' => [
        'default' => [
            'className' => '\Bitrix\Main\DB\MysqlCommonConnection',
            'host' => '10.0.1.10',      // master (MSK)
            'port' => 3306,
            'database' => 'bitrix_db',
            'login' => 'bitrix',
            'password' => '***',
            'options' => 2,
        ],
        'slave' => [
            'className' => '\Bitrix\Main\DB\MysqlCommonConnection',
            'host' => '10.0.2.10',      // replica (EKB)
            'port' => 3306,
            'database' => 'bitrix_db',
            'login' => 'bitrix_ro',
            'password' => '***',
            'options' => 2,
        ],
    ],
],

Read requests are forwarded to replica using \Bitrix\Main\Application::getConnection('slave'). Standard APIs (D7 ORM, CIBlockElement::GetList) use the default connection. For automatic read/write splitting, you need an intermediary layer—ProxySQL or a custom wrapper.

Database Replication Setup Between Regions

For DB synchronization, we use MySQL GTID replication over an encrypted channel (stunnel or WireGuard). Master and replica configuration:

# On master (MSK)
[mysqld]
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
gtid_mode = ON
enforce_gtid_consistency = ON
binlog_format = ROW

# On replica (EKB)
[mysqld]
server-id = 2
gtid_mode = ON
enforce_gtid_consistency = ON
read_only = ON
relay_log = /var/log/mysql/relay-bin.log

After replication is configured, run CHANGE MASTER TO with master parameters, then start the replica. Replication lag between regions is typically 50–200 ms on a 100 Mbps link with 20–30 ms latency. Critical: after an order is created, the user may not see it on the replica if lag >200 ms. Solution: after a write, direct the specific session to the master for 5–10 seconds.

File Synchronization: S3 vs rsync

Files in upload/ must be available on all nodes. We recommend S3-compatible storage (Yandex Object Storage, AWS S3, MinIO). Bitrix can work with S3 via the bitrix.cloud module or a custom handler. A CDN in front of S3 delivers files from the nearest region. If S3 is not feasible, use one-way rsync from master to replica: */1 * * * * rsync -az --delete /var/www/bitrix/upload/ ekb-storage:/var/www/bitrix/upload/. Uploading files on regional nodes is prohibited—all uploads proxy to the master region.

When integrating with 1C via CommerceML, file exchange must occur through the master region.

Redis: Distributed Sessions and Cache

User sessions must be available on any node. We use Redis with replication (Sentinel or Cluster). Redis with replication gives session read latency up to 1 ms, which is 50x faster than file-based sessions (50 ms). Configuration in /bitrix/.settings.php:

'session' => [
    'value' => [
        'mode' => 'separated',
        'handlers' => [
            'general' => [
                'type' => 'redis',
                'host' => '10.0.1.20',  // Redis MSK (master)
                'port' => 6379,
            ],
        ],
    ],
],
'cache' => [
    'value' => [
        'type' => 'redis',
        'redis' => [
            'host' => '10.0.1.20',
            'port' => 6379,
        ],
        'sid' => 'bitrix_geo',
    ],
],

Cache can be stored locally in each region; sessions must be in the master region or in a Redis Cluster with cross-region replication.

Regionalizable Operations

Operation Can run on regional node Notes
Catalog reads Yes From DB replica
Product page, category Yes From cache or replica
Search Yes Elasticsearch with replication
Add to cart No Master only
Checkout No Master + master DB
File upload No Only S3 or master node
Authorization No Sessions via master Redis

For a Bitrix store, catalog pages are served from the nearest region, checkout is always proxied to the master region. Split-routing is implemented at the nginx level:

location /bitrix/components/bitrix/sale. {
    proxy_pass http://msk_master;  # orders always to MSK
}

location / {
    proxy_pass http://geo_cluster;  # rest to nearest node
}

Scope of Work

Geo-cluster deployment includes: architecture design, deployment of DB replication, Redis cluster, file synchronization, GeoDNS, load balancer, load testing, and disaster recovery drill. We also provide documentation, access credentials, and training for your engineers. Geo-cluster setup project cost: $12,000 to $18,000 depending on complexity. Contact us for a preliminary assessment of your project. We guarantee a custom approach.

Setup Timeline

Stage Content Duration
Architecture design Scheme, technology decisions, RPO/RTO agreement 2–3 days
DB replication setup GTID, lag monitoring, failover test 2–3 days
Redis + sessions setup Sentinel/Cluster, .settings.php 1–2 days
File synchronization S3 or rsync + nginx configs 1–2 days
GeoDNS + load balancer Cloudflare/Route53, split-routing nginx 1–2 days
Load testing and drill Failover verification, latency measurement 2–3 days

Typical problems in multi-region clustering: replication lag >500 ms (solved by optimizing the link and MySQL settings), file conflicts during two-way sync (prevent by prohibiting uploads on regional nodes), Redis split-brain during disconnection (monitoring and manual failover).

Additional Configuration DetailsFor deeper tuning, refer to the Bitrix cluster documentation Bitrix Cluster Module Guide. The recommended Redis Sentinel setup includes three nodes per region.

Geo-cluster deployment is suitable for both 1C-Bitrix websites and Bitrix24 corporate portals. We guarantee a custom approach tailored to your infrastructure.

1C-Bitrix Clustering

Imagine: a flash sale, 10,000 users simultaneously on the site, the server goes down with a 502 error, carts disappear, managers call support. We have seen this dozens of times. The solution is clustering: load balancing between servers, database replication, and automatic failover. Order an audit of your current infrastructure — in 2 days we will determine if and what kind of cluster is needed. Our experience: 40+ high-load projects on Bitrix.

Why is 1C-Bitrix clustering critical for fault tolerance?

80-90% of requests in a typical project are SELECT. Catalog, product pages, filters — all reads. Master-slave replication routes SELECTs to slave servers, leaving the master for writes only. The 'Web Cluster' module (Business edition and higher) routes requests automatically.

Common stumbling blocks: on master binlog_format = ROW. STATEMENT-based replication with NOW() or UUID() causes inconsistencies — leading to a week of debugging. Unique server-id, binary log enabled. On slave — read_only = ON, relay-log. Initialization via xtrabackup (not mysqldump, which locks tables for half an hour on a 20 GB database).

Metric #1 — Seconds_Behind_Master. If a slave lags by 5+ seconds, a customer places an order, returns to their personal account — and the order is missing (SELECT went to a lagging slave). The module allows manual exclusion of critical queries from slave routing.

Failover: Orchestrator or ProxySQL promote a slave to master in 15-30 seconds. The module supports up to 9 slave connections with configurable weights. Integrity check — pt-table-checksum from Percona Toolkit. Savings from inefficient infrastructure can be up to 40% of the budget, representing a significant annual amount for projects with 50,000+ unique visitors. For more information on replication, refer to MySQL Replication Documentation and Wikipedia: Database Replication.

When is clustering necessary?

Not every project needs it. Specific markers:

  • 50,000-100,000 unique visitors per day — a single server starts returning 502 errors during peak hours
  • Peak spikes of 5-10 times (sales, flash sales) — load grows in minutes, vertical scaling is not enough
  • SLA 99.9% (no more than 8.7 hours of downtime per year) — unattainable with a single server
  • Geographic distribution of users

Sometimes composite caching, SQL optimization, and vertical scaling are sufficient. We will honestly tell you if a cluster is not yet needed. Investments in clustering typically pay off within 3-6 months under peak loads. The average project budget is determined individually.

What does the cluster architecture consist of?

Load balancer. HAProxy, nginx upstream, or cloud LB. Round-robin for even distribution, ip-hash for session stickiness, least connections for adaptive balancing. Health checks remove dead servers from the pool. SSL termination on the balancer offloads web nodes.

Web servers. Identical nginx + php-fpm, each with a full copy of the code. Sessions in Redis/Memcached, not on disk (otherwise users lose their cart when switching servers). In the cloud — auto-scaling: load increases — servers are added, load decreases — they are removed.

Cache. Redis Cluster with data sharding across nodes. Redis Sentinel for small clusters. Memcached is fast but lacks persistence. Configuration in .settings.php — servers, weights, sharding strategy.

File storage. Uploads, images — accessible from each node. NFS for 2-3 servers, but it is a single point of failure. GlusterFS — distributed file system without single point of failure. S3 (MinIO, AWS, Yandex Object Storage) — offload static files to object storage, the Bitrix module works out of the box.

How to ensure failover at each cluster level?

Level Mechanism RTO
Load balancer Keepalived + VRRP < 5 sec
Web servers Health check < 10 sec
MySQL master Orchestrator / ProxySQL < 30 sec
MySQL slave Removal from pool < 5 sec
Redis Sentinel / Cluster failover < 15 sec
Files GlusterFS replication Automatic

The cluster is 5 times more reliable than a single server — if any node fails, the service continues to operate.

What are common clustering setup mistakes?

  • Sessions on files — when a server goes down, users lose cart and authentication.
  • Unmonitored Seconds_Behind_Master — sales suffer and SLA is unmet.
  • Single point of failure at the file storage level (NFS without replication).
  • Lack of replication monitoring — data inconsistencies go undetected.

We include checks for all these points in our audit and testing.

What is the clustering process?

  1. Load audit — load profile, bottlenecks, load testing. We find the ceiling of a single server.
  2. Design — components tailored to requirements and budget. Not everyone needs GlusterFS — sometimes NFS and backups suffice.
  3. Infrastructure — servers, network, firewalls. Ansible for automation — any node can be recreated in minutes.
  4. Migration — transfer with minimal downtime. Components are connected sequentially, each step verified.
  5. Testing — simulation of peak conditions. We crash the master, disconnect a web server, kill Redis — see how the system behaves.
  6. Documentation — architecture diagram, runbook, disaster recovery plans.

What does clustering work include?

Deliverable Description
Current load audit Request profile, bottlenecks, load testing
Project documentation Architecture diagram, runbook, disaster recovery plan
Infrastructure Server, network, firewall setup (Ansible)
Migration Transfer with minimal downtime, phased component connection
Testing Simulation of peak conditions: crash master, disconnect web server, kill Redis
Team training Documentation, 2 weeks of post-implementation consultations
Warranty 6 months of correct cluster operation — if something goes wrong, we fix it within 24 hours

What are the typical timelines?

Task Timeline
Audit and design 1-2 weeks
Basic cluster (2 web + master-slave MySQL) 2-3 weeks
Full cluster with failover at all levels 4-6 weeks
Monitoring + load testing 2-4 weeks

Contact us to get an engineer consultation and a preliminary project estimate within 2 days. We will calculate the cost based on your specific needs. Order an audit to find out the exact architecture and budget.