mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Configurable metrics server port.
This commit is contained in:
@@ -15,6 +15,7 @@ public class CanalConstants {
|
||||
public static final String CANAL_ID = ROOT + "." + "id";
|
||||
public static final String CANAL_IP = ROOT + "." + "ip";
|
||||
public static final String CANAL_PORT = ROOT + "." + "port";
|
||||
public static final String CANAL_METRICS_PULL_PORT = ROOT + "." + "metrics.pull.port";
|
||||
public static final String CANAL_ZKSERVERS = ROOT + "." + "zkServers";
|
||||
public static final String CANAL_WITHOUT_NETTY = ROOT + "." + "withoutNetty";
|
||||
|
||||
|
||||
@@ -98,6 +98,14 @@ public class CanalController {
|
||||
port = Integer.valueOf(getProperty(properties, CanalConstants.CANAL_PORT));
|
||||
embededCanalServer = CanalServerWithEmbedded.instance();
|
||||
embededCanalServer.setCanalInstanceGenerator(instanceGenerator);// 设置自定义的instanceGenerator
|
||||
try {
|
||||
int metricsPort = Integer.valueOf(getProperty(properties, CanalConstants.CANAL_METRICS_PULL_PORT));
|
||||
embededCanalServer.setMetricsPort(metricsPort);
|
||||
} catch (NumberFormatException e) {
|
||||
logger.info("No valid metrics server port found, use default 11112.");
|
||||
embededCanalServer.setMetricsPort(11112);
|
||||
}
|
||||
|
||||
String canalWithoutNetty = getProperty(properties, CanalConstants.CANAL_WITHOUT_NETTY);
|
||||
if (canalWithoutNetty == null || "false".equals(canalWithoutNetty)) {
|
||||
canalServer = CanalServerWithNetty.instance();
|
||||
|
||||
Reference in New Issue
Block a user