Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ The GridDB CLI provides command line interface tool to manage GridDB cluster ope
Building and program execution are checked in the environment below.

OS: CentOS 7.9(x64)
GridDB Server: V5.3 CE(Community Edition)
Java: Java™ SE Development Kit 11 (OpenJDK 11.0.19)
GridDB Server: V5.5 CE(Community Edition)
Java: OpenJDK 1.8.0

## Quick start from CLI Source Code

Expand Down
83 changes: 83 additions & 0 deletions Specification_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,89 @@ Set whether to execute count query when SQL querying.
[Memo]
- If FALSE is specified, the response will be faster instead of displaying no hit count. The execution time is not affected by this setting.


### Query result display format setting

Set the result display format before executing SQL or TQL statements.

- Sub-command

| |
| -------------------------- |
| setresultformat \<FORMAT\> |

- Argument

| Argument | Note |
| ---------- | ------------------------------------ |
| FORMAT | The result format is to be displayed. Can be set to `TABLE` or `CSV`. Default is `TABLE`.|

- Example

```example
gs[public]> sql SELECT '1+1' AS expr, '2' AS ans;
1 results. (4 ms)
gs[public]> get
+------+-----+
| expr | ans |
+------+-----+
| 1+1 | 2 |
+------+-----+
The 1 results had been acquired.
gs[public]>
```

\[Memo\]

- Display format is always CSV when EXPLAIN is executed.

### Set maximum width for display table

Set the maximum width for column in query result if the format is TABLE.
When setting the max width to column, the overflow text will be displayed with three trailing dots `...`.

- Sub-command

| |
| --------------------------- |
| setresultmaxwidth \<MAX_COLUMN_WIDTH\> |

- Argument

| Argument | Note |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------- |
| MAX_COLUMN_WIDTH | The length of displayed text, including `...` when the text is longer than the setting width. Must be integer (value ≥ 1). Default is 31. |

- Example

```example
gs[public]> sql SELECT * FROM product;
3 results. (44 ms)

gs[public]> get
+--------------------------+-----------------+---------+---------------------------------------------------------+
| time | name | weight | note |
+--------------------------+-----------------+---------+---------------------------------------------------------+
| 2023-07-04T07:46:27.415Z | apple | 9.99 | Envy |
| 2023-07-04T07:47:02.731Z | chia | 0.1 | Chia seed from Australia |
| 2023-07-04T07:50:33.437Z | water and light | 0.0 | Hats off to Geoff Adams, who made this mini-documentary |
+--------------------------+-----------------+---------+---------------------------------------------------------+
The 3 results had been acquired.

gs[public]> setresultmaxwidth 24
gs[public]> sql SELECT * from product;
3 results. (44 ms)

gs[public]> get
+--------------------------+-----------------+---------+--------------------------+
| time | name | weight | note |
+--------------------------+-----------------+---------+--------------------------+
| 2023-07-04T07:46:27.415Z | apple | 9.99 | Envy |
| 2023-07-04T07:47:02.731Z | chia | 0.1 | Chia seed from Australia |
| 2023-07-04T07:50:33.437Z | water and light | 0.0 | Hats off to Geoff Ada... |
+--------------------------+-----------------+---------+--------------------------+
The 3 results had been acquired.
```


## Database management
Expand Down
200 changes: 189 additions & 11 deletions Specification_ja.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# クラスタ運用管理コマンド・インタプリタ(gs_sh)

## 概要
Expand Down Expand Up @@ -25,12 +26,41 @@ gs_shを利用するには、あらかじめ以下を実施ください。
- ユーザ作成
- ネットワーク設定(GridDBクラスタ定義ファイル、ノード定義ファイル)

 ※ 手順の詳細に関しては、[GridDB クイックスタートガイド](https://github.com/griddb/docs-ja/blob/master/manuals/GridDB_QuickStartGuide/toc.md)を参照してください
 ※ 手順の詳細に関しては、[GridDB クイックスタートガイド](https://github.com/griddb/docs-ja/blob/master/manuals/GridDB_QuickStartGuide/toc.md)の「GridDBのインストール」の章を参照してください

- SSHによるリモート接続設定
- gs_sh実行環境から各GridDBノード実行環境へ、OSユーザ「gsadm」でSSH接続するための設定
- gs_sh実行環境から各GridDBノード実行環境へ、OSユーザ「gsadm」でSSH接続するために必要な設定<br>
※ SSH接続の手順の詳細に関しては、各OSのマニュアルを参照してください。

[メモ]

以下のOSでは、鍵交換アルゴリズムの追加が必要です。

RHEL9系の場合:
``` example
$ sudo update-crypto-policies --set DEFAULT:SHA1
$ sudo reboot   # OSの再起動
```

Ubuntu 20.04の場合:
``` example
$ vi /etc/ssh/sshd_config # エディタで設定ファイルを編集
...
Kexalgorithms +diffie-hellman-group14-sha1

$ sudo systemctl reload sshd
```

Ubuntu 22.04の場合:
``` example
$ vi /etc/ssh/sshd_config # エディタで設定ファイルを編集
...
Kexalgorithms +diffie-hellman-group14-sha1
HostKeyAlgorithms +ssh-rsa

$ sudo systemctl reload sshd
```

### gs_sh起動

gs_shには2種類の起動モードがあります。
Expand Down Expand Up @@ -99,10 +129,10 @@ GridDBノードのIPアドレスとポート番号を、ノード変数に定義

``` example
//4つのGridDBノードを定義
gs> setnode node0 192.168.0.1 10000
gs> setnode node1 192.168.0.2 10000
gs> setnode node2 192.168.0.3 10000
gs> setnode node3 192.168.0.4 10000
gs> setnode node0 192.168.0.1 10040
gs> setnode node1 192.168.0.2 10040
gs> setnode node2 192.168.0.3 10040
gs> setnode node3 192.168.0.4 10040
```

【メモ】
Expand Down Expand Up @@ -286,7 +316,7 @@ GridDBクラスタにアクセスするユーザおよびパスワードを定

``` example
//変数を定義
gs> set GS_PORT 10000
gs> set GS_PORT 10040
//変数の設定をクリア
gs> set GS_PORT
```
Expand Down Expand Up @@ -320,10 +350,10 @@ GridDBクラスタにアクセスするユーザおよびパスワードを定
//定義した全変数を定表示
gs> show
ノード変数:
node0=Node[192.168.0.1:10000,ssh=22]
node1=Node[192.168.0.2:10000,ssh=22]
node2=Node[192.168.0.3:10000,ssh=22]
node3=Node[192.168.0.4:10000,ssh=22]
node0=Node[192.168.0.1:10040,ssh=22]
node1=Node[192.168.0.2:10040,ssh=22]
node2=Node[192.168.0.3:10040,ssh=22]
node3=Node[192.168.0.4:10040,ssh=22]
クラスタ変数:
cluster0=Cluster[name=name,200.0.0.1:1000,nodes=(node0,node1,node2)]
その他の変数:
Expand Down Expand Up @@ -742,6 +772,7 @@ leaveclusterサブコマンドや障害などによってGridDBクラスタか
【メモ】
- 管理ユーザのみが実行可能なコマンドです。
- ノード変数を利用する際には、変数名の先頭に"$"をつけます。



<a id="displaying_cluster_status_data"></a>
Expand Down Expand Up @@ -1230,6 +1261,7 @@ SQL文の先頭が下記文字列のいずれかである場合、サブコマ
| DDL文 | 何も表示されません。 |

- SQLの詳細に関しては、[GridDB SQLリファレンス](https://github.com/griddb/docs-ja/blob/master/manuals/GridDB_SQL_Reference/toc.md)を参照してください。



### 検索結果の取得
Expand All @@ -1251,6 +1283,147 @@ SQL文の先頭が下記文字列のいずれかである場合、サブコマ
|----------|----------------------------------------------------------------------------------|
| 取得件数 | 検索結果の取得件数を指定します。省略すると、全ての検索結果を取得して表示します。 |

標準出力の表示形式にはTABLE形式とCSV形式の2種類があります。
V5.5から表示形式のデフォルトがTABLE形式になります。以前の形式に戻す場合は「表示形式がCSVの場合」を実施してください。

(A-1) 標準出力の表示形式を設定します。

- サブコマンド

| |
|-|
| setresultformat \[TABLE\|CSV\] |

- 引数

| 引数 | 説明 |
|----------|----------------------------------------------------------------------------------|
| TABLE\|CSV | 標準出力の表示形式をTABLEまたはCSVで設定します。デフォルトはTABLE形式で標準出力します。 |

例)

- 表示形式がTABLEの場合

``` example
//表示形式をTABLEに設定
gs[public]> setresultformat TABLE

//検索を実行
gs[public]> select * from tim1;
検索を実行しました。 (1 ms)

//結果を表示
gs[public]> get
+--------------------------+-----------------------------+--------------------------------+
| date | micro | nano |
+--------------------------+-----------------------------+--------------------------------+
| 2022-12-31T00:00:00.123Z | 2022-12-31T00:00:00.123456Z | 2022-12-31T00:00:00.123456789Z |
+--------------------------+-----------------------------+--------------------------------+
1 件の取得が完了しました。
```

- 表示形式がCSVの場合

``` example
//表示形式をCSVに設定
gs[public]> setresultformat CSV

//検索を実行
gs[public]> select * from tim1;
検索を実行しました。 (2 ms)

//結果を表示
gs[public]> get
date,micro,nano
2022-12-31T00:00:00.123Z,2022-12-31T00:00:00.123456Z,2022-12-31T00:00:00.123456789Z
1 件の取得が完了しました。
```

【メモ】
- 一度設定するとgs_shの起動中はgetサブコマンドで、設定した表示形式が有効になります。
- 何度でも表示形式の切り替えは可能です。

(A-2) 標準出力の文字列長を設定します。

- サブコマンド

| |
|-|
| setresultmaxwidth \[文字列長\] |

- 引数

| 引数 | 説明 |
|----------|----------------------------------------------------------------------------------|
| 文字列長 | 標準出力の文字列長を自然数で設定します。値はバイト数で設定され、半角英数字の場合は1バイト、日本語の場合は2バイトで設定されます。表示形式がTABLEの場合のみ適用されます。 |

例)

``` example
//検索を実行
gs[public]> select * from tim1;
検索を実行しました。 (28 ms)
gs[public]> get
+--------------------------+-----------------------------+--------------------------------+
| date | micro | nano |
+--------------------------+-----------------------------+--------------------------------+
| 2022-12-31T00:00:00.123Z | 2022-12-31T00:00:00.123456Z | 2022-12-31T00:00:00.123456789Z |
+--------------------------+-----------------------------+--------------------------------+
1 件の取得が完了しました。

//文字列長を設定
gs[public]> setresultmaxwidth 29

//検索を実行
gs[public]> select * from tim1;
検索を実行しました。 (2 ms)

//結果を表示
gs[public]> get
+--------------------------+-----------------------------+-------------------------------+
| date | micro | nano |
+--------------------------+-----------------------------+-------------------------------+
| 2022-12-31T00:00:00.123Z | 2022-12-31T00:00:00.123456Z | 2022-12-31T00:00:00.123456... |
+--------------------------+-----------------------------+-------------------------------+
1 件の取得が完了しました。

//文字列長を設定
gs[public]> setresultmaxwidth 26

//検索を実行
gs[public]> select * from tim1;
検索を実行しました。 (2 ms)

//結果を表示
gs[public]> get
+--------------------------+----------------------------+----------------------------+
| date | micro | nano |
+--------------------------+----------------------------+----------------------------+
| 2022-12-31T00:00:00.123Z | 2022-12-31T00:00:00.123... | 2022-12-31T00:00:00.123... |
+--------------------------+----------------------------+----------------------------+
1 件の取得が完了しました。

//文字列長を設定
gs[public]> setresultmaxwidth 22

//検索を実行
gs[public]> select * from tim1;
検索を実行しました。 (1 ms)

//結果を表示
gs[public]> get
+------------------------+------------------------+------------------------+
| date | micro | nano |
+------------------------+------------------------+------------------------+
| 2022-12-31T00:00:00... | 2022-12-31T00:00:00... | 2022-12-31T00:00:00... |
+------------------------+------------------------+------------------------+
1 件の取得が完了しました。
```

【メモ】
- 一度設定するとgs_shの起動中はgetサブコマンドのTABLE形式の表示で、設定した文字列長が有効になります。
- 何度でも文字列長の設定は可能です。
- 取得した結果の値が設定した文字列長より長い場合、設定した文字列長で区切って末尾に「...」が付与されます。

(B) 取得した結果をCSV形式でファイルに保存します。

Expand Down Expand Up @@ -2816,6 +2989,9 @@ gs_shのバージョンを表示します。
【メモ】
- connectサブコマンド実行後に、settimezoneサブコマンドでタイムゾーン設定を変更した場合、変更後のタイムゾーン設定は再度、connectサブコマンドを実行するまで反映されません。タイムゾーン設定変更を行った後には再度、connectサブコマンドを実行してください。




### マルチキャストパケットを受信するインターフェースの設定

複数のネットワークインターフェースがあるときにクラスタのネットワーク構成をマルチキャスト方式にする場合、マルチキャストパケットを受信するインターフェースのIPアドレスを指定します。
Expand Down Expand Up @@ -2982,6 +3158,8 @@ historyサブコマンドで表示した履歴よりサブコマンドを再実
| connect | クラスタ変数 \[データベース名\] | GridDBクラスタに接続します。 | |
| tql | コンテナ名 クエリ ; | 検索を実行し、検索結果を保持します。 | |
| get | \[ 取得件数 \] | 検索結果を取得し、標準出力に表示します。 | |
| setresultformat | \[ TABLE\|CSV \] | 標準出力の表示形式を設定します。 | |
| setresultmaxwidth | \[文字列長\] | 標準出力の文字列長を設定します。 | |
| getcsv | CSVファイル名 \[ 取得件数 \] | 検索結果を取得し、CSV形式でファイルに保存します。 | |
| getnoprint | \[ 取得件数 \] | クエリの結果を取得しますが、標準出力に表示しません。 | |
| tqlclose | | TQLをクローズし、保持する検索結果を破棄します。 | |
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ sourceSets {
}
}

def gridstoreVersion = '5.3.0'
def gridstoreJdbcVersion = '5.3.0'
def gridstoreVersion = '5.5.0'
def gridstoreJdbcVersion = '5.5.0'

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ sourceSets {
}
}

def gridstoreVersion = '5.3.0'
def gridstoreJdbcVersion = '5.3.0'
def gridstoreVersion = '5.5.0'
def gridstoreJdbcVersion = '5.5.0'

dependencies {
implementation 'commons-io:commons-io:2.4'
Expand Down
Loading