Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 69d9f6a

Browse files
committed
EOS17969 Integrate Delta replication into 3 node replication
1 parent 6346d5f commit 69d9f6a

8 files changed

Lines changed: 269 additions & 0 deletions

installhelper.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ cp -f scripts/ldap/replication/setupReplicationScript.sh $S3_INSTALL_LOCATION/in
237237
cp -f scripts/ldap/replication/serverIdTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
238238
cp -f scripts/ldap/replication/configTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
239239
cp -f scripts/ldap/replication/dataTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
240+
cp -f scripts/ldap/replication/syncprov_delta.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
241+
cp -f scripts/ldap/replication/index_delta.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
242+
cp -f scripts/ldap/replication/accesslog_config_delta.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
243+
cp -f scripts/ldap/replication/deltaConfigTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
240244

241245

242246
# Copy check replication script to install location

rpms/s3/s3rpm.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ rm -rf %{buildroot}
373373
/opt/seagate/cortx/s3/bin/cleanupcmd.py
374374
/opt/seagate/cortx/s3/bin/ldapaccountaction.py
375375
/opt/seagate/cortx/s3/bin/merge.py
376+
/opt/seagate/cortx/s3/install/ldap/replication/accesslog_config_delta.ldif
377+
/opt/seagate/cortx/s3/install/ldap/replication/deltaConfigTemplate.ldif
378+
/opt/seagate/cortx/s3/install/ldap/replication/index_delta.ldif
379+
/opt/seagate/cortx/s3/install/ldap/replication/syncprov_delta.ldif
376380
%attr(755, root, root) /opt/seagate/cortx/s3/bin/s3_setup
377381
%attr(755, root, root) /opt/seagate/cortx/s3/bin/_s3_setup
378382
%attr(755, root, root) /opt/seagate/cortx/s3/s3backgrounddelete/s3backgroundconsumer
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# For any questions about this software or licensing,
17+
# please email opensource@seagate.com or cortx-questions@seagate.com.
18+
dn: olcOverlay={1}syncprov,olcDatabase={2}mdb,cn=config
19+
objectClass: olcSyncProvConfig
20+
objectClass: olcOverlayConfig
21+
olcOverlay: {1}syncprov
22+
olcSpCheckpoint: 100 10
23+
olcSpSessionlog: 10000
24+
25+
dn: olcDatabase={1}mdb,cn=config
26+
objectClass: olcMdbConfig
27+
objectClass: olcDatabaseConfig
28+
olcDatabase: {1}mdb
29+
olcDbDirectory: /var/lib/ldap/accesslog
30+
olcDbIndex: default eq
31+
olcDbIndex: objectClass eq
32+
olcDbIndex: entryCSN eq
33+
olcDbIndex: reqDN eq
34+
olcDbIndex: reqStart eq
35+
olcDbIndex: reqEnd eq
36+
olcDbIndex: reqResult eq
37+
olcDbMaxReaders: 0
38+
olcDbMaxSize: 5120000
39+
olcRootDN: cn=config
40+
olcSuffix: cn=accesslog
41+
42+
dn: olcOverlay={0}syncprov,olcDatabase={1}mdb,cn=config
43+
objectClass: olcSyncProvConfig
44+
objectClass: olcOverlayConfig
45+
olcOverlay: {0}syncprov
46+
olcSpNoPresent: TRUE
47+
olcSpReloadHint: TRUE
48+
49+
dn: olcOverlay={0}accesslog,olcDatabase={4}mdb,cn=config
50+
objectClass: olcAccessLogConfig
51+
objectClass: olcOverlayConfig
52+
olcAccessLogDB: cn=accesslog
53+
olcOverlay: {0}accesslog
54+
olcAccessLogOps: writes
55+
olcAccessLogPurge: 24:00 1+00:00
56+
olcAccessLogSuccess: TRUE
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
olcSyncrepl: rid=00${rid}
2+
provider=ldap://${provider}:389/
3+
bindmethod=simple
4+
binddn="cn=admin,dc=seagate,dc=com"
5+
credentials=${credentials}
6+
searchbase="dc=seagate,dc=com"
7+
logbase="cn=accesslog"
8+
logfilter="(&(objectClass=auditWriteObject)(reqResult=0))"
9+
schemachecking=on
10+
type=refreshAndPersist
11+
retry="60 +"
12+
syncdata=accesslog
13+
network-timeout=30
14+
keepalive=180:3:60
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# For any questions about this software or licensing,
17+
# please email opensource@seagate.com or cortx-questions@seagate.com.
18+
#
19+
# syncprov overlay module file
20+
# Command to add module to ldap:
21+
# ldapadd -Y EXTERNAL -H ldapi:/// -f index_delta.ldif
22+
dn: olcDatabase={2}mdb,cn=config
23+
changetype: modify
24+
add: olcDbIndex
25+
olcDbIndex: entryCSN eq
26+
-
27+
add: olcDbIndex
28+
olcDbIndex: entryUUID eq
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash -e
2+
#
3+
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# For any questions about this software or licensing,
18+
# please email opensource@seagate.com or cortx-questions@seagate.com.
19+
#
20+
##################################
21+
# Configure ldap-replication
22+
##################################
23+
usage() { echo "Usage: [-h <file containing hostnames of nodes in cluster>] [-p <rootDN password>]" 1>&2; exit 1; }
24+
25+
while getopts ":h:p:" o; do
26+
case "${o}" in
27+
h)
28+
host_list=${OPTARG}
29+
;;
30+
p)
31+
password=${OPTARG}
32+
;;
33+
*)
34+
usage
35+
;;
36+
esac
37+
done
38+
shift "$((OPTIND-1))"
39+
40+
if [ -z ${host_list} ] || [ -z ${password} ]
41+
then
42+
usage
43+
exit 1
44+
fi
45+
46+
INSTALLDIR="/opt/seagate/cortx/s3/install/ldap/replication"
47+
48+
# checkHostValidity will check if all provided hosts are valid and reachable
49+
checkHostValidity()
50+
{
51+
while read host; do
52+
isValid=$(ping -c 1 ${host} | grep bytes | wc -l)
53+
if [ "$isValid" -le 1 ]
54+
then
55+
echo "ERROR: $host is either invalid or not reachable."
56+
exit
57+
else
58+
echo "INFO: $host is valid and reachable."
59+
fi
60+
done < "$host_list"
61+
}
62+
63+
# Check if hosts are valid
64+
checkHostValidity
65+
66+
# getServerIdFromHostFile will generate serverid from host list provided
67+
id=1
68+
getServerIdFromHostFile()
69+
{
70+
while read host; do
71+
if [ "$host" == "$HOSTNAME" ]
72+
then
73+
break
74+
fi
75+
id=$(expr ${id} + 1)
76+
done < "$host_list"
77+
}
78+
79+
# update serverID
80+
getServerIdFromHostFile
81+
82+
sed -e "s/\${serverid}/$id/" $INSTALLDIR/serverIdTemplate.ldif > scriptServerId.ldif
83+
ldapmodify -Y EXTERNAL -H ldapi:/// -f scriptServerId.ldif
84+
rm scriptServerId.ldif
85+
86+
ldapadd -Y EXTERNAL -H ldapi:/// -f $INSTALLDIR/syncprov_delta.ldif
87+
ldapadd -Y EXTERNAL -H ldapi:/// -f $INSTALLDIR/index_delta.ldif
88+
89+
# update replication config
90+
echo "dn: olcDatabase={2}mdb,cn=config" > scriptConfig.ldif
91+
echo "changetype: modify" >> scriptConfig.ldif
92+
echo "add: olcSyncRepl" >> scriptConfig.ldif
93+
rid=1
94+
while read host; do
95+
if [ "$host" != "$HOSTNAME" ]
96+
then
97+
sed -e "s/\${rid}/$rid/" -e "s/\${provider}/$host/" -e "s/\${credentials}/$password/" $INSTALLDIR/deltaConfigTemplate.ldif >> scriptConfig.ldif
98+
rid=`expr ${rid} + 1`
99+
fi
100+
done <$host_list
101+
102+
echo "-" >> scriptConfig.ldif
103+
echo "add: olcMirrorMode" >> scriptConfig.ldif
104+
echo "olcMirrorMode: TRUE" >> scriptConfig.ldif
105+
106+
ldapmodify -Y EXTERNAL -H ldapi:/// -f scriptConfig.ldif
107+
rm scriptConfig.ldif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash -e
2+
#
3+
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# For any questions about this software or licensing,
18+
# please email opensource@seagate.com or cortx-questions@seagate.com.
19+
#
20+
##################################
21+
# Configure ldap-replication
22+
##################################
23+
24+
INSTALLDIR="/opt/seagate/cortx/s3/install/ldap/replication"
25+
mkdir /var/lib/ldap/accesslog
26+
chmod 777 /var/lib/ldap/accesslog
27+
28+
ldapadd -Y EXTERNAL -H ldapi:/// -f $INSTALLDIR/accesslog_config_delta.ldif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# For any questions about this software or licensing,
17+
# please email opensource@seagate.com or cortx-questions@seagate.com.
18+
#
19+
# syncprov overlay module file
20+
# Command to add module to ldap:
21+
# ldapadd -Y EXTERNAL -H ldapi:/// -f syncprov_mod.ldif
22+
dn: cn=module{0},cn=config
23+
changetype: modify
24+
add: olcModuleLoad
25+
olcModuleLoad: syncprov.la
26+
-
27+
add: olcModuleLoad
28+
olcModuleLoad: accesslog.la

0 commit comments

Comments
 (0)