Search in sources :

Example 1 with CobarNodeConfig

use of com.alibaba.cobar.config.model.CobarNodeConfig in project cobar by alibaba.

the class CobarDetectorFactory method make.

public CobarDetector make(CobarHeartbeat heartbeat) throws IOException {
    SocketChannel channel = openSocketChannel();
    CobarNodeConfig cnc = heartbeat.getNode().getConfig();
    SystemConfig sys = CobarServer.getInstance().getConfig().getSystem();
    CobarDetector detector = new CobarDetector(channel);
    detector.setHost(cnc.getHost());
    detector.setPort(cnc.getPort());
    detector.setUser(sys.getClusterHeartbeatUser());
    detector.setPassword(sys.getClusterHeartbeatPass());
    detector.setHeartbeatTimeout(sys.getClusterHeartbeatTimeout());
    detector.setHeartbeat(heartbeat);
    postConnect(detector, CobarServer.getInstance().getConnector());
    return detector;
}
Also used : SocketChannel(java.nio.channels.SocketChannel) SystemConfig(com.alibaba.cobar.config.model.SystemConfig) CobarNodeConfig(com.alibaba.cobar.config.model.CobarNodeConfig)

Example 2 with CobarNodeConfig

use of com.alibaba.cobar.config.model.CobarNodeConfig in project cobar by alibaba.

the class ShowCobarCluster method getRow.

private static RowDataPacket getRow(CobarNode node, String charset) {
    CobarNodeConfig conf = node.getConfig();
    RowDataPacket row = new RowDataPacket(FIELD_COUNT);
    row.add(StringUtil.encode(conf.getHost(), charset));
    row.add(IntegerUtil.toBytes(conf.getWeight()));
    return row;
}
Also used : RowDataPacket(com.alibaba.cobar.net.mysql.RowDataPacket) CobarNodeConfig(com.alibaba.cobar.config.model.CobarNodeConfig)

Aggregations

CobarNodeConfig (com.alibaba.cobar.config.model.CobarNodeConfig)2 SystemConfig (com.alibaba.cobar.config.model.SystemConfig)1 RowDataPacket (com.alibaba.cobar.net.mysql.RowDataPacket)1 SocketChannel (java.nio.channels.SocketChannel)1