Hi,
I am implementing distributed crawler engine using ignite in embedded mode.
Each crawler node have persistence enabled and assigned predefined
consistentId (dev-1, dev-2, dev-3, etc). Baseline topology (nodes which
store data) can change and configured using config file like this:
# Cluster settings
cluster {
# Baseline topology (list of node ids which store data)
baseline = [
"dev-1",
"dev-2",
"dev-3"
]
}
Each crawler node startup implemented like this:
// Start ignite
ignite = Ignition.start(igniteConfig)
// Activate
ignite.cluster().active(true)
// Validate baseline topology
val baseline =
config.getStringAll(SpiderNodeOptions.CLUSTER_BASELINE).toSet()
val curTopology = ignite.cluster().currentBaselineTopology()
if (curTopology == null || baseline != curTopology.map {
it.consistentId().toString() }.toSet()) {
// Wait for all new topology members to join
log.info("Cluster baseline topology changed - waiting data nodes
to join...")
while (true) {
val nodes = mutableListOf<ClusterNode>()
ignite.cluster().nodes().forEach {
if (baseline.contains(it.consistentId().toString()))
nodes.add(it)
}
if (nodes.size == baseline.size) {
log.info("Updated baseline topology of {} nodes",
value("baseline_size", nodes.size))
ignite.cluster().setBaselineTopology(nodes)
break
}
else
Thread.sleep(1000)
}
}
We can't set baseline topology before cluster activation so activate()
called first. Is it possible to set baseline topology without activating
cluster for first time ? Is it safe to activate node with the code above ?
It seems that we have misconfigured state in clean cluster between
activate() and waiting nodes to join when setBaseliteTopology not called
yet. The steps for upgrading topology will be 1) modify and commit config
files 2) shutdown all cluster members 3) update code 4) start each node one
by one. Is this the right way of reconfiguration ?
Thanks,
Michael