|
|
@@ -16,16 +16,17 @@ public abstract class AbstractClusterConfig {
|
|
|
|
|
|
public static final AttributeKey<ClusterNode> CLUSTER_ATTRIBUTE_KEY = AttributeKey.valueOf("clusterInfo");
|
|
|
|
|
|
- private boolean enabled = false; // 클러스터 기능 사용 여부
|
|
|
+ private boolean enabled = true; // 클러스터 기능 사용 여부
|
|
|
// 어플리케이션 클러스터 정보
|
|
|
- private boolean master = false;
|
|
|
+ private boolean master = true;
|
|
|
private int id = -1; // 서버 ID (1부터 시작, 0은 사용하지 않음)
|
|
|
- private int syncSeconds = -1; // 데이터 동기화 주기 (초 단위, 최소 5초, 최대 60초)
|
|
|
+ private int syncSeconds = 5; // 데이터 동기화 주기 (초 단위, 기본 5초, 최소 2초, 최대 60초)
|
|
|
private String ip = "127.0.0.1"; // 클러스터 서버의 IP 주소
|
|
|
private int port = 13888; // 데이터 동기화를 위한 포트
|
|
|
private boolean logging = false; // 라이브러리 내 로깅 여부
|
|
|
private boolean packetLogging = false; // 패킷 로깅 여부
|
|
|
private List<ClusterNode> nodes;
|
|
|
+ private ClusterNode myCluster;
|
|
|
|
|
|
private final HashMap<Integer, ClusterNode> clusterMap = new HashMap<>();
|
|
|
|
|
|
@@ -75,6 +76,7 @@ public abstract class AbstractClusterConfig {
|
|
|
masterNode.setLogging(this.logging);
|
|
|
masterNode.setPacketLogging(this.packetLogging);
|
|
|
this.nodes.add(masterNode);
|
|
|
+ this.myCluster = masterNode;
|
|
|
this.enabled = false;
|
|
|
|
|
|
// 나 자신의 네트워크 상태정보를 항상 CONNECT로 지정
|
|
|
@@ -155,6 +157,7 @@ public abstract class AbstractClusterConfig {
|
|
|
ClusterNode localNode = this.clusterMap.get(this.id);
|
|
|
localNode.getElectionState().connect(null);
|
|
|
localNode.getSyncState().connect(null);
|
|
|
+ this.myCluster = localNode;
|
|
|
return true;
|
|
|
}
|
|
|
|