Skip to content

Commit

Permalink
IGNITE-22108 Rename options in CLI (apache#3750)
Browse files Browse the repository at this point in the history
Some options were reviewed. For example, cluster-name
-> name. Also, short options that clash with each other
are dropped.
  • Loading branch information
PakhomovAlexander authored May 22, 2024
1 parent 18434f2 commit 5fb15c2
Show file tree
Hide file tree
Showing 58 changed files with 278 additions and 351 deletions.
4 changes: 2 additions & 2 deletions DEVNOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ the docker image using `cli` parameter and connect to nodes using their names fr
docker compose -f packaging/docker/docker-compose.yml up -d
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
> cluster init --name cluster --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3
```

### How to launch multiple nodes on the same machine
Expand Down Expand Up @@ -388,7 +388,7 @@ To initialize a cluster run the following command inside Ignite CLI:

```shell
cluster init
--cluster-name myClusterOfThreeNodes
--name myClusterOfThreeNodes
--cmg-node node1 --cmg-node node2 --cmg-node node3
--meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3
```
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cd ../ignite3-cli-3.0.0-beta1
In CLI you need to initialize simple cluster via the following command:

```
cluster init --cluster-name myCluster --cmg-node defaultNode --meta-storage-node defaultNode
cluster init --name myCluster --cmg-node defaultNode --meta-storage-node defaultNode
```

Now CLI can be switched into SQL interactive mode with command:
Expand Down Expand Up @@ -113,7 +113,7 @@ 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
> cluster init --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)
Expand Down
2 changes: 1 addition & 1 deletion assembly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ To run any other example, do the following:
```
4. (optional) If the cluster is not initialized then initialize the cluster:
```
ignite3 cluster init --cluster-name=ignite-cluster --cluster-endpoint-url=http://localhost:10300 --meta-storage-node=defauldNode
ignite3 cluster init --name=ignite-cluster --url=http://localhost:10300 --meta-storage-node=defauldNode
```
5. Run the preferred example in the IDE.

Expand Down
6 changes: 3 additions & 3 deletions docs/_docs/administrators-guide/config/memory-quotas.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ By default, a quota for SQL queries is set to 60% of the heap memory available t

[source, bash]
----
node config update --node-url http://localhost:10300 {sql.nodeMemoryQuota:"1000M"}
node config update --url http://localhost:10300 {sql.nodeMemoryQuota:"1000M"}
----

If the node memory quota is exceeded, the query is interrupted and the `SQL query ran out of memory: Node quota was exceeded` error is returned.
Expand All @@ -43,7 +43,7 @@ By default, each individual query can use the entire memory quota. This may be u

[source, bash]
----
cluster config update --cluster-endpoint-url http://localhost:10300 {sql.statementMemoryQuota:"10M"}
cluster config update --url http://localhost:10300 {sql.statementMemoryQuota:"10M"}
----

If the statement memory quota is exceeded, the query is interrupted and the `SQL query ran out of memory: Statement quota was exceeded` error is returned.
If the statement memory quota is exceeded, the query is interrupted and the `SQL query ran out of memory: Statement quota was exceeded` error is returned.
60 changes: 30 additions & 30 deletions docs/_docs/ignite-cli-tool.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ These commands help you configure your CLI tool and cluster.
| `cli config profile show` | | Gets the current profile details.
| `cli config get` | `<key>` | Gets the value for the specified configuration key.
| `cli config set` | `<key=value>` | Sets configuration parameters using comma-separated input key-value pair(s).
| `cli config show` | `[--cluster-endpoint-url] [--selector]` | Shows the cluster configuration.
| `cli config show` | `[--url] [--selector]` | Shows the cluster configuration.
| `cli config remove` | `<key>` | Removes a configuration key.
|===

Expand All @@ -63,14 +63,14 @@ These commands let you manage your cluster.
[cols="1,1,3",opts="header", stripes=none]
|===
| Command| Parameters | Description
| `cluster init` | `[--cmg-node] [--meta-storage-node] <clusterName> or < --cluster-endpoint-url> <cluster-config> or < --cluster-config-file>`| Initializes a cluster.
| `cluster status` | `[--cluster-endpoint-url]` | Displays the detailed status of the specified cluster.
| `cluster topology physical` | `[--plain] [--cluster-endpoint-url]` | Shows physical topology of the specified cluster.
| `cluster topology logical` | `[--plain] [--cluster-endpoint-url]` | Shows logical topology of the specified cluster.
| `cluster init` | `[--cmg-node] [--meta-storage-node] <clusterName> or < --url> <cluster-config> or < --config-file>`| Initializes a cluster.
| `cluster status` | `[--url]` | Displays the detailed status of the specified cluster.
| `cluster topology physical` | `[--plain] [--url]` | Shows physical topology of the specified cluster.
| `cluster topology logical` | `[--plain] [--url]` | Shows logical topology of the specified cluster.
| `cluster unit deploy` | `[clusterUrl] [--nodes] <path> <version> <id>` | Deploys a unit for the cluster.
| `cluster unit undeploy` | `[clusterUrl] <version> <id>` | Undeploys a cluster's unit.
| `cluster unit list` | `[--plain] [clusterUrl] [--status] [<unitId>[--version]]` | Lists cluster's deployed units.
| `connect` | `[--username] [--password] --node-url[--node-name]` | Connects to the specified cluster, or to `localhost:3000` if no cluster is specified. All subsequent commands use the specified cluster URL.
| `connect` | `[--username] [--password] --url[--node]` | Connects to the specified cluster, or to `localhost:3000` if no cluster is specified. All subsequent commands use the specified cluster URL.
| `disconnect` || Disconnects from the current cluster.
|===

Expand All @@ -91,15 +91,15 @@ These commands address specific node(s) in a cluster.
[cols="1,1,3",opts="header", stripes=none]
|===
| Command| Parameters | Description
| `node config show` | `[--node-url]/[--node-name] [--selector]` | Gets the specified node configuration.
|`node config update` | `[--node-url]/[--node-name] [<args>...]` | Updates the local node configuration with the arguments in the HOCON format.
| `node status` | `[--node-url]/[--node-name]` |Shows the status of the default node, or a different one if specified.
| `node version` | `[--node-url]/[--node-name]` |Shows the node's build version.
| `node metric list` | `[--node-url]/[--node-name][--plain]` |Lists node's metrics.
| `node metric source enable` | `[--node-url]/[--node-name]<srcName>` |Enables a metric source for the node.
| `node metric source disable` | `[--node-url]/[--node-name]<srcName>` |Disables a metric source for the node.
| `node metric source list` | `[--node-url]/[--node-name][--plain]` |Lists node metrics' sources.
| `node unit list` | `[--plain] [--status] [<unitId> [--version]] [--node-url]/[--node-name]]` |Lists node's deployment units.
| `node config show` | `[--url]/[--node] [--selector]` | Gets the specified node configuration.
|`node config update` | `[--url]/[--node] [<args>...]` | Updates the local node configuration with the arguments in the HOCON format.
| `node status` | `[--url]/[--node]` |Shows the status of the default node, or a different one if specified.
| `node version` | `[--url]/[--node]` |Shows the node's build version.
| `node metric list` | `[--url]/[--node][--plain]` |Lists node's metrics.
| `node metric source enable` | `[--url]/[--node]<srcName>` |Enables a metric source for the node.
| `node metric source disable` | `[--url]/[--node]<srcName>` |Disables a metric source for the node.
| `node metric source list` | `[--url]/[--node][--plain]` |Lists node metrics' sources.
| `node unit list` | `[--plain] [--status] [<unitId> [--version]] [--url]/[--node]]` |Lists node's deployment units.
|===

=== User and Role Commands
Expand All @@ -109,19 +109,19 @@ These commands help you manage access to the system - users and and roles.
[cols="1,1,3",opts="header", stripes=none]
|===
| Command| Parameters | Description
|`role create`|`[--cluster-endpoint-url] <roleName>`| Creates a new role. New roles do not have any privileges.
|`role delete`|`[--cluster-endpoint-url] <roleName>`| Deletes the specified role. Role with assigned privileges cannot be deleted.
|`role list`|`[--plain] [--cluster-endpoint-url] [--user]`| Lists roles for the specified cluster, optionally filtered by user(s).
|`role show`|`[--with-privileges] [--with-users] [--cluster-endpoint-url] <roleName>`| Shows the role information, optionally including privileges assigned to the role and/or the users who have that role.
|`role privilege grant`|`[--on] [--cluster-endpoint-url] [--action] --to`| Grants to the specified role a privilege (permission to perform the specified action on an the specified object). For more information, see link:security/permissions[User Permissions and Roles].
|`role privilege revoke`|`[--action] [--from] [--cluster-endpoint-url] --to`|Revoke privilege(s) (permissions)(s) to perform the specified action on the specified object) from the role. For more information, see link:security/permissions[User Permissions and Roles].
|`role create`|`[--url] <roleName>`| Creates a new role. New roles do not have any privileges.
|`role delete`|`[--url] <roleName>`| Deletes the specified role. Role with assigned privileges cannot be deleted.
|`role list`|`[--plain] [--url] [--user]`| Lists roles for the specified cluster, optionally filtered by user(s).
|`role show`|`[--with-privileges] [--with-users] [--url] <roleName>`| Shows the role information, optionally including privileges assigned to the role and/or the users who have that role.
|`role privilege grant`|`[--on] [--url] [--action] --to`| Grants to the specified role a privilege (permission to perform the specified action on an the specified object). For more information, see link:security/permissions[User Permissions and Roles].
|`role privilege revoke`|`[--action] [--from] [--url] --to`|Revoke privilege(s) (permissions)(s) to perform the specified action on the specified object) from the role. For more information, see link:security/permissions[User Permissions and Roles].
| `user create` |`[--password] [cluster-endpoint-url] <username>` | Creates a new user.
| `user delete` |`[--cluster-endpoint-url] [--with-revoke] <username>`| Deletes the user.
| `user edit` |`[--password] [--cluster-endpoint-url] <username>` | Edits user configuration.
| `user list` |`[--plain] [--cluster-endpoint-url] [--role]`| Provides a list of users on the server, optionally filtered by role(s).
| `user show` |`[--with-roles] [--cluster-endpoint-url] <username>`| Provides extended information about the specific user, optionally with information about roles assigned to the user.
| `user role assign` | `[--profile] [--cluster-endpoint-url] [--role] [--to]`| Assigns role(s) to the specified user.
| `user role revoke` | `[--profile] [--cluster-endpoint-url] [--from] [--role]`| Revokes role(s) from the specified user.
| `user delete` |`[--url] [--with-revoke] <username>`| Deletes the user.
| `user edit` |`[--password] [--url] <username>` | Edits user configuration.
| `user list` |`[--plain] [--url] [--role]`| Provides a list of users on the server, optionally filtered by role(s).
| `user show` |`[--with-roles] [--url] <username>`| Provides extended information about the specific user, optionally with information about roles assigned to the user.
| `user role assign` | `[--profile] [--url] [--role] [--to]`| Assigns role(s) to the specified user.
| `user role revoke` | `[--profile] [--url] [--from] [--role]`| Revokes role(s) from the specified user.
|===

=== Miscellaneous Commands
Expand All @@ -134,7 +134,7 @@ These are general-purpose commands.
| `cls` || Clears the terminal.
| `exit` || Stops the current interactive session.
| `help` | `<command or command group>` | Provides information on available command groups, commands in the specified group, or for the specified command.
| `sql` | `[--plain] [jdbc-url] [--script-file] <command>`| Executes the specified SQL query (command) or teh queries included in the specified file, on the specified cluster.
|`token revoke`|`[--cluster-endpoint-url] [--profile] [--token\|--username]`| Revokes the link:security/jwt[JWT token]. Can revoke a specific token, or all tokens from the user.
| `sql` | `[--plain] [jdbc-url] [--file] <command>`| Executes the specified SQL query (command) or teh queries included in the specified file, on the specified cluster.
|`token revoke`|`[--url] [--profile] [--token\|--username]`| Revokes the link:security/jwt[JWT token]. Can revoke a specific token, or all tokens from the user.
| `version` || Displays the current CLI tool version.
|===
|===
8 changes: 4 additions & 4 deletions docs/_docs/quick-start/getting-started-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,21 @@ You can change your cluster or node configuration by using the Ignite CLI.
. To see the current configuration, run the following command:
+
----
node config show --node-url http://localhost:10300
node config show --url http://localhost:10300
----
+
This command prints the configuration file in the HOCON format. Note the `maxSize` value under `aimen.regions`.
+
. Request an increase of the `maxSize` value:
+
----
node config update --node-url http://localhost:10300 {aimem.regions:[{name:btree_volatile_region,maxSize:412000000}]}
node config update --url http://localhost:10300 {aimem.regions:[{name:btree_volatile_region,maxSize:412000000}]}
----
+
. To verify the result, run the `show` command again:
+
----
node config show --node-url http://localhost:10300
node config show --url http://localhost:10300
----
+
Note that `maxSize` has increased to the value you had requested.
Expand Down Expand Up @@ -187,4 +187,4 @@ bash bin\ignite3db stop
From here, you may want to:

* Check out the link:ignite-cli-tool[Ignite CLI Tool] page for more detail on supported commands
* Try out our link:https://github.com/apache/ignite-3/tree/main/examples[examples]
* Try out our link:https://github.com/apache/ignite-3/tree/main/examples[examples]
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>Run the example in the IDE.</li>
* <li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>
* Add configuration for a persistent data region of the PageMemory storage engine using the CLI tool (if not done yet):<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>
* Add configuration for a data region of the RocksDB storage engine using the CLI tool (if not done yet):<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>
* Add configuration for an in-memory data region of the PageMemory storage engine using the CLI tool (if not done yet):<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>Run the example in the IDE.</li>
* <li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>Run the example in the IDE.</li>
* <li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>Run the example in the IDE.</li>
* <li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>Run the example in the IDE.</li>
* <li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* </li>
* <li>
* Cluster initialization using the CLI tool (if not done yet):<br>
* {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
* </li>
* <li>Run the example in the IDE.</li>
* <li>
Expand Down
8 changes: 4 additions & 4 deletions modules/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Non-interactive (or non-REPL) command is a command that executes under `ignite` top command. Example of non-interactive command:

```bash
> ignite node status --node-url http://localhost:10300
> ignite node status --url http://localhost:10300
```

The non-REPL fronted is responsible for:
Expand All @@ -22,7 +22,7 @@ Interactive (or REPL, Read-Eval-Print-Loop) mode can be activated by `ignite` co

```bash
> ignite
[diconnected]> node status --node-url http://localhost:10300
[diconnected]> node status --url http://localhost:10300
```

The REPL frontend is responsible for:
Expand Down Expand Up @@ -57,9 +57,9 @@ Example [`SqlExceptionHandler`](src/main/java/org/apache/ignite/internal/cli/cor
### Flow

For the interactive mode there is a common situation when a user is not connected to any node and executes some command.
The user might forget to connect to the node and always type `--node-url` option instead of connecting to the node once and type only
The user might forget to connect to the node and always type `--url` option instead of connecting to the node once and type only
commands.
So, it is useful to ask the user if he/she wants to connect to the node with the last `--node-url` value.
So, it is useful to ask the user if he/she wants to connect to the node with the last `--url` value.

It might be implemented as several checks and read-line operations in every interactive command.
To avoid code duplication the [`Flow`](src/main/java/org/apache/ignite/internal/cli/core/flow/Flow.java) was introduced.
Expand Down
Loading

0 comments on commit 5fb15c2

Please sign in to comment.