shjung 2 giorni fa
parent
commit
a8fed23dab

+ 19 - 2
deploy-client.sh

@@ -2,9 +2,14 @@
 set -e  # 오류 발생 시 즉시 종료
 
 APP_NAME=rota-utic-client-0.0.1.jar
-JAR_PATH=./rota-utic-client/build/libs/$APP_SERVER_NAME
+JAR_PATH=./rota-utic-client/build/libs/$APP_NAME
 
 # 서버 정보 설정
+HOST0="192.168.10.20"
+PORT0="50022"
+USER0="utic"
+REMOTE_PATH0="/home/utic/bin/$APP_NAME"
+
 HOST1="192.168.10.91"
 PORT1="50022"
 USER1="utic"
@@ -17,7 +22,19 @@ REMOTE_PATH2="/home/utic/bin/$APP_NAME"
 
 echo "📦 Starting deployment..."
 
-if [ "$1" == "1" ]; then
+if [ "$1" == "0" ]; then
+    echo "ROTA 교통정보 연계서버 #0($APP_NAME)"
+    echo "utic, *20ut25ic"
+    echo "📦 Deploying to $HOST0..."
+
+    scp -P "$PORT0" "$JAR_PATH" "$USER0@$HOST0:$REMOTE_PATH0"
+    if [ $? -eq 0 ]; then
+        echo "✅ $HOST 업로드 성공!"
+    else
+        echo "❌ $HOST 업로드 실패. 경로 또는 권한 확인 필요."
+    fi
+
+elif [ "$1" == "1" ]; then
     echo "ROTA 교통정보 연계서버 #1($APP_NAME)"
     echo "utic, *20ut25ic"
     echo "📦 Deploying to $HOST1..."

+ 19 - 2
deploy-server.sh

@@ -2,9 +2,14 @@
 set -e  # 오류 발생 시 즉시 종료
 
 APP_NAME=rota-utic-server-0.0.1.jar
-JAR_PATH=./rota-utic-server/build/libs/$APP_SERVER_NAME
+JAR_PATH=./rota-utic-server/build/libs/$APP_NAME
 
 # 서버 정보 설정
+HOST0="192.168.10.20"
+PORT0="50022"
+USER0="utic"
+REMOTE_PATH0="/home/utic/bin/$APP_NAME"
+
 HOST1="192.168.10.91"
 PORT1="50022"
 USER1="utic"
@@ -17,7 +22,19 @@ REMOTE_PATH2="/home/utic/bin/$APP_NAME"
 
 echo "📦 Starting deployment..."
 
-if [ "$1" == "1" ]; then
+if [ "$1" == "0" ]; then
+    echo "ROTA 교통정보 연계서버 #0($APP_NAME)"
+    echo "utic, *20ut25ic"
+    echo "📦 Deploying to $HOST0..."
+
+    scp -P "$PORT0" "$JAR_PATH" "$USER0@$HOST0:$REMOTE_PATH0"
+    if [ $? -eq 0 ]; then
+        echo "✅ $HOST 업로드 성공!"
+    else
+        echo "❌ $HOST 업로드 실패. 경로 또는 권한 확인 필요."
+    fi
+
+elif [ "$1" == "1" ]; then
     echo "ROTA 교통정보 연계서버 #1($APP_NAME)"
     echo "utic, *20ut25ic"
     echo "📦 Deploying to $HOST1..."

+ 10 - 7
moct-utic-server/src/main/java/com/utic/its/moct/utic/server/cluster/ClusterMasterService.java

@@ -54,27 +54,30 @@ public class ClusterMasterService extends AbstractClusterMasterService {
         log.info("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, {} Centers.",
                 this.clusterConfig.getId(), message.getClusterId(), infos.get(0).getCenters().size());
 
-        for (ClusterCommDto clusterTodpDto : infos) {
-            if (this.clusterConfig.getId() == clusterTodpDto.getClusterId()) {
+        for (ClusterCommDto rcvCenterList : infos) {
+            if (this.clusterConfig.getId() == rcvCenterList.getClusterId()) {
                 log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: clusterId: {}, master: {}, time: {}: clusterId error, this: {}, receive: {}",
-                        this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()), this.clusterConfig.getId(), clusterTodpDto.getClusterId());
+                        this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()),
+                        this.clusterConfig.getId(), rcvCenterList.getClusterId());
             }
 
-            for (RegionCenterInfo centerInfo: clusterTodpDto.getCenters()) {
+            for (RegionCenterInfo centerInfo: rcvCenterList.getCenters()) {
                 CenterDto center = ApplicationRepository.CENTER_MAP.get(centerInfo.getCenterId());
                 if (center == null) {
-                    return;
+                    log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, center {} not found.",
+                            this.clusterConfig.getId(), message.getClusterId(), centerInfo.getCenterId());
+                    continue;
                 }
                 if (center.getRealClusterId() == 0) {
                     // 최초 정보 수신한 경우에 해당함
                     centerInfo.toCopyInfo(center);
-                    return;
+                    continue;
                 }
 
                 if (center.getRealClusterId() == message.getClusterId()) {
                     // 기존에 연결된 클러스터의 정보임
                     centerInfo.toCopyInfo(center);
-                    return;
+                    continue;
                 }
 
                 // 기타, 클러스터가 현재 서버인경우와 그렇치 않은경우(클러스터가 3개이상인 경우)

+ 2 - 3
moct-utic-server/src/main/java/com/utic/its/moct/utic/server/cluster/dto/NetStateInfo.java

@@ -2,7 +2,6 @@ package com.utic.its.moct.utic.server.cluster.dto;
 
 import com.utic.its.common.dto.NET;
 import com.utic.its.common.dto.NetState;
-import io.netty.channel.Channel;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -19,7 +18,7 @@ public class NetStateInfo implements Serializable {
     private static final long serialVersionUID = 1L;
 
     private int state;
-    private Channel channel;
+//    private Channel channel;
     private long connectCount;
     private long lastRecvTime;
     private long lastSendTime;
@@ -29,7 +28,7 @@ public class NetStateInfo implements Serializable {
 
     public NetStateInfo(NetState info) {
         this.state = info.getState();
-        this.channel = info.getChannel();
+//        this.channel = info.getChannel();
         this.connectCount = info.getConnectCount();
         this.lastRecvTime = info.getLastRecvTime();
         this.lastSendTime = info.getLastSendTime();

+ 1 - 1
moct-utic-server/src/main/java/com/utic/its/moct/utic/server/cluster/dto/RegionCenterInfo.java

@@ -39,7 +39,7 @@ public class RegionCenterInfo implements Serializable {
 
 //        NetState state = center.getNetState();
         center.getNetState().setState(this.netState.getState());
-        center.getNetState().setChannel(this.netState.getChannel());
+//        center.getNetState().setChannel(this.netState.getChannel());
         center.getNetState().setConnectCount(this.netState.getConnectCount());
         center.getNetState().setLastRecvTime(this.netState.getLastRecvTime());
         center.getNetState().setLastSendTime(this.netState.getLastSendTime());

+ 10 - 7
rota-utic-client/src/main/java/com/utic/its/rota/utic/client/cluster/ClusterMasterService.java

@@ -83,27 +83,30 @@ public class ClusterMasterService extends AbstractClusterMasterService {
         log.info("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, {} Centers.",
                 this.clusterConfig.getId(), message.getClusterId(), infos.get(0).getCenters().size());
 
-        for (ClusterCommDto clusterTodpDto : infos) {
-            if (this.clusterConfig.getId() == clusterTodpDto.getClusterId()) {
+        for (ClusterCommDto rcvCenterList : infos) {
+            if (this.clusterConfig.getId() == rcvCenterList.getClusterId()) {
                 log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: clusterId: {}, master: {}, time: {}: clusterId error, this: {}, receive: {}",
-                        this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()), this.clusterConfig.getId(), clusterTodpDto.getClusterId());
+                        this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()),
+                        this.clusterConfig.getId(), rcvCenterList.getClusterId());
             }
 
-            for (RegionCenterInfo centerInfo: clusterTodpDto.getCenters()) {
+            for (RegionCenterInfo centerInfo: rcvCenterList.getCenters()) {
                 CenterDto center = ApplicationRepository.CENTER_MAP.get(centerInfo.getCenterId());
                 if (center == null) {
-                    return;
+                    log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, center {} not found.",
+                            this.clusterConfig.getId(), message.getClusterId(), centerInfo.getCenterId());
+                    continue;
                 }
                 if (center.getRealClusterId() == 0) {
                     // 최초 정보 수신한 경우에 해당함
                     centerInfo.toCopyInfo(center);
-                    return;
+                    continue;
                 }
 
                 if (center.getRealClusterId() == message.getClusterId()) {
                     // 기존에 연결된 클러스터의 정보임
                     centerInfo.toCopyInfo(center);
-                    return;
+                    continue;
                 }
 
                 // 기타, 클러스터가 현재 서버인경우와 그렇치 않은경우(클러스터가 3개이상인 경우)

+ 2 - 3
rota-utic-client/src/main/java/com/utic/its/rota/utic/client/cluster/dto/NetStateInfo.java

@@ -2,7 +2,6 @@ package com.utic.its.rota.utic.client.cluster.dto;
 
 import com.utic.its.common.dto.NET;
 import com.utic.its.common.dto.NetState;
-import io.netty.channel.Channel;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -19,7 +18,7 @@ public class NetStateInfo implements Serializable {
     private static final long serialVersionUID = 1L;
 
     private int state;
-    private Channel channel;
+//    private Channel channel;
     private long connectCount;
     private long lastRecvTime;
     private long lastSendTime;
@@ -29,7 +28,7 @@ public class NetStateInfo implements Serializable {
 
     public NetStateInfo(NetState info) {
         this.state = info.getState();
-        this.channel = info.getChannel();
+//        this.channel = info.getChannel();
         this.connectCount = info.getConnectCount();
         this.lastRecvTime = info.getLastRecvTime();
         this.lastSendTime = info.getLastSendTime();

+ 1 - 1
rota-utic-client/src/main/java/com/utic/its/rota/utic/client/cluster/dto/RegionCenterInfo.java

@@ -44,7 +44,7 @@ public class RegionCenterInfo implements Serializable {
 
 //        NetState state = center.getNetState();
         center.getNetState().setState(this.netState.getState());
-        center.getNetState().setChannel(this.netState.getChannel());
+//        center.getNetState().setChannel(this.netState.getChannel());
         center.getNetState().setConnectCount(this.netState.getConnectCount());
         center.getNetState().setLastRecvTime(this.netState.getLastRecvTime());
         center.getNetState().setLastSendTime(this.netState.getLastSendTime());

+ 14 - 8
rota-utic-server/src/main/java/com/utic/its/rota/utic/server/cluster/ClusterMasterService.java

@@ -6,7 +6,6 @@ import com.its.common.cluster.vo.ClusterMessage;
 import com.its.common.cluster.vo.ClusterMessageData;
 import com.its.common.cluster.vo.ClusterNode;
 import com.utic.its.common.dto.CenterDto;
-import com.utic.its.common.dto.NET;
 import com.utic.its.common.repository.ApplicationRepository;
 import com.utic.its.rota.utic.server.cluster.dto.ClusterCommDto;
 import com.utic.its.rota.utic.server.cluster.dto.RegionCenterInfo;
@@ -55,29 +54,36 @@ public class ClusterMasterService extends AbstractClusterMasterService {
         log.info("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, {} Centers.",
                 this.clusterConfig.getId(), message.getClusterId(), infos.get(0).getCenters().size());
 
-        for (ClusterCommDto clusterTodpDto : infos) {
-            if (this.clusterConfig.getId() == clusterTodpDto.getClusterId()) {
+        for (ClusterCommDto rcvCenterList : infos) {
+            if (this.clusterConfig.getId() == rcvCenterList.getClusterId()) {
                 log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: clusterId: {}, master: {}, time: {}: clusterId error, this: {}, receive: {}",
-                        this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()), this.clusterConfig.getId(), clusterTodpDto.getClusterId());
+                        this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()),
+                        this.clusterConfig.getId(), rcvCenterList.getClusterId());
             }
 
-            for (RegionCenterInfo centerInfo: clusterTodpDto.getCenters()) {
+            for (RegionCenterInfo centerInfo: rcvCenterList.getCenters()) {
                 CenterDto center = ApplicationRepository.CENTER_MAP.get(centerInfo.getCenterId());
                 if (center == null) {
-                    return;
+                    log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, center {} not found.",
+                            this.clusterConfig.getId(), message.getClusterId(), centerInfo.getCenterId());
+                    continue;
                 }
+//                int oldRealClusterId = center.getRealClusterId();
                 if (center.getRealClusterId() == 0) {
                     // 최초 정보 수신한 경우에 해당함
                     centerInfo.toCopyInfo(center);
-                    return;
+//                    log.info("clusterIsZero: {}, {} ==> {}", center.getCenterId(), oldRealClusterId, center.getRealClusterId());
+                    continue;
                 }
 
                 if (center.getRealClusterId() == message.getClusterId()) {
                     // 기존에 연결된 클러스터의 정보임
                     centerInfo.toCopyInfo(center);
-                    return;
+//                    log.info("clusterIsEqual: {}, {} ==> {}", center.getCenterId(), oldRealClusterId, center.getRealClusterId());
+                    continue;
                 }
 
+//                log.info("clusterIsOther: {}, {} ::: {}", center.getCenterId(), this.clusterConfig.getId(), center.getRealClusterId());
                 // 기타, 클러스터가 현재 서버인경우와 그렇치 않은경우(클러스터가 3개이상인 경우)
                 if (this.clusterConfig.getId() == center.getRealClusterId()) {
                     if (centerInfo.getNetState().isAlive() &&

+ 2 - 3
rota-utic-server/src/main/java/com/utic/its/rota/utic/server/cluster/dto/NetStateInfo.java

@@ -2,7 +2,6 @@ package com.utic.its.rota.utic.server.cluster.dto;
 
 import com.utic.its.common.dto.NET;
 import com.utic.its.common.dto.NetState;
-import io.netty.channel.Channel;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -19,7 +18,7 @@ public class NetStateInfo implements Serializable {
     private static final long serialVersionUID = 1L;
 
     private int state;
-    private Channel channel;
+//    private Channel channel;
     private long connectCount;
     private long lastRecvTime;
     private long lastSendTime;
@@ -29,7 +28,7 @@ public class NetStateInfo implements Serializable {
 
     public NetStateInfo(NetState info) {
         this.state = info.getState();
-        this.channel = info.getChannel();
+//        this.channel = info.getChannel();
         this.connectCount = info.getConnectCount();
         this.lastRecvTime = info.getLastRecvTime();
         this.lastSendTime = info.getLastSendTime();

+ 6 - 5
rota-utic-server/src/main/java/com/utic/its/rota/utic/server/cluster/dto/RegionCenterInfo.java

@@ -1,7 +1,6 @@
 package com.utic.its.rota.utic.server.cluster.dto;
 
 import com.utic.its.common.dto.CenterDto;
-import com.utic.its.common.dto.SendIncidentInfo;
 import com.utic.its.common.dto.SendTrafficInfo;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -24,16 +23,18 @@ public class RegionCenterInfo implements Serializable {
 
     private NetStateInfo netState;
     private SendTrafficInfo sendTraffic;
-    private SendIncidentInfo sendIncident;
+    private SendIncidentSimpleInfo sendIncident;
 
     public static RegionCenterInfo createInfo(CenterDto center) {
+        SendIncidentSimpleInfo incident = new SendIncidentSimpleInfo();
+        incident.setInfo(center.getSendIncident());
         return RegionCenterInfo.builder()
                 .clusterId(center.getClusterId())
                 .realClusterId(center.getRealClusterId())
                 .centerId(center.getCenterId())
                 .netState(new NetStateInfo(center.getNetState()))
                 .sendTraffic(center.getSendTraffic())
-                .sendIncident(center.getSendIncident())
+                .sendIncident(incident)
                 .build();
     }
 
@@ -42,7 +43,7 @@ public class RegionCenterInfo implements Serializable {
 
 //        NetState state = center.getNetState();
         center.getNetState().setState(this.netState.getState());
-        center.getNetState().setChannel(this.netState.getChannel());
+//        center.getNetState().setChannel(this.netState.getChannel());
         center.getNetState().setConnectCount(this.netState.getConnectCount());
         center.getNetState().setLastRecvTime(this.netState.getLastRecvTime());
         center.getNetState().setLastSendTime(this.netState.getLastSendTime());
@@ -51,7 +52,7 @@ public class RegionCenterInfo implements Serializable {
         center.getNetState().setDisconnectTime(this.netState.getDisconnectTime());
 
         center.setSendTraffic(this.sendTraffic);
-        center.setSendIncident(this.sendIncident);
+        this.sendIncident.copyInfo(center.getSendIncident());
         center.setSyncCluster(true);
     }
 }

+ 31 - 0
rota-utic-server/src/main/java/com/utic/its/rota/utic/server/cluster/dto/SendIncidentSimpleInfo.java

@@ -0,0 +1,31 @@
+package com.utic.its.rota.utic.server.cluster.dto;
+
+import com.utic.its.common.dto.SendIncidentInfo;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class SendIncidentSimpleInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private long baseTime;
+    private long sendTime;
+    private int sendIdx;
+    private String logDate;
+
+    public void setInfo(SendIncidentInfo info) {
+        this.baseTime = info.getBaseTime();
+        this.sendTime = info.getSendTime();
+        this.sendIdx = info.getSendIdx();
+        this.logDate = info.getLogDate();
+    }
+
+    public void copyInfo(SendIncidentInfo info) {
+        info.setBaseTime(this.baseTime);
+        info.setSendTime(this.sendTime);
+        info.setSendIdx(this.sendIdx);
+        info.setLogDate(this.logDate);
+    }
+
+}

+ 1 - 0
utic-its-common/src/main/java/com/utic/its/common/xnet/server/handler/ItsAsnCommServerInitializer.java

@@ -59,6 +59,7 @@ public class ItsAsnCommServerInitializer extends ChannelInitializer<Channel> {
 
             center.getNetState().connect(channel);
             ApplicationRepository.setCenterObject(channel, center);
+            center.setRealClusterId(this.clusterId);
 
 //            long idleTime = center.getResTime(); // CENTER Table RESTIME 으로 설정
             long idleTime = center.getHeartbeatCycle() / 2; // CENTER Table HEARTBEATCYCLE 으로 설정