Search in sources :

Example 1 with HaShardManager

use of com.cubrid.cubridmanager.core.cubrid.service.task.HaShardManager in project cubrid-manager by CUBRID.

the class CMServiceAnalysisAction method run.

public void run() {
    HaShardManager haShardManager = HaShardManager.getInstance();
    /*HaShardDemo.registerServiceAndConnect("192.168.1.60", 8001, "admin", 
				"123456", "HA Master");*/
    //HA node list
    HaShardDemo demo = new HaShardDemo();
    demo.registerServiceAndBuildInfo("192.168.1.119", 8001, "admin", "1111", "www.cubrid.org", "Broker Server 1", "dev-cub-ha-005.ncl");
    //		demo.registerServiceAndBuildInfo("192.168.1.250", 8001, "admin", 
    //				"1111", "www.cubrid.org", "HA Master", "dev-cub-ha-001.ncl");
    demo.registerServiceAndBuildInfo("192.168.1.247", 8001, "admin", "1111", "www.cubrid.org", "HA Slave", "dev-cub-ha-002.ncl");
    demo.registerServiceAndBuildInfo("192.168.1.82", 8001, "admin", "1111", "www.cubrid.org", "HA Replica 1", "dev-cub-ha-003.ncl");
    demo.registerServiceAndBuildInfo("192.168.1.247", 8001, "admin", "1111", "www.cubrid.org", "HA Replica 2", "dev-cub-ha-004.ncl");
    //Shard node list
    demo.registerServiceAndBuildInfo("192.168.1.226", 8001, "admin", "1111", "drive.cubrid.org", "Shard 1", "dev-cub-shard-001.ncl");
    demo.registerServiceAndBuildInfo("192.168.1.223", 8001, "admin", "1111", "drive.cubrid.org", "Shard 2", "dev-cub-shard-002.ncl");
    demo.registerServiceAndBuildInfo("192.168.1.22", 8001, "admin", "1111", "drive.cubrid.org", "Shard 3", "dev-cub-shard-003.ncl");
    System.out.println("-------------------------------------------------------------------------");
    System.out.println("Service Name  - Database(s) -    Node Name    -     " + "IP     -   Broker Status   - Connect Name - Node Status");
    System.out.println("-------------------------------------------------------------------------");
    haShardManager.sort();
    haShardManager.registerBrokerHostInHaShard();
    List<NodeInfo> haNodes = haShardManager.getHaNodes();
    System.out.println("[HA Services]");
    for (NodeInfo node : haNodes) {
        System.out.println(node);
    }
    List<NodeInfo> shardNodes = haShardManager.getShardNodes();
    System.out.println("[Shard Services]");
    for (NodeInfo node : shardNodes) {
        System.out.println(node);
    }
    System.out.println("-------------------------------------------------------------------------");
    System.out.println("Broker  -  Service Name  -  " + "Broker Status  -  Connect Name  -   DB(Accessed)  -  Host(Accessed)");
    System.out.println("-------------------------------------------------------------------------");
    List<NodeInfo> brokerNodes = haShardManager.getBrokerNodes();
    System.out.println("[Brokers]");
    for (NodeInfo node : brokerNodes) {
        System.out.println(node);
    }
}
Also used : HaShardManager(com.cubrid.cubridmanager.core.cubrid.service.task.HaShardManager) NodeInfo(com.cubrid.cubridmanager.core.cubrid.service.model.NodeInfo) HaShardDemo(com.cubrid.cubridmanager.core.cubrid.service.task.HaShardDemo)

Aggregations

NodeInfo (com.cubrid.cubridmanager.core.cubrid.service.model.NodeInfo)1 HaShardDemo (com.cubrid.cubridmanager.core.cubrid.service.task.HaShardDemo)1 HaShardManager (com.cubrid.cubridmanager.core.cubrid.service.task.HaShardManager)1