6.4. 使用命令行将 hub 服务器配置为消费者的供应商
要准备 hub,您需要:
- 创建到消费者的复制协议。
- 初始化消费者。
在复制拓扑的 hub 上执行这个步骤。
前提条件
- hub 被初始化,从供应商复制到 hub 可以正常工作。
-
您在 hub 上为
dc=example,dc=com
后缀启用复制。
流程
添加复制协议并初始化消费者:
#
dsconf -D "cn=Directory Manager" ldap://hub.example.com repl-agmt create --suffix "dc=example,dc=com" --host "consumer.example.com" --port 389 --conn-protocol LDAP --bind-dn "cn=replication manager,cn=config" --bind-passwd "password" --bind-method SIMPLE --init example-agreement-hub-to-consumer
此命令创建一个名为
example-agreement-hub-to-consumer
的复制协议。复制协议定义设置,如消费者的主机名、协议和身份验证信息,如供应商在将数据连接和复制到此消费者时使用的身份验证信息。创建协议后,目录服务器会初始化
consumer.example.com
。根据要复制的数据量,初始化可能会非常耗时。
验证
验证初始化是否成功:
#
dsconf -D "cn=Directory Manager" ldap://hub.example.com repl-agmt init-status --suffix "dc=example,dc=com" example-agreement-hub-to-consumer
Agreement successfully initialized.显示复制状态:
#
dsconf -D "cn=Directory Manager" ldap://hub.example.com repl-agmt status --suffix "dc=example,dc=com" example-agreement-hub-to-consumer
Status For Agreement: "example-agreement-hub-to-consumer" (consumer.example.com:389) Replica Enabled: on Update In Progress: FALSE Last Update Start: 20210331131534Z Last Update End: 20210331131534Z Number Of Changes Sent: 0 Number Of Changes Skipped: None Last Update Status: Error (0) Replica acquired successfully: Incremental update succeeded Last Init Start: 20210331131530Z Last Init End: 20210331131533Z Last Init Status: Error (0) Total update succeeded Reap Active: 0 Replication Status: Not in Synchronization: supplier (Unknown) consumer (Unknown) State (green) Reason (error (0) replica acquired successfully: incremental update succeeded) Replication Lag Time: Unavailable验证
Replication Status
和Last Update Status
字段。
故障排除
默认情况下,服务器上所有协议的复制闲置超时为 1 小时。如果因为超时而导致大型数据库的初始化失败,请将
nsslapd-idletimeout
参数设置为更高的值。例如,要将参数设置为7200
(2 小时),请输入:#
dsconf -D "cn=Directory Manager" ldap://hub .example.com config replace nsslapd-idletimeout=7200
要设置无限周期,请将
nsslapd-idletimeout
设置为0。