This is an automated email from the ASF dual-hosted git repository. apkhmv pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push: new 7dc5ebfbcd IGNITE-21510: Add documentation how to start multiple nodes (#3199) 7dc5ebfbcd is described below commit 7dc5ebfbcd27a250fb25354d6613c832c44c0152 Author: Aleksandr Pakhomov <apk...@gmail.com> AuthorDate: Mon Feb 12 21:50:58 2024 +0300 IGNITE-21510: Add documentation how to start multiple nodes (#3199) --- DEVNOTES.md | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- README.md | 48 +++++++++++++++++---- 2 files changed, 171 insertions(+), 15 deletions(-) diff --git a/DEVNOTES.md b/DEVNOTES.md index 68902bca0b..e629d5fe59 100644 --- a/DEVNOTES.md +++ b/DEVNOTES.md @@ -164,27 +164,29 @@ High-level modules structure and detailed modules description can be found in th ## Packaging +> Change the `<version>` placeholder into the version you'd like to use. + ### Zip packaging ```shell -./gradlew clean allDistZip -x check +./gradlew clean allDistZip ``` Uber zip package will be located in `packaging/build/distributions`. If you wand to build CLI, you can do it with: ```shell -./gradlew clean packaging-cli:distZip -x check +./gradlew clean packaging-cli:distZip ``` Zip package will be located in `packaging/cli/build/distributions`. -For ignite-runner: +For Ignite node: ```shell -./gradlew clean packaging-db:distZip -x check +./gradlew clean packaging-db:distZip ``` Zip package will be located in `packaging/db/build/distributions`. You can build zip and run CLI with the following commands: ```shell -./gradlew clean packaging-cli:distZip -x test -x check +./gradlew clean packaging-cli:distZip cd packaging/cli/build/distributions unzip ignite3-cli-<version> cd ignite3-cli-<version> @@ -193,7 +195,7 @@ cd ignite3-cli-<version> To build a zip file with ignite-runner and run it: ```shell -./gradlew clean packaging-db:distZip -x test -x check +./gradlew clean packaging-db:distZip cd packaging/db/build/distributions unzip ignite3-db-<version> cd ignite3-db-<version> @@ -274,6 +276,130 @@ docker run -it --rm --net ignite3_default apacheignite/ignite3 cli > cluster init --cluster-name cluster --meta-storage-node node1 > --meta-storage-node node2 --meta-storage-node node3 ``` +### How to launch multiple nodes on the same machine + +The easiest way to start as many nodes as you want is to use the docker-compose file located in the `packaging/docker` directory. +If instead you want to start nodes manually, you can use the following commands: + + +```shell +./gradlew clean allDistZip +mkdir ignite-3-cluster +cd ignite-3-cluster +unzip ../packaging/build/distributions/ignite3-<version>.zip +``` +This is what you've already done when you've launched single-node Ignite cluster. Now you need to copy node directory as many times as you +want to start nodes. Then you need to change the name of the node in the `etc/ignite-config.conf` file in each node directory. + +Let's first rename current node directory to `node1` and copy it to `node2` and `node3`: +```shell +mv ignite3-db-<version> node1 +cp -r node1 node2 +cp -r node1 node3 +``` + +After that you have to change the name of the node in `etc/vars.env` file in each node directory: + +Linux: +```shell +sed -i 's/NODE_NAME=defaultNode/NODE_NAME=node1/' node1/etc/vars.env +sed -i 's/NODE_NAME=defaultNode/NODE_NAME=node2/' node2/etc/vars.env +sed -i 's/NODE_NAME=defaultNode/NODE_NAME=node3/' node3/etc/vars.env +``` + +MacOS: +```shell +sed -i '' 's/NODE_NAME=defaultNode/NODE_NAME=node1/' node1/etc/vars.env +sed -i '' 's/NODE_NAME=defaultNode/NODE_NAME=node2/' node2/etc/vars.env +sed -i '' 's/NODE_NAME=defaultNode/NODE_NAME=node3/' node3/etc/vars.env +``` + +Each node binds to its set of ports: HTTP, HTTPS(if configured), internal TCP for communication between nodes, and client TCP. +By default the following configuration is used: +``` +clientConnector.port = 10800, +network.port = 3344, +rest: { port = 10300, ssl.port = 10400 } +``` +If you want to start nodes on the same machine, you have to change the ports in the `etc/ignite-config.conf` file in each node directory. + +You can do it manually or use the following commands: + +Linux: +```shell +sed -i 's/port=10300/port=10301/' node1/etc/ignite-config.conf +sed -i 's/port=10300/port=10302/' node2/etc/ignite-config.conf +sed -i 's/port=10300/port=10303/' node3/etc/ignite-config.conf + +sed -i 's/port=3344/port=3301/' node1/etc/ignite-config.conf +sed -i 's/port=3344/port=3302/' node2/etc/ignite-config.conf +sed -i 's/port=3344/port=3303/' node3/etc/ignite-config.conf + +sed -i 's/port=10800/port=10801/' node1/etc/ignite-config.conf +sed -i 's/port=10800/port=10802/' node2/etc/ignite-config.conf +sed -i 's/port=10800/port=10803/' node3/etc/ignite-config.conf + +sed -i '/netClusterNodes=\[/,/\]/s/"localhost:3344"/"localhost:3301", "localhost:3302", "localhost:3303"/' node1/etc/ignite-config.conf +sed -i '/netClusterNodes=\[/,/\]/s/"localhost:3344"/"localhost:3301", "localhost:3302", "localhost:3303"/' node2/etc/ignite-config.conf +sed -i '/netClusterNodes=\[/,/\]/s/"localhost:3344"/"localhost:3301", "localhost:3302", "localhost:3303"/' node3/etc/ignite-config.conf +``` + +MacOS: +```shell +sed -i '' 's/port=10300/port=10301/' node1/etc/ignite-config.conf +sed -i '' 's/port=10300/port=10302/' node2/etc/ignite-config.conf +sed -i '' 's/port=10300/port=10303/' node3/etc/ignite-config.conf + +sed -i '' 's/port=3344/port=3301/' node1/etc/ignite-config.conf +sed -i '' 's/port=3344/port=3302/' node2/etc/ignite-config.conf +sed -i '' 's/port=3344/port=3303/' node3/etc/ignite-config.conf + +sed -i '' 's/port=10800/port=10801/' node1/etc/ignite-config.conf +sed -i '' 's/port=10800/port=10802/' node2/etc/ignite-config.conf +sed -i '' 's/port=10800/port=10803/' node3/etc/ignite-config.conf + +sed -i '' '/netClusterNodes=\[/,/\]/s/"localhost:3344"/"localhost:3301", "localhost:3302", "localhost:3303"/' node1/etc/ignite-config.conf +sed -i '' '/netClusterNodes=\[/,/\]/s/"localhost:3344"/"localhost:3301", "localhost:3302", "localhost:3303"/' node2/etc/ignite-config.conf +sed -i '' '/netClusterNodes=\[/,/\]/s/"localhost:3344"/"localhost:3301", "localhost:3302", "localhost:3303"/' node3/etc/ignite-config.conf +``` + +Now all the nodes are set up and you can start them with the following commands: + +```shell +./node1/bin/ignite3db start +./node2/bin/ignite3db start +./node3/bin/ignite3db start +``` + +After that connect to any node with CLI: +```shell +./ignite3-cli-<version>/bin/ignite3 connect http://localhost:10301 +``` + +Then you can check that all nodes see each other: + +```shell +cluster topology physical +``` + +To initialize a cluster run the following command inside Ignite CLI: + +```shell +cluster init + --cluster-name myClusterOfThreeNodes + --cmg-node node1 --cmg-node node2 --cmg-node node3 + --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 +``` + +To stop all nodes: + +```shell +./node1/bin/ignite3db stop +./node2/bin/ignite3db stop +./node3/bin/ignite3db stop +``` + + ### Run Swagger UI with docker-compose To run Swagger UI in docker, run the following command: diff --git a/README.md b/README.md index 66971bdd2c..8d26ff866a 100644 --- a/README.md +++ b/README.md @@ -32,23 +32,42 @@ Latest release artifacts (source release and binary packages) are [available](ht ### Run Ignite from released artifact -To start Ignite you need to download latest zip archive from the [Ignite web page](https://ignite.apache.org/download.cgi). -After unpacking it, go to the ignite3-db-3.0.0-beta1 folder and run the following command: +To start Ignite you need to download latest zip archive from the [Ignite web page](https://ignite.apache.org/download.cgi). +Scroll down to the "Binary releases" section and download the version you are interested in. +Here is the command you can run to download current latest release: + +```shell +https://dlcdn.apache.org/ignite/3.0.0-beta1/ignite3-3.0.0-beta1.zip ``` -bin/ignite3db start + +```shell +unzip ignite3-3.0.0-beta1.zip ``` +After this you should have two directories: `ignite3-db-3.0.0-<version>` and `ignite3-cli-3.0.0-<version>`. +The first one contains everything you need to start Ignite node, and the second one contains Ignite CLI tool. -After that you need to connect to your node with Ignite CLI: +After unpacking it, go to the `ignite3-db-3.0.0-<version>` folder and run the following command: +```shell +cd ignite3-db-3.0.0-beta1 +./bin/ignite3db start ``` -ignite3-cli-3.0.0-beta1/bin/ignite3 + +This command starts the Ignite node with the name `defaultNode`. +If you want to change any node configuration, change values in `etc/ignite-config.conf` before the start. + +After that you need to connect to your node with Ignite CLI in interactive mode: + +```shell +cd ../ignite3-cli-3.0.0-beta1 +./bin/ignite3 ``` In CLI you need to initialize simple cluster via the following command: ``` -cluster init -n=sampleCluster -m=defaultNode +cluster init --cluster-name myCluster --cmg-node defaultNode --meta-storage-node defaultNode ``` Now CLI can be switched into SQL interactive mode with command: @@ -70,22 +89,33 @@ SELECT * FROM Person; Ignite distributive zip archive can be built with [Gradle](https://gradle.org/): -``` +```shell ./gradlew clean distZip ``` -Build artifacts can be found in packaging/db and packaging/cli directories. +Build artifacts can be found in `packaging/db` and `packaging/cli` directories. ## Run from source using Docker Ignite can be started with the help of Docker: -``` +```shell ./gradlew docker cd packaging/docker docker compose up -d ``` +You can also run the CLI within the Docker: + +```shell +docker run -it --rm --net ignite3_default apacheignite/ignite3 cli +``` + +``` +> connect http://node1:10300 +> cluster init --cluster-name cluster --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 +``` + For more information, you can check the [Developer notes](./DEVNOTES.md) ## Contribute