3.2. 使用命令行将现有服务器配置为新服务器的供应商
要准备现有服务器 provider 1.example.com
作为供应商,您需要:
- 为后缀启用复制。
- 为新供应商创建复制协议。
- 初始化新供应商。
在复制拓扑中的现有供应商上执行这个步骤。
前提条件
-
您在供应商上启用了
dc=example,dc=com
后缀的复制来加入。
流程
为
dc=example,dc=com
后缀启用复制:#
dsconf -D "cn=Directory Manager" ldap://supplier1.example.com replication enable --suffix "dc=example,dc=com" --role "supplier" --replica-id 2 --bind-dn "cn=replication manager,cn=config" --bind-passwd "password"
此命令将 provider
1.example.com
主机配置为dc=example,dc=com
后缀的供应商,并将此条目的副本 ID 设置为2
。此外,命令还会创建具有指定密码的cn=replication managercn=config
用户,并允许此帐户将后缀更改复制到此主机。重要对于拓扑中的所有供应商,副本 ID 必须是
1
到65534
之间的唯一整数。添加复制协议并初始化新的服务器:
#
dsconf -D "cn=Directory Manager" ldap://supplier1.example.com 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
此命令创建一个名为
example-agreement-supplier1-to-supplier2
的复制协议。复制协议定义设置,如供应商的主机名、协议和身份验证信息,供应商在将数据连接并复制到新供应商时使用的身份验证信息。创建协议后,目录服务器会初始化 vendor
2.example.com
。根据要复制的数据量,初始化可能会非常耗时。
验证
显示复制配置:
#
dsconf -D "cn=Directory Manager" ldap://supplier1.example.com replication get --suffix "dc=example,dc=com"
dn: cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config ... nsDS5ReplicaBindDN: cn=replication manager,cn=config nsDS5ReplicaRoot: dc=example,dc=com nsDS5ReplicaType: 3 ...这些参数表示:
-
nsDS5ReplicaBindDN
指定复制管理器帐户。 -
nsDS5ReplicaRoot
设置复制的后缀。 -
nsDS5ReplicaType
设置为3
定义此主机是一个供应商。
-
验证初始化是否成功:
#
dsconf -D "cn=Directory Manager" ldap://supplier1.example.com repl-agmt init-status --suffix "dc=example,dc=com" example-agreement-supplier1-to-supplier2
Agreement successfully initialized.显示复制状态:
#
dsconf -D "cn=Directory Manager" ldap://supplier1.example.com repl-agmt status --suffix "dc=example,dc=com" example-agreement-supplier1-to-supplier2
Status For Agreement: "example-agreement-supplier1-to-supplier2" (supplier2.example.com:389) Replica Enabled: on Update In Progress: FALSE Last Update Start: 20210331071545Z Last Update End: 20210331071546Z Number Of Changes Sent: 2:1/0 Number Of Changes Skipped: None Last Update Status: Error (0) Replica acquired successfully: Incremental update succeeded Last Init Start: 20210331071541Z Last Init End: 20210331071544Z Last Init Status: Error (0) Total update succeeded Reap Active: 0 Replication Status: Not in Synchronization: supplier (6064219e000100020000) consumer (Unavailable) State (green) Reason (error (0) replica acquired successfully: incremental update succeeded)验证
Replication Status
和Last Update Status
字段。
故障排除
默认情况下,服务器上所有协议的复制闲置超时为 1 小时。如果因为超时而导致大型数据库的初始化失败,请将
nsslapd-idletimeout
参数设置为更高的值。例如,要将参数设置为7200
(2 小时),请输入:#
dsconf -D "cn=Directory Manager" ldap://supplier1.example.com config replace nsslapd-idletimeout=7200
要设置无限周期,请将
nsslapd-idletimeout
设置为0。