Symptoms

Failed task: Update PowerDns server failed as following:

Operation with storage caused error: 'domain.tld.(): Operation with storage caused error: 'Domain not found'

Cause

The situation could be caused by the following points:

Resolution

You can use either of the following solutions:

  1. Use the following KB article to manually insert the missing domain in the PowerDNS database.
  2. Sync the domains between name servers using the API call pem.syncNameServers.xml:

Get the domain hosting details using the following SQL query:

# psql -U plesk -h -t -c "SELECT name FROM domains WHERE domain_id IN (SELECT domain_id FROM domain_hosting_bindings WHERE dhtype = 'NS Hosting');" > /path/to/domains.list

Make sure that count matches:

# wc -l domains.list
# psql -U plesk -h -c "SELECT count(name) FROM domains WHERE domain_id IN (SELECT domain_id FROM domain_hosting_bindings WHERE dhtype = 'NS Hosting');

Create the API XML file and sync the domains across name servers as following:

# cat /path/to/pem.syncNameServers.xml
<?xml version="1.0"?>
<methodCall>
<methodName>pem.syncNameServers</methodName>
<params>
    <param>
      <value>
        <struct>
          <member>
            <name>domain_name</name>
            <value><string>DOMAIN_NAME</string></value>
          </member>
        </struct>
      </value>
    </param>
</params>
</methodCall>

Run the following script on the management node to propagate all domains to all nameservers.

#!/bin/bash
# Script to Transfer Existing Zone files to Newly Deployed Name Servers

# Get the list of domains hosted in OA
psql -U plesk -d plesk -h OA_DATABASE_HOST_IP -t -c "SELECT name FROM domains" > domains.list

# Filter Spaces and Unwanted strings
egrep -v "[0-9]*rows|^$" domains.list > domain_final.list

# Sync the zone files to newly deployed name servers.
for i in `cat domain_final.list`
do
  cp -av pem.syncNameServers.xml pem.syncNameServers_act.xml;
        sed -i 's/DOMAIN_NAME/'$i'/' pem.syncNameServers_act.xml;
        curl -d@pem.syncNameServers_act.xml http://localhost:8440/RPC2 >> /var/log/pem_syncNameServers.log 2>> /var/log/pem_syncNameServers_error.log;
        rm -vf pem.syncNameServers_act.xml;
        sleep 10;
done

Please note that because of significant number of domains script execution can cause serious resource consumption on the management node. Check current load level with generic Linux utilities (#top #free -m and so on) prior to executing script. If it is significantly loaded - increase sleep parameter in the script up to 60. Every API call will be executed with 60 seconds interval in this case, it will help to avoid system overload, but require more time for script execution.

Internal content