sk0x50 commented on a change in pull request #394:
URL: https://github.com/apache/ignite-3/pull/394#discussion_r727191016
##########
File path:
examples/src/main/java/org/apache/ignite/example/rebalance/RebalanceExample.java
##########
@@ -19,56 +19,62 @@
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgnitionManager;
+import org.apache.ignite.client.IgniteClient;
import
org.apache.ignite.internal.schema.configuration.SchemaConfigurationConverter;
import org.apache.ignite.schema.SchemaBuilders;
import org.apache.ignite.schema.definition.ColumnType;
import org.apache.ignite.schema.definition.TableDefinition;
import org.apache.ignite.table.KeyValueView;
-import org.apache.ignite.table.Table;
import org.apache.ignite.table.Tuple;
/**
* This example demonstrates the data rebalance process.
- * The following sequence of events is emulated:
- *
- * <ul>
- * <li>Start 3 nodes (A, B and C)</li>
- * <li>Insert some data</li>
- * <li>Add 2 more nodes (D and E)</li>
- * <li>Set new baseline to (A, D, E)</li>
- * <li>Stop nodes B and C</li>
- * <li>Check that data is still available on the new configuration</li>
- * </ul>
- *
+ * <p>
+ * The example emulates the basic scenario when one starts a three-node
topology,
+ * inserts some data, and then scales out by adding two more nodes. After the
+ * topology is changed, the data is rebalanced and verified for correctness.
* <p>
* To run the example, do the following:
* <ol>
* <li>Import the examples project into you IDE.</li>
+ * <li>
+ * Start <b>two</b> nodes using the CLI tool:<br>
+ * {@code ignite node start
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}<br>
+ * {@code ignite node start
--config=$IGNITE_HOME/examples/config/ignite-config.json my-second-node}
+ * </li>
* <li>Run the example in the IDE.</li>
+ * <li>
+ * When requested, start another two nodes using the CLI tool:
+ * {@code ignite node start
--config=$IGNITE_HOME/examples/config/ignite-config.json
my-first-additional-node}<br>
+ * {@code ignite node start
--config=$IGNITE_HOME/examples/config/ignite-config.json
my-second-additional-node}
+ * </li>
+ * <li>Press {@code Enter} to resume the example.</li>
* </ol>
*/
public class RebalanceExample {
public static void main(String[] args) throws Exception {
- List<Ignite> nodes = new ArrayList<>();
-
- try {
- System.out.println("Starting server nodes... Logging to file:
ignite.log");
-
- System.setProperty("java.util.logging.config.file",
"config/java.util.logging.properties");
-
- for (int i = 0; i < 3; i++) {
- nodes.add(IgnitionManager.start("node-" + i,
- Files.readString(Path.of("config", "rebalance",
"ignite-config-" + i + ".json")),
- Path.of("work" + i)));
- }
-
- Ignite node0 = nodes.get(0);
-
+
//--------------------------------------------------------------------------------------
+ //
+ // Starting a server node.
+ //
+ // NOTE: An embedded server node is only needed to invoke the
'createTable' API.
+ // In the future releases, this API will be available on the
client,
+ // eliminating the need to start an embedded server node in this
example.
+ //
+
//--------------------------------------------------------------------------------------
+
+ System.out.println("Starting a server node... Logging to file:
ignite.log");
Review comment:
```suggestion
System.out.println("Starting a server node... Logging to file:
example-node.log");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]