LDAP + Gerrit搭建code review系统(四) --- backup备份

本文介绍了如何为LDAP和Gerrit系统设置备份,确保用户和群组定义、git目录以及code review记录的安全。内容包括LDAP的provider-consumer模式增量备份、Gerrit的replication插件配置以及MySQL的主从复制。此外,还提到了Gerrit的索引刷新以显示最新数据。
摘要由CSDN通过智能技术生成

对于任何一个正式使用的系统,备份都是非常重要的任务。在这个LDAP+Gerrit的系统中,有三部分的内容需要备份:LDAP中的用户和群组定义,Gerrit中的git目录,以及mysql中的code review记录。

1. LDAP备份(LDAP Replication)

这是一个使用provider-consumer模式的增量备份方案,provider的任何变动都会立刻备份到consumer上。具体内容详见https://help.ubuntu.com/lts/serverguide/openldap-server.html

Provider Configuration

Begin by configuring the Provider.

  1. Create an LDIF file with the following contents and name it provider_sync.ldif:

    # Add indexes to the frontend db.
    dn: olcDatabase={1}hdb,cn=config
    changetype: modify
    add: olcDbIndex
    olcDbIndex: entryCSN eq
    -
    add: olcDbIndex
    olcDbIndex: entryUUID eq
    
    #Load the syncprov and accesslog modules.
    dn: cn=module{0},cn=config
    changetype: modify
    add: olcModuleLoad
    olcModuleLoad: syncprov
    -
    add: olcModuleLoad
    olcModuleLoad: accesslog
    
    # Accesslog database definitions
    dn: olcDatabase={2}hdb,cn=config
    objectClass: olcDatabaseConfig
    objectClass: olcHdbConfig
    olcDatabase: {2}hdb
    olcDbDirectory: /var/lib/ldap/accesslog
    olcSuffix: cn=accesslog
    olcRootDN: cn=admin,dc=example,dc=com
    olcDbIndex: default eq
    olcDbIndex: entryCSN,objectClass,reqEnd,reqResult,reqStart
    
    # Accesslog db syncprov.
    dn: olcOverlay=syncprov,olcDatabase={2}hdb,cn=config
    changetype: add
    objectClass: olcOverlayConfig
    objectClass: olcSyncProvConfig
    olcOverlay: syncprov
    olcSpNoPresent: TRUE
    olcSpReloadHint: TRUE
    
    # syncrepl Provider for primary db
    dn: olcOverlay=syncprov,olcDatabase={1}hdb,cn=config
    changetype: add
    objectClass: olcOverlayConfig
    objectClass: olcSyncProvConfig
    olcOverlay: syncprov
    olcSpNoPresent: TRUE
    
    # accesslog overlay definitions for primary db
    dn: olcOverlay=accesslog,olcDatabase={1}hdb,cn=config
    objectClass: olcOverlayConfig
    objectClass: olcAccessLogConfig
    olcOverlay: accesslog
    olcAccessLogDB: cn=accesslog
    olcAccessLogOps: writes
    olcAccessLogSuccess: TRUE
    # scan the accesslog DB every day, and purge entries older than 7 days
    olcAccessLogPurge: 07+00:00 01+00:00
    

    Change the rootDN in the LDIF file to match the one you have for your directory.

  2. The apparmor profile for slapd will not need to be adjusted for the accesslog database location since/etc/apparmor.d/local/usr.sbin.slapd contains:

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值