当前位置: 首页 > postgresql > 正文

EDB-failover 功能分析及配置方式

功能结构:

EDB_Failover_Manager

如果所示,EDB-failover 的核心其实就是java写的agent(底层通信层使用JGroups),agent提供如下两个功能:

    1. master数据库故障(宕机)后,对slave数据库进行promote
    2. 漂移虚拟IP

failover manager 根据运行的机器不同,扮演三种角色:

    1. witness (类似cman中投票磁盘的概念,用来放置脑裂)
    2. master   (运行在master数据库上)
    3. slave    (运行在slave数据库上)

配置方法:

1. 配置 postgresql 的 hot_standy

    listen_addresses = '*'
    hot_standby = on
    wal_level = hot_standby
    archive_mode = on
    archive_command = 'cp -i %p /path/to/pg/archive/%f'
    max_wal_senders = 5
    local   all             all                                     trust
    host    all             all             127.0.0.1/32            trust
    host    all             all             node1/32                trust
    host    all             all             node2/32                trust
    host    all             all             witness/32              trust
    host    all             all             ::1/128                 trust
    host    replication     postgres        node1/32                trust

2. 配置failover

    ppfm.license=
    cluster.name=failOVER1
    auto.failover=true
    db.user=postgres
    db.password.encrypted=8c3d72eaa260d5a8bb202a91424a4d94
    db.port=5432
    db.database=postgres
    db.reuse.connection=true
    admin.port=54321
    local.timeout=25
    local.period=10
    remote.timeout=5
    jgroups.max.tries=3
    jgroups.timeout=3000
    user.email=klwang@klwang.info
    agents=node1:54321,node2:54321
    witness=witness:54321
    db.service.owner=postgres
    db.trigger.file=/home/postgres/pg923/data/recovery_end.trigger
    db.recovery.conf.dir=/home/postgres/pg923/data
    virtualIp=192.168.11.182
    virtualIp.interface=eth1:1
    virtualIp.netmask=255.255.240.0
    pingServerIp=8.8.8.8
    pingServerCommand=/bin/ping -q -c3 -w5
    script.fence=
    jgroups.loglevel=INFO
    ppfm.loglevel=INFO

3. 启动

3.1 先启动witness

        service ppfm-1.1 start

3.2 再启动master和slave(不分先后)

        service ppfm-1.1 start

4. 命令操作

    usage: service ppfm-1.1 <command>
    commands:
	    start
		    Start ppfm on a single node.
	    cluster-status
		    Output the status of the entire ppfm cluster.
	    promote
		    Perform manual failover of master to standby (overrides 'auto.failover' property).
	    stop
		    Stop ppfm on a single node.
	    stop-cluster
		    Stop ppfm on all nodes.
	    resume
		    Resume monitoring a database that had previously stopped.
	    prop-check
		    Run utility to help resolve differences in properties files among nodes.
	    encrypt
		    Create encoded password for db user to use in properties file.
    分享到:

本文固定链接: http://klwang.info/edb-failover-struct-and-config/ | 数据库|Linux|软件开发

该日志由 klwang 于2014年08月21日发表在 postgresql 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: EDB-failover 功能分析及配置方式 | 数据库|Linux|软件开发

EDB-failover 功能分析及配置方式:等您坐沙发呢!

发表评论

*
快捷键:Ctrl+Enter