Пример #1
0
    def _make_PGServer(self, data_path):
        """initialize a database instance, and start the database service

        ..note:
          before start the service, some parameters in configuration should
          be added or changed, they are mainly used to turn on enough logs
        """
        logger.info('TestMode:check,try to start a PG server......')
        DBServer.initDB(data_path)
        DBServer.set_dbconf(
            data_path,
            port=_PORT,
            log_autovacuum_min_duration='0',
            log_checkpoints='on',
            #log_line_prefix="'%m [%p] %q%a '",
            log_lock_waits='on',
            log_temp_files='128kB',
            max_prepared_transactions='2')
        logger.info('TestMode:check,DONE to config file......')

        self.server = DBServer.start(data_path, self.checker._logs_dir)

        while not self.server.is_ready():
            logger.debug("keep trying to start the PostgreSQL service")
            time.sleep(1)

        logger.info('PG server is ready,start to run test......')
Пример #2
0
#coding:utf8

import os
if os.name != 'nt' and os.name != 'posix':
    from twisted.internet import epollreactor
    epollreactor.install()

import json
from dbserver import DBServer

if __name__ == "__main__":

    servername = "dbfront"
    config = json.load(open("config.json", 'r'))

    dbconf = config.get('db')
    memconf = config.get('memcached')
    sersconf = config.get('servers', {})
    masterconf = config.get('master', {})
    serconfig = sersconf.get(servername)

    ser = DBServer()
    ser.config(serconfig,
               dbconfig=dbconf,
               memconfig=memconf,
               masterconf=masterconf)
    ser.start()
Пример #3
0
# coding:utf8

import os

if os.name != "nt" and os.name != "posix":
    from twisted.internet import epollreactor

    epollreactor.install()

import json
from dbserver import DBServer

if __name__ == "__main__":

    servername = "dbfront"
    config = json.load(open("config.json", "r"))

    dbconf = config.get("db")
    memconf = config.get("memcached")
    sersconf = config.get("servers", {})
    masterconf = config.get("master", {})
    serconfig = sersconf.get(servername)

    ser = DBServer()
    ser.config(serconfig, dbconfig=dbconf, memconfig=memconf, masterconf=masterconf)
    ser.start()