8.2. 创建记录集
默认情况下,任何用户都可以创建 Red Hat OpenStack Platform DNS 服务(designate)记录集。
先决条件
- 您的项目必须拥有一个要在其中创建记录集的区域。
流程
提供您的凭据文件。
示例
$ source ~/overcloudrc您可以使用
openstack recordset create命令创建记录集。记录集需要区域、名称、类型和数据。Example
$ openstack recordset create --type A --record 192.0.2.1 example.com. www注意使用完全限定域名(FQDN)时,需要结尾的点(
.)。如果省略结尾的点,则生成的记录名称会在生成的记录名称中重复,例如www.example.com.example.com。在前面的示例中,用户已创建一个名为
example.com的区域。因为记录设置名称www不是 FQDN,所以 DNS 服务会将它添加到区名称中。您可以使用记录设置 name 参数的 FQDN 来达到相同的结果:$ openstack recordset create --type A --record 192.0.2.1 example.com. www.example.com.如果要构建超过字符字符串的最大长度(255 个字符)的 TXT 记录集,那么在创建记录集合时,您必须将字符串分成多个较小的字符串。
在本例中,用户会创建一个 TXT 记录集(
_domainkey.example.com),该记录包含一个 410 字符字符串,方法是指定小于 255 个字符的两个字符串:$ openstack recordset create --type TXT --record '"210 characters string" "200 characters string"' example.com. _domainkey您可以多次提供--
record参数,以便在记录集中创建多个记录。多记录参数的典型用途是 round-robin DNS。Example
$ openstack recordset create --type A --record 192.0.2.1 --record 192.0.2.2 example.com. web
验证
运行 list 命令来验证您创建的记录集是否存在:
示例
$ openstack recordset list -c name -c type -c records example.com.输出示例
+------------------+------+----------------------------------------------+ | name | type | records | +------------------+------+----------------------------------------------+ | example.com. | SOA | ns1.example.net. admin.example.com 162001261 | | | | 6 3599 600 86400 3600 | | | | | | example.com. | NS | ns1.example.net. | | | | | | web.example.com. | A | 192.0.2.1 192.0.2.2 | | | | | | www.example.com. | A | 192.0.2.1 | +------------------+------+----------------------------------------------+