DNS Load Balancer
By using Arvancloud's DNS Load Balancer feature, you can distribute the traffic of your domains or subdomains among your servers based on weight, type, and geographic location.
To activate this feature, after selecting the domain from the user panel, click on DNS Records and create a new A record.
In the Name field, enter the hostname (subdomain) you want. If the record is related to the root of the domain, you should enter the value "@" in this field, and if it is related to a specific subdomain, enter its name.
Then enter your desired IPs in the value section.
In the Response Type section, specify whether to respond with one IP or multiple IPs in the DNS resolution process.
In the Load Balancing field, you need to specify the method of this process. Traffic can be distributed among them in turn or in addition to turn, taking into account the weight of each server.
The weight is the traffic distribution ratio between two servers. That is, their value is not important and only their ratio is important. For example, the values of 1 and 2 are not different from 10 and 20.
Define your Load Balancing strategy for each geographic location. Arvancloud gives you the ability to distribute your traffic according to the geographical area of the user.
With country-based load balancing enabled, you must select the desired country for each IP.
Finally, click on save.
To create this record using the 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}'