当前位置: 首页>>代码示例>>C++>>正文


C++ TestConnections::restart_maxscale方法代码示例

本文整理汇总了C++中TestConnections::restart_maxscale方法的典型用法代码示例。如果您正苦于以下问题:C++ TestConnections::restart_maxscale方法的具体用法?C++ TestConnections::restart_maxscale怎么用?C++ TestConnections::restart_maxscale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestConnections的用法示例。


在下文中一共展示了TestConnections::restart_maxscale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    TestConnections * Test = new TestConnections(argc, argv);
    int global_result = 0;
    int i;

    Test->read_env();
    Test->print_env();

    printf("Connecting to Maxscale %s\n", Test->maxscale_IP);

    char sys1[4096];

    printf("Connecting to Maxscale %s to check its behaviour in case of blocking all bacxkends\n", Test->maxscale_IP);
    Test->connect_maxscale();

    for (i = 0; i < Test->repl->N; i++) {
        printf("Setup firewall to block mysql on node %d\n", i); fflush(stdout);
        Test->repl->block_node(i); fflush(stdout);
    }

    pid_t pid = fork();
    if (!pid) {
        Test->restart_maxscale(); fflush(stdout);
    } else {

        printf("Waiting 20 seconds\n"); fflush(stdout);
        sleep(20);

        printf("Checking if MaxScale is alive by connecting to MaxAdmin\n"); fflush(stdout);
        global_result += execute_maxadmin_command(Test->maxscale_IP, (char *) "admin", Test->maxadmin_password, (char* ) "show servers");

        for (i = 0; i < Test->repl->N; i++) {
            printf("Setup firewall back to allow mysql on node %d\n", i); fflush(stdout);
            Test->repl->unblock_node(i);fflush(stdout);
        }

        printf("Sleeping 60 seconds\n"); fflush(stdout);
        sleep(60);

        printf("Checking Maxscale is alive\n"); fflush(stdout);
        global_result += check_maxscale_alive(); fflush(stdout);
        if (global_result !=0) {
            printf("MaxScale is not alive\n");
        } else {
            printf("MaxScale is still alive\n");
        }

        Test->close_maxscale_connections(); fflush(stdout);

        printf("Reconnecting and trying query to RWSplit\n"); fflush(stdout);
        Test->connect_maxscale();
        global_result += execute_query(Test->conn_rwsplit, (char *) "show processlist;");
        printf("Trying query to ReadConn master\n"); fflush(stdout);
        global_result += execute_query(Test->conn_master, (char *) "show processlist;");
        printf("Trying query to ReadConn slave\n"); fflush(stdout);
        global_result += execute_query(Test->conn_slave, (char *) "show processlist;");
        Test->close_maxscale_connections();

        Test->copy_all_logs(); return(global_result);
    }
}
开发者ID:Robert-Xie,项目名称:maxscale-system-test,代码行数:62,代码来源:bug662.cpp


注:本文中的TestConnections::restart_maxscale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。