7.6. 导入区域
将区域数据导入到 Red Hat OpenStack Platform (RHOSP) DNS 服务中包括对符合 DNS 区数据文件格式的文件运行 openstack zone import 命令,如从 openstack zone export showfile 命令生成的文件。导入数据的一个原因是用户意外删除区。
先决条件
- 您的 RHOSP 项目必须拥有创建子区的区域,或者区必须是允许的 TLD。
- 您要导入的区必须尚不存在。
- 您要导入的区数据必须包含区 TTL (实时)值。
流程
提供您的凭据文件。
Example
$ source ~/overcloudrc列出系统中的区:
$ openstack zone list如果要导入的区域已存在,则必须首先通过运行
openstack zone delete命令删除它。Example
$ openstack zone delete example.com.通过列出系统中的区来确认您的区不再存在:
$ openstack zone list确认您要导入的区域数据包含区 TTL 值。
示例
$ cat /home/stack/zone_file输出示例
$ORIGIN example.com. $TTL 3000 example.com. IN NS test.example.com. example.com. IN SOA test.example.com. admin.example.com. 1624415706 9000 500 86000 5000 www.example.com. IN A 192.0.2.2 test.example.com. IN NS test.example.com.导入有效的区数据文件。
Example
$ openstack zone import create /home/stack/zone_file
验证
确认 DNS 服务已成功导入区域。
Example
$ openstack recordset list -c name -c type -c records -c status example.com.输出示例
+-------------------+------+---------------------------------------------------------------------+--------+ | name | type | records | status | +-------------------+------+---------------------------------------------------------------------+--------+ | example.com. | SOA | ns1.example.com. admin.example.com. 1624415706 3582 500 86000 3600 | ACTIVE | | test.example.com. | NS | test.example.com. | ACTIVE | | example.com. | NS | ns1.example.com. | ACTIVE | | www.example.com. | A | 192.0.2.2 | ACTIVE | +-------------------+------+---------------------------------------------------------------------+--------+