public final class ClusterConfig extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ARCHIVE_CONTROL_PORT_OFFSET |
static String |
ARCHIVE_SUB_DIR |
static int |
CLIENT_FACING_PORT_OFFSET |
static String |
CLUSTER_SUB_DIR |
static int |
LOG_PORT_OFFSET |
static int |
MEMBER_FACING_PORT_OFFSET |
static int |
PORTS_PER_NODE |
static int |
TRANSFER_PORT_OFFSET |
| Modifier and Type | Method and Description |
|---|---|
AeronArchive.Context |
aeronArchiveContext()
Gets the configuration's aeron archive context.
|
void |
aeronDirectoryName(String aeronDir)
Set the aeron directory for all configuration contexts.
|
Archive.Context |
archiveContext()
Gets the configuration's archive context.
|
void |
baseDir(File baseDir)
Set the base directory for cluster and archive.
|
static int |
calculatePort(int nodeId,
int portBase,
int offset)
Calculates a port for use with a node based on a specific offset.
|
ClusteredServiceContainer.Context |
clusteredServiceContext()
Gets the configuration's clustered service container context.
|
List<ClusteredServiceContainer.Context> |
clusteredServiceContexts()
Gets the configuration's list of clustered service container contexts.
|
String |
clusterHostname()
Hostname of this node that will receive cluster traffic.
|
static String |
clusterMembers(int startingMemberId,
List<String> ingressHostnames,
List<String> clusterHostnames,
int portBase)
String representing the cluster members configuration which can be used for
ClusterMember.parse(String). |
static String |
clusterMembers(List<String> ingressHostnames,
List<String> clusterHostnames,
int portBase)
String representing the cluster members configuration which can be used for
ClusterMember.parse(String). |
ConsensusModule.Context |
consensusModuleContext()
Gets the configuration's consensus module context.
|
static ClusterConfig |
create(int startingMemberId,
int memberId,
List<String> ingressHostnames,
List<String> clusterHostnames,
int portBase,
File parentDir,
ClusteredService clusteredService,
ClusteredService... additionalServices)
Create a new ClusterConfig.
|
static ClusterConfig |
create(int nodeId,
List<String> hostnames,
int portBase,
ClusteredService clusteredService)
Create a new ClusterConfig.
|
static ClusterConfig |
create(int nodeId,
List<String> ingressHostnames,
List<String> clusterHostnames,
int portBase,
ClusteredService clusteredService,
ClusteredService... additionalServices)
Create a new ClusterConfig.
|
void |
errorHandler(ErrorHandler errorHandler)
Set the same error handler for all contexts.
|
static String |
ingressEndpoints(int startingMemberId,
List<String> hostnames,
int portBase,
int clientFacingPortOffset)
Ingress endpoints generated from a list of hostnames.
|
static String |
ingressEndpoints(List<String> hostnames,
int portBase,
int clientFacingPortOffset)
Ingress endpoints generated from a list of hostnames.
|
String |
ingressHostname()
Hostname of this node that will receive ingress traffic.
|
MediaDriver.Context |
mediaDriverContext()
Gets the configuration's media driver context.
|
int |
memberId()
memberId of this node.
|
public static final int PORTS_PER_NODE
public static final int ARCHIVE_CONTROL_PORT_OFFSET
public static final int CLIENT_FACING_PORT_OFFSET
public static final int MEMBER_FACING_PORT_OFFSET
public static final int LOG_PORT_OFFSET
public static final int TRANSFER_PORT_OFFSET
public static final String ARCHIVE_SUB_DIR
public static final String CLUSTER_SUB_DIR
public static ClusterConfig create(int startingMemberId, int memberId, List<String> ingressHostnames, List<String> clusterHostnames, int portBase, File parentDir, ClusteredService clusteredService, ClusteredService... additionalServices)
startingMemberId - id for the first member in the list of entries.memberId - id for this node.ingressHostnames - list of hostnames that will receive ingress request traffic.clusterHostnames - list of hostnames that will receive cluster traffic.portBase - base port to derive remaining ports from.parentDir - directory under which the persistent directories will be created.clusteredService - instance of the clustered service that will run with this configuration.additionalServices - instances of additional clustered services that will run with this configuration.public static ClusterConfig create(int nodeId, List<String> ingressHostnames, List<String> clusterHostnames, int portBase, ClusteredService clusteredService, ClusteredService... additionalServices)
nodeId - id for this node.ingressHostnames - list of hostnames that will receive ingress request traffic.clusterHostnames - list of hostnames that will receive cluster traffic.portBase - base port to derive remaining ports from.clusteredService - instance of the clustered service that will run with this configuration.additionalServices - instances of additional clustered services that will run with this configuration.public static ClusterConfig create(int nodeId, List<String> hostnames, int portBase, ClusteredService clusteredService)
nodeId - id for this node.hostnames - list of hostnames that will receive ingress request and cluster traffic.portBase - base port to derive remaining ports from.clusteredService - instance of the clustered service that will run on this node.public void errorHandler(ErrorHandler errorHandler)
errorHandler - to receive errors.public void aeronDirectoryName(String aeronDir)
aeronDir - directory to use for aeron.public void baseDir(File baseDir)
baseDir - parent directory to be used for archive and cluster stored data.public MediaDriver.Context mediaDriverContext()
MediaDriver.Context.MediaDriver.Contextpublic Archive.Context archiveContext()
Archive.Context.Archive.Contextpublic AeronArchive.Context aeronArchiveContext()
Archive.Context.AeronArchive.Contextpublic ConsensusModule.Context consensusModuleContext()
ConsensusModule.Context.ConsensusModule.Contextpublic ClusteredServiceContainer.Context clusteredServiceContext()
ClusteredServiceContainer.Context.ClusteredServiceContainer.Contextpublic List<ClusteredServiceContainer.Context> clusteredServiceContexts()
ClusteredServiceContainer.Context.ClusteredServiceContainer.Contextpublic int memberId()
public String ingressHostname()
public String clusterHostname()
public static String clusterMembers(List<String> ingressHostnames, List<String> clusterHostnames, int portBase)
ClusterMember.parse(String).ingressHostnames - of the cluster members.clusterHostnames - of the cluster members internal address (can be the same as 'hostnames').portBase - initial port to derive other port from via appropriate node id and offset.ClusterMember.parse(String).public static String clusterMembers(int startingMemberId, List<String> ingressHostnames, List<String> clusterHostnames, int portBase)
ClusterMember.parse(String).startingMemberId - first memberId to be used in the list of clusterMembers. The memberId will increment by 1
from that value for each entry.ingressHostnames - of the cluster members.clusterHostnames - of the cluster members internal address (can be the same as 'hostnames').portBase - initial port to derive other port from via appropriate node id and offset.ClusterMember.parse(String).public static String ingressEndpoints(List<String> hostnames, int portBase, int clientFacingPortOffset)
hostnames - for the cluster members.portBase - Base port for the clusterclientFacingPortOffset - Offset for the client facing portpublic static String ingressEndpoints(int startingMemberId, List<String> hostnames, int portBase, int clientFacingPortOffset)
startingMemberId - first memberId to be used when generating the ports.hostnames - for the cluster members.portBase - Base port for the clusterclientFacingPortOffset - Offset for the client facing portpublic static int calculatePort(int nodeId,
int portBase,
int offset)
ARCHIVE_CONTROL_PORT_OFFSET or with custom offsets. For custom offsets select a value
larger than largest predefined offsets. A value larger than the largest predefined offset, but less than
PORTS_PER_NODE is required.nodeId - The id for the member of the cluster.portBase - The port base to be used.offset - The offset to add onto the port baseCopyright © 2014-2023 Real Logic Limited. All Rights Reserved.