Kaynağa Gözat

cluster update

shjung 1 ay önce
ebeveyn
işleme
9d610cd906

+ 19 - 0
commit.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e  # 오류 발생 시 즉시 종료
+
+if [ -z "$1" ]; then
+  echo "❗️ 커밋 메시지를 입력하세요."
+  echo "사용법: ./commit.sh \"커밋 메시지\""
+  exit 1
+fi
+
+COMMIT_MSG="$1"
+
+echo "📦 Git 커밋 및 푸시 시작..."
+
+git add .
+git commit -m "$COMMIT_MSG"
+git push origin master
+git push server master
+
+echo "✅ 완료: '$COMMIT_MSG' 커밋 후 푸시됨"

+ 2 - 2
its-cluster/src/main/java/com/its/common/cluster/service/AbstractClusterMasterService.java

@@ -121,8 +121,8 @@ public abstract class AbstractClusterMasterService {
         // slave의 네트워크 상태를 확인하고 slave 네트워크의 연결을 종료시킨다.
         if (!isActive && clusterNode.getSyncState().getState() != ClusterNET.CLOSED) {
             Channel channel = clusterNode.getSyncState().getChannel();
-            log.info("ClusterNodeId: {}, ClusterMasterService.onNotifyClusterNetworkState: fromClusterNodeId: {}, Try SlaveNetwork Close. channel: {}",
-                    this.clusterConfig.getId(), clusterNode.getId(), channel);
+//            log.info("ClusterNodeId: {}, ClusterMasterService.onNotifyClusterNetworkState: fromClusterNodeId: {}, Try SlaveNetwork Close. channel: {}",
+//                    this.clusterConfig.getId(), clusterNode.getId(), channel);
             if (channel != null) {
                 channel.flush();
                 channel.disconnect();

+ 0 - 1
its-cluster/src/main/java/com/its/common/cluster/service/AbstractClusterSlaveService.java

@@ -174,7 +174,6 @@ public abstract class AbstractClusterSlaveService {
         if (channel == null || !channel.isOpen()) {
             return;
         }
-
         synchronized (cluster.getSendLock()) {
             try {
                 ChannelFuture future = channel.writeAndFlush(clusterMsg);

+ 2 - 3
its-cluster/src/main/java/com/its/common/cluster/service/ClusterMasterInitializer.java

@@ -53,9 +53,8 @@ public class ClusterMasterInitializer extends ChannelInitializer<Channel> {
             return;
         }
 
-        if (this.clusterConfig.isLogging()) {
-            log.info("ClusterNodeId: {}, ClusterMasterInitializer.initChannel: [clusterId: {}, IP Address: {}.{}], completed.", this.clusterConfig.getId(), clusterId, ipAddress, clientPort);
-        }
+        log.info("ClusterNodeId: {}, ClusterMasterInitializer.initChannel: [clusterId: {}, IP Address: {}.{}], completed.",
+                this.clusterConfig.getId(), clusterId, ipAddress, clientPort);
 
         if (clusterNode.getElectionState().getChannel() != null) {
             log.warn("ClusterNodeId: {}, ClusterMasterInitializer.initChannel: [clusterId: {}, IP Address: {}.{}], Already Connected. Old Connection will be closed.", this.clusterConfig.getId(), clusterId, ipAddress, clientPort);

+ 12 - 16
its-cluster/src/main/java/com/its/common/cluster/service/ClusterSlave.java

@@ -4,6 +4,7 @@ import com.its.common.cluster.codec.ClusterMessageDecoder;
 import com.its.common.cluster.codec.ClusterMessageEncoder;
 import com.its.common.cluster.config.AbstractClusterConfig;
 import com.its.common.cluster.handler.ClusterSlaveHandler;
+import com.its.common.cluster.utils.ClusterUtils;
 import com.its.common.cluster.vo.ClusterNode;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.*;
@@ -47,9 +48,8 @@ public class ClusterSlave implements Callable<Object> {
         try {
             initializeBootstrapIfNeeded();
 
-            if (this.clusterConfig.isLogging()) {
-                log.info("ClusterNodeId: {}, ClusterSlave.call: Try Connect: toClusterId: {}, [{}.{}]", this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port);
-            }
+            log.info("ClusterNodeId: {}, ClusterSlave.call: Try Connect: toClusterId: {}, [{}.{}]",
+                    this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port);
 
             closePreviousChannel();
 
@@ -73,7 +73,7 @@ public class ClusterSlave implements Callable<Object> {
             return this.channelFuture != null && this.channelFuture.isSuccess();
         } catch (Exception e) {
             log.error("ClusterNodeId: {}, ClusterSlave.call: Connection error toClusterId: {}, [{}.{}], Exception: {}",
-                    this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port, e.getMessage(), e);
+                    this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port, e.getMessage());
             return false;
         }
     }
@@ -83,9 +83,8 @@ public class ClusterSlave implements Callable<Object> {
             return;
         }
 
-        if (this.clusterConfig.isLogging()) {
-            log.info("ClusterNodeId: {}, ClusterSlave.call: Startup: toClusterId: {}, [{}.{}]", this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port);
-        }
+        log.info("ClusterNodeId: {}, ClusterSlave.call: Startup: toClusterId: {}, [{}.{}]",
+                this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port);
 
         this.bootstrap = bootstrapFactory.createBootstrap();
         this.bootstrap.option(ChannelOption.SO_REUSEADDR, true);
@@ -126,14 +125,12 @@ public class ClusterSlave implements Callable<Object> {
             channel.attr(AbstractClusterConfig.CLUSTER_ATTRIBUTE_KEY).set(this.clusterNode);
             this.clusterNode.getSyncState().connect(channel);
 
-            if (this.clusterConfig.isLogging()) {
-                log.info("ClusterNodeId: {}, ClusterSlave.channelOpen: toClusterId: {}, [{}.{}], Channel: {}", this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port, channel);
-            }
+            log.info("ClusterNodeId: {}, ClusterSlave.channelOpen: toClusterId: {}, [{}.{}], Channel: {}",
+                    this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port, ClusterUtils.getRemoteIpAddress(channel));
         }
         else {
-            if (this.clusterConfig.isLogging()) {
-                log.warn("ClusterNodeId: {}, ClusterSlave.channelOpen: toClusterId: {}, [{}.{}], Failed: {}", this.clusterConfig.getId(), clusterNode.getId(), clusterNode.getIp(), clusterNode.getPort(), future.cause().getMessage());
-            }
+            log.warn("ClusterNodeId: {}, ClusterSlave.channelOpen: toClusterId: {}, [{}.{}], Failed: {}",
+                    this.clusterConfig.getId(), clusterNode.getId(), clusterNode.getIp(), clusterNode.getPort(), future.cause().getMessage());
         }
     }
 
@@ -143,9 +140,8 @@ public class ClusterSlave implements Callable<Object> {
     protected synchronized void channelClosed(ChannelFuture future) {
         Channel channel = future.channel();
 
-        if (this.clusterConfig.isLogging()) {
-            log.warn("ClusterNodeId: {}, ClusterSlave.channelClosed: toClusterId: {}, [{}.{}], Channel: {}", this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port, channel);
-        }
+        log.warn("ClusterNodeId: {}, ClusterSlave.channelClosed: toClusterId: {}, [{}.{}], Channel: {}",
+                this.clusterConfig.getId(), this.clusterNode.getId(), this.ipAddress, this.port, ClusterUtils.getRemoteIpAddress(channel));
 
         channel.attr(AbstractClusterConfig.CLUSTER_ATTRIBUTE_KEY).set(null);
         this.clusterNode.getSyncState().disConnect();