Beispiel #1
0
    def setUp(self):

        master_role = Master(User("repl_user", "xyzzy"))
        for master in self.masters:
            master_role.imbue(master)

        final_role = Final(self.masters[0])
        for slave in self.slaves:
            try:
                final_role.imbue(slave)
            except IOError:
                pass
    def setUp(self):

        master_role = Master(User("repl_user", "xyzzy"))
        for master in self.masters:
            master_role.imbue(master)

        final_role = Final(self.masters[0])
        for slave in self.slaves:
            try:
                final_role.imbue(slave)
            except IOError:
                pass
                name="mysqld1",
                sql_user=_replicant_user,
                ssh_user=User("mysql"),
                machine=Linux(),
                role=Master(_repl_user),
                port=3307,
                socket='/var/run/mysqld/mysqld1.sock',
                defaults_file=_cnf("mysqld1"),
                config_section="mysqld1")
slaves = [
    Server(server_id=2,
           name="mysqld2",
           sql_user=_replicant_user,
           ssh_user=User("mysql"),
           machine=Linux(),
           role=Final(master),
           port=3308,
           socket='/var/run/mysqld/mysqld2.sock',
           defaults_file=_cnf("mysqld2"),
           config_section="mysqld2"),
    Server(server_id=3,
           name="mysqld3",
           sql_user=_replicant_user,
           ssh_user=User("mysql"),
           machine=Linux(),
           role=Final(master),
           port=3309,
           socket='/var/run/mysqld/mysqld3.sock',
           defaults_file=_cnf("mysqld3"),
           config_section="mysqld3"),
    Server(server_id=4,
import sys, os.path
rootpath = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
sys.path.append(rootpath) 

import my_deployment
from mysql.replicant.server import (
    User,
    )
from mysql.replicant.roles import (
    Master,
    Final,
    )
from mysql.replicant.commands import (
    change_master,
    )

master_role = Master(User("repl_user", "xyzzy"))
final_role = Final(my_deployment.master)

try:
    master_role.imbue(my_deployment.master)
except IOError, e:
    print "Cannot imbue master with Master role:", e

for slave in my_deployment.slaves:
    try:
        final_role.imbue(slave)
    except IOError, e:
        print "Cannot imbue slave with Final role:", e