某客户做用户中心项目。使用OpenLDAP做为存储用户信息。LDAP是一款轻量级目录访问协议(Lightweight Directory Access Protocol,简称LDAP),属于开源集中账号管理架构的实现,且支持众多系统版本,被广大互联网公司所采用。目录服务是一种特殊的数据库系统,对于数据的读取、浏览、搜索有很好的效果。同时做为用户中心,数据库的高可用显得尤为重要。在客户生产环境中使用的是客户的负载均衡设备,基于思杰的硬件负载均衡设备,后端配置的是OpenLDAP_MirrorMode,相当于Mysql的双主模式,后面某一台服务器出现问题,负载均衡会将后端的服务器剔除,另一台仍能提供服务,如下图所示
![](https://i-blog.csdnimg.cn/blog_migrate/0048dd604b171908ee53af29e1852685.png)
实验环境:
操作系统: centos 7.2
服务器A:10.10.1.134
服务器B:10.10.1.132
![](https://i-blog.csdnimg.cn/blog_migrate/0048dd604b171908ee53af29e1852685.png)
实验环境:
操作系统: centos 7.2
服务器A:10.10.1.134
服务器B:10.10.1.132
一:环境准备
- 下载软件:
mkdir /home/admin/openldap && cd /home/admin/openldap
wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap- release/openldap-2.4.23.tgz
wget http://download.oracle.com/berkeley-db/db-4.6.21.tar.gz
wget http://download.oracle.com/berkeley-db/db-4.6.21.tar.gz
- 关闭selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config && sestatus - 防火墙关闭
/bin/systemctl disable firewalld.service && /bin/systemctl stop firewalld.service - 配置yum源为阿里云yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #从阿里云镜像网站下载yum源配置文件到yum目录中
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo #修改版本号为redhat7
yum clean all #清空yum缓存
yum list #生成列表
yum clean all #清空yum缓存
yum list #生成列表