Browse Source

fixed mq and client launcher

七锋 6 years ago
parent
commit
f5bf1667a9

+ 1 - 1
client-launcher/src/main/bin/startup.sh

@@ -74,7 +74,7 @@ else
 fi
 fi
 
 
 JAVA_OPTS=" $JAVA_OPTS -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8"
 JAVA_OPTS=" $JAVA_OPTS -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8"
-CANAL_OPTS="-DappName=otter-canal -Dlogback.configurationFile=$logback_configurationFile -Dcanal.conf=$canal_conf"
+CANAL_OPTS="-DappName=otter-canal-client -Dlogback.configurationFile=$logback_configurationFile -Dcanal.conf=$canal_conf"
 
 
 if [ -e $canal_conf -a -e $logback_configurationFile ]
 if [ -e $canal_conf -a -e $logback_configurationFile ]
 then 
 then 

+ 2 - 2
client-launcher/src/main/bin/stop.sh

@@ -45,7 +45,7 @@ fi
 
 
 pid=`cat $pidfile`
 pid=`cat $pidfile`
 if [ "$pid" == "" ] ; then
 if [ "$pid" == "" ] ; then
-	pid=`get_pid "appName=otter-canal"`
+	pid=`get_pid "appName=otter-canal-client"`
 fi
 fi
 
 
 echo -e "`hostname`: stopping canal $pid ... "
 echo -e "`hostname`: stopping canal $pid ... "
@@ -54,7 +54,7 @@ kill $pid
 LOOPS=0
 LOOPS=0
 while (true); 
 while (true); 
 do 
 do 
-	gpid=`get_pid "appName=otter-canal" "$pid"`
+	gpid=`get_pid "appName=otter-canal-client" "$pid"`
     if [ "$gpid" == "" ] ; then
     if [ "$gpid" == "" ] ; then
     	echo "Oook! cost:$LOOPS"
     	echo "Oook! cost:$LOOPS"
     	`rm $pidfile`
     	`rm $pidfile`

+ 1 - 1
deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java

@@ -387,7 +387,7 @@ public class CanalController {
         return config;
         return config;
     }
     }
 
 
-    private String getProperty(Properties properties, String key) {
+    public String getProperty(Properties properties, String key) {
         key = StringUtils.trim(key);
         key = StringUtils.trim(key);
         String value = System.getProperty(key);
         String value = System.getProperty(key);
 
 

+ 5 - 3
deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalLauncher.java

@@ -3,12 +3,13 @@ package com.alibaba.otter.canal.deployer;
 import java.io.FileInputStream;
 import java.io.FileInputStream;
 import java.util.Properties;
 import java.util.Properties;
 
 
-import com.alibaba.otter.canal.kafka.CanalKafkaStarter;
-import com.alibaba.otter.canal.server.CanalServerStarter;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
+import com.alibaba.otter.canal.kafka.CanalKafkaStarter;
+import com.alibaba.otter.canal.server.CanalServerStarter;
+
 /**
 /**
  * canal独立版本启动的入口类
  * canal独立版本启动的入口类
  * 
  * 
@@ -55,12 +56,13 @@ public class CanalLauncher {
             });
             });
 
 
             CanalServerStarter canalServerStarter = null;
             CanalServerStarter canalServerStarter = null;
-            String serverMode = properties.getProperty(CanalConstants.CANAL_SERVER_MODE, "tcp");
+            String serverMode = controller.getProperty(properties, CanalConstants.CANAL_SERVER_MODE);
             if (serverMode.equalsIgnoreCase("kafka")) {
             if (serverMode.equalsIgnoreCase("kafka")) {
                 canalServerStarter = new CanalKafkaStarter();
                 canalServerStarter = new CanalKafkaStarter();
             } else if (serverMode.equalsIgnoreCase("rocketMQ")) {
             } else if (serverMode.equalsIgnoreCase("rocketMQ")) {
                 // 预留rocketMQ启动
                 // 预留rocketMQ启动
             }
             }
+
             if (canalServerStarter != null) {
             if (canalServerStarter != null) {
                 canalServerStarter.init();
                 canalServerStarter.init();
             }
             }

+ 1 - 3
deployer/src/main/resources/kafka.yml

@@ -12,6 +12,4 @@ canalGetTimeout: 100
 canalDestinations:
 canalDestinations:
   - canalDestination: example
   - canalDestination: example
     topic: example
     topic: example
-    partition:
-
-
+    partition: