3.2. 使用命令行将现有服务器配置为新服务器的供应商
要准备现有的服务器 provider1.example.com
作为供应商,您需要:
- 为后缀启用复制。
- 创建对新供应商的复制协议。
- 初始化新供应商。
在复制拓扑中的现有供应商上执行这个步骤。
先决条件
-
为要加入的供应商上的
dc=example,dc=com
后缀启用复制。
流程
为
dc=example,dc=com
后缀启用复制:dsconf <supplier1_instance_name> replication enable --suffix "dc=example,dc=com" --role "supplier" --replica-id 2 --bind-dn "cn=replication manager,cn=config" --bind-passwd "password"
# dsconf <supplier1_instance_name> replication enable --suffix "dc=example,dc=com" --role "supplier" --replica-id 2 --bind-dn "cn=replication manager,cn=config" --bind-passwd "password"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 此命令将 provider
1.example.com
主机配置为dc=example,dc=com
后缀的供应商,并将此条目的副本 ID 设置为2
。另外,命令使用指定密码创建cn=replication manager,cn=config
用户,并允许此帐户将后缀的更改复制到此主机上。重要副本 ID 必须是拓扑中所有供应商的后缀
1
到65534
之间的唯一整数。添加复制协议并初始化新服务器:
dsconf <supplier1_instance_name> repl-agmt create --suffix "dc=example,dc=com" --host "supplier2.example.com" --port 389 --conn-protocol LDAP --bind-dn "cn=replication manager,cn=config" --bind-passwd "password" --bind-method SIMPLE --init example-agreement-supplier1-to-supplier2
# dsconf <supplier1_instance_name> repl-agmt create --suffix "dc=example,dc=com" --host "supplier2.example.com" --port 389 --conn-protocol LDAP --bind-dn "cn=replication manager,cn=config" --bind-passwd "password" --bind-method SIMPLE --init example-agreement-supplier1-to-supplier2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 此命令创建一个名为
example-agreement-supplier1-to-supplier2
的复制协议。复制协议定义设置,如供应商在连接和将数据复制到新供应商时使用的新供应商主机名、协议和身份验证信息。创建协议后,目录服务器会初始化 provider
2.example.com
。根据要复制的数据量,初始化过程可能会非常耗时。
验证
显示复制配置:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 这些参数表示:
-
nsDS5ReplicaBindDN
指定复制管理器帐户。 -
nsDS5ReplicaRoot
设置复制的后缀。 -
nsDS5ReplicaType
设置为3
定义此主机是一个供应商。
-
验证初始化是否成功:
dsconf <supplier1_instance_name> repl-agmt init-status --suffix "dc=example,dc=com" example-agreement-supplier1-to-supplier2
# dsconf <supplier1_instance_name> repl-agmt init-status --suffix "dc=example,dc=com" example-agreement-supplier1-to-supplier2 Agreement successfully initialized.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 显示复制状态:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 验证
Replication Status
和Last Update Status
字段。
故障排除
默认情况下,服务器上所有协议的复制闲置超时为 1 小时。如果因为超时而初始化大型数据库失败,请将
nsslapd-idletimeout
参数设置为更高的值。例如,要将参数设置为7200
(2 小时),请输入:dsconf <supplier1_instance_name> config replace nsslapd-idletimeout=7200
# dsconf <supplier1_instance_name> config replace nsslapd-idletimeout=7200
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 要设置无限周期,请将
nsslapd-idletimeout
设置为0。