Пример #1
0
    def setUp(self):
        super(TestSlave, self).setUp()
        utdocker.create_network()

        utdocker.start_container('redis-0', redis_tag, '192.168.52.40', '')
        dd('started redis in docker')

        redisutil.wait_serve(('192.168.52.40', redis_port))
        self.redis_cli = redisutil.get_client(('192.168.52.40', redis_port))

        self.journal_id_path = "tx/journal_id_set"
        self.storage = zktx.RedisStorage(self.redis_cli, self.journal_id_path)

        self.zk.create('tx', 'tx')
        self.zk.create('tx/journal_id_set', '{}')
        self.zk.create('tx/alive', '{}')
        self.zk.create('tx/txid_maker', '{}')
        self.zk.create('tx/journal', '{}')

        for d in ('lock', 'record'):
            self.zk.create(d, '{}')
            for d1 in ('leader', 'meta', 'job'):
                self.zk.create('/'.join([d, d1]), '{}')
                for d2 in ('block_group', 'global', 'region', 'server'):
                    self.zk.create('/'.join([d, d1, d2]), '{}')

        self.zke, _ = zkutil.kazoo_client_ext(self.zk)

        self.slave = zktx.Slave(self.zke, self.storage)
Пример #2
0
    def setUp(self):
        utdocker.create_network()

        utdocker.start_container('redis-0', redis_tag, '192.168.52.40', '')
        dd('started redis in docker')

        redisutil.wait_serve(('192.168.52.40', redis_port))

        self.redis_cli = redisutil.get_client(('192.168.52.40', redis_port))
        self.txid_path = "tx/txidset"
        self.storage = zktx.RedisStorage(self.redis_cli, self.txid_path)
    def setUp(self):
        utdocker.create_network()

        utdocker.start_container('redis-0', redis_tag, '192.168.52.40', '')
        dd('started redis in docker')

        redisutil.wait_serve(('192.168.52.40', redis_port))

        self.redis_cli = redisutil.get_client(('192.168.52.40', redis_port))
        self.journal_id_set_path = "tx/journal_id_set"
        self.storage = zktx.RedisStorage(self.redis_cli, self.journal_id_set_path)
Пример #4
0
    def setUp(self):

        self.containers = [
            ('redis-0', redis_tag, '192.168.52.40'),
            ('redis-1', redis_tag, '192.168.52.41'),
        ]

        # for single redis cases:
        self.docker_name = 'redis-0'
        self.ip = '192.168.52.40'
        self.is_child = False

        utdocker.create_network()

        for args in self.containers:
            utdocker.start_container(*(args + ('', )))
            dd('started redis in docker: ' + repr(args))

            redisutil.wait_serve((args[2], redis_port))

        self.rcl = redisutil.get_client((self.ip, redis_port))