DNS Load Balancing
With Arvancloud DNS load balancing, you can distribute the traffic of your domains or subdomains among your servers based on weight, round robin, and geographic region.
To enable this feature, select your domain in the panel, click DNS Records, and create a new A record.
-
In Name, enter the hostname (subdomain name) you want. If the record is for the root of the domain, enter "@" in the Name field; if it is for a specific subdomain, enter its name.
-
In Value, enter the IPs for this subdomain.
-
In Response Type, specify whether Arvancloud returns one IP or several IPs during DNS resolution.
-
In the Load Balancing field, specify the method. Traffic can be distributed among the servers in round robin, or in round robin while also considering each server's weight.
Weight is the ratio of traffic distribution between servers. That is, the values themselves don't matter, only their ratio. For example, the values 1 and 2 are no different from 10 and 20.
-
Specify your load balancing strategy for each geographic location. Arvancloud lets you distribute your traffic based on the user's geographic region.
When you enable country-based load balancing, you need to select the country for each IP.
Finally, click Save.
To create this record via API, you can use the following request:
curl --location --request POST
'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/dns-records' \
--header 'authority: napi.arvancloud.ir' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: APIKEY 1 2 3 4' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json;charset=UTF-8' \
--header 'dnt: 1' \
--data-raw
'{"type":"A","name":"@","cloud":false,"value":[{"country":"","ip":"192.168.1.1","port":null,"weight":"20"},{"country":"SG","ip":"192.168.1.2","port":null,"weight":"10"},{"country":"AU","ip":"192.168.1.3","port":null,"weight":"50"}],"upstream_https":"default","ip_filter_mode":{"count":"single","geo_filter":"country","order":"weighted"},"ttl":120}'