未验证 提交 13c246e6 编写于 作者: H Haimei Guo 提交者: GitHub

[IOTDB-871] change port to rpc port in session (#1720)

上级 4852a10b
......@@ -61,7 +61,7 @@ The schema / sync folder holds the synchronization information that needs to be
#### Sender
`data / sync-sender` is the sender's folder. The folder name in this directory represents the IP and port of the receiver. In this example, there is a receiver` 192.168.130.16: 5555`. Each folder contains the following Several files:
`data / sync-sender` is the sender's folder. The folder name in this directory represents the IP and rpc port of the receiver. In this example, there is a receiver` 192.168.130.16: 5555`. Each folder contains the following Several files:
* last_local_files.txt
Records a list of all local tsfile files that have been synchronized after the synchronization task ends, and is updated after each synchronization task ends.
......
......@@ -47,10 +47,10 @@ After build, the IoTDB cli will be at the folder "cli/target/iotdb-cli-{project.
After installation, there is a default user in IoTDB: `root`, and the
default password is `root`. Users can use this username to try IoTDB Cli/Shell tool. The cli startup script is the `start-cli` file under the \$IOTDB\_HOME/bin folder. When starting the script, you need to specify the IP and PORT. (Make sure the IoTDB server is running properly when you use Cli/Shell tool to connect it.)
Here is an example where the server is started locally and the user has not changed the running port. The default port is
Here is an example where the server is started locally and the user has not changed the running port. The default rpc port is
6667 </br>
If you need to connect to the remote server or changes
the port number of the server running, set the specific IP and PORT at -h and -p.</br>
the rpc port number of the server running, set the specific IP and RPC PORT at -h and -p.</br>
You also can set your own environment variable at the front of the start script ("/sbin/start-cli.sh" for linux and "/sbin/start-cli.bat" for windows)
The Linux and MacOS system startup commands are as follows:
......@@ -86,14 +86,14 @@ Enter ```quit``` or `exit` can exit Cli. The cli will shows `quit normally`
|-disableIS08601 |No parameters | No |If this parameter is set, IoTDB will print the timestamp in digital form|-disableIS08601|
|-h <`host`> |string, no quotation marks|Yes|The IP address of the IoTDB server|-h 10.129.187.21|
|-help|No parameters|No|Print help information for IoTDB|-help|
|-p <`port`>|int|Yes|The port number of the IoTDB server. IoTDB runs on port 6667 by default|-p 6667|
|-p <`rpcPort`>|int|Yes|The rpc port number of the IoTDB server. IoTDB runs on rpc port 6667 by default|-p 6667|
|-pw <`password`>|string, no quotation marks|No|The password used for IoTDB to connect to the server. If no password is entered, IoTDB will ask for password in Cli command|-pw root|
|-u <`username`>|string, no quotation marks|Yes|User name used for IoTDB to connect the server|-u root|
|-maxPRC <`maxPrintRowCount`>|int|No|Set the maximum number of rows that IoTDB returns|-maxPRC 10|
|-e <`execute`> |string|No|manipulate IoTDB in batches without entering cli input mode|-e "show storage group"|
Following is a cli command which connects the host with IP
10.129.187.21, port 6667, username "root", password "root", and prints the timestamp in digital form. The maximum number of lines displayed on the IoTDB command line is 10.
10.129.187.21, rpc port 6667, username "root", password "root", and prints the timestamp in digital form. The maximum number of lines displayed on the IoTDB command line is 10.
The Linux and MacOS system startup commands are as follows:
......@@ -146,12 +146,12 @@ The usage of -e parameter for Cli/shell is as follows:
The Linux and MacOS system commands:
```
Shell > sbin/start-cli.sh -h {host} -p {port} -u {user} -pw {password} -e {sql for iotdb}
Shell > sbin/start-cli.sh -h {host} -p {rpcPort} -u {user} -pw {password} -e {sql for iotdb}
```
The Windows system commands:
```
Shell > sbin\start-cli.bat -h {host} -p {port} -u {user} -pw {password} -e {sql for iotdb}
Shell > sbin\start-cli.bat -h {host} -p {rpcPort} -u {user} -pw {password} -e {sql for iotdb}
```
In the Windows environment, the SQL statement of the -e parameter needs to use ` `` ` to replace `" "`
......@@ -164,16 +164,16 @@ Suppose you want to create a storage group root.demo to a newly launched IoTDB,
# !/bin/bash
host=127.0.0.1
port=6667
rpcPort=6667
user=root
pass=root
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "set storage group to root.demo"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "create timeseries root.demo.s1 WITH DATATYPE=INT32, ENCODING=RLE"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(1,10)"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(2,11)"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(3,12)"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "select s1 from root.demo"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "set storage group to root.demo"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "create timeseries root.demo.s1 WITH DATATYPE=INT32, ENCODING=RLE"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(1,10)"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(2,11)"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(3,12)"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "select s1 from root.demo"
```
The print results are shown in the figure, which are consistent with the cli and jdbc operations.
......
......@@ -51,11 +51,11 @@ Here we show the commonly used interfaces and their parameters in the Native API
* Initialize a Session
```
Session(String host, int port)
Session(String host, int rpcPort)
Session(String host, String port, String username, String password)
Session(String host, String rpcPort, String username, String password)
Session(String host, int port, String username, String password)
Session(String host, int rpcPort, String username, String password)
```
* Open a Session
......
......@@ -175,7 +175,7 @@ A TsFile can be generated by following three steps and the complete code will be
```
In this example, data files will be stored in HDFS, instead of local file system. If you'd like to store data files in local file system, you can use `conf.setTSFileStorageFs("LOCAL")`, which is also the default config.
You can also config the ip and port of your HDFS by `config.setHdfsIp(...)` and `config.setHdfsPort(...)`. The default ip is `localhost` and default port is `9000`.
You can also config the ip and rpc port of your HDFS by `config.setHdfsIp(...)` and `config.setHdfsPort(...)`. The default ip is `localhost` and default rpc port is `9000`.
**Parameters:**
......
......@@ -46,7 +46,7 @@ IOTDB为用户提供cli/Shell工具用于启动客户端和服务端程序。下
在生成完毕之后,IoTDB的cli工具位于文件夹"cli/target/iotdb-cli-{project.version}"中。
## Cli / Shell运行方式
安装后的IoTDB中有一个默认用户:`root`,默认密码为`root`。用户可以使用该用户尝试运行IoTDB客户端以测试服务器是否正常启动。客户端启动脚本为$IOTDB_HOME/bin文件夹下的`start-cli`脚本。启动脚本时需要指定运行IP和PORT。以下为服务器在本机启动,且用户未更改运行端口号的示例,默认端口为6667。若用户尝试连接远程服务器或更改了服务器运行的端口号,请在-h和-p项处使用服务器的IP和PORT。</br>
安装后的IoTDB中有一个默认用户:`root`,默认密码为`root`。用户可以使用该用户尝试运行IoTDB客户端以测试服务器是否正常启动。客户端启动脚本为$IOTDB_HOME/bin文件夹下的`start-cli`脚本。启动脚本时需要指定运行IP和RPC PORT。以下为服务器在本机启动,且用户未更改运行端口号的示例,默认端口为6667。若用户尝试连接远程服务器或更改了服务器运行的端口号,请在-h和-p项处使用服务器的IP和RPC PORT。</br>
用户也可以在启动脚本的最前方设置自己的环境变量,如JAVA_HOME等 (对于linux用户,脚本路径为:"/sbin/start-cli.sh"; 对于windows用户,脚本路径为:"/sbin/start-cli.bat")
......@@ -83,7 +83,7 @@ IoTDB>
|-disableIS08601 |没有参数 | 否 |如果设置了这个参数,IoTDB将以数字的形式打印时间戳(timestamp)。|-disableIS08601|
|-h <`host`> |string类型,不需要引号|是|IoTDB客户端连接IoTDB服务器的IP地址。|-h 10.129.187.21|
|-help|没有参数|否|打印IoTDB的帮助信息|-help|
|-p <`port`>|int类型|是|IoTDB连接服务器的端口号,IoTDB默认运行在6667端口。|-p 6667|
|-p <`rpcPort`>|int类型|是|IoTDB连接服务器的端口号,IoTDB默认运行在6667端口。|-p 6667|
|-pw <`password`>|string类型,不需要引号|否|IoTDB连接服务器所使用的密码。如果没有输入密码IoTDB会在Cli端提示输入密码。|-pw root|
|-u <`username`>|string类型,不需要引号|是|IoTDB连接服务器锁使用的用户名。|-u root|
|-maxPRC <`maxPrintRowCount`>|int类型|否|设置IoTDB返回客户端命令行中所显示的最大行数。|-maxPRC 10|
......@@ -143,12 +143,12 @@ curl -X POST "https://{your-keycloack-server}/auth/realms/{your-realm}/protocol/
Linux系统与MacOS指令:
```
Shell > sbin/start-cli.sh -h {host} -p {port} -u {user} -pw {password} -e {sql for iotdb}
Shell > sbin/start-cli.sh -h {host} -p {rpcPort} -u {user} -pw {password} -e {sql for iotdb}
```
Windows系统指令
```
Shell > sbin\start-cli.bat -h {host} -p {port} -u {user} -pw {password} -e {sql for iotdb}
Shell > sbin\start-cli.bat -h {host} -p {rpcPort} -u {user} -pw {password} -e {sql for iotdb}
```
在Windows环境下,-e参数的SQL语句需要使用` `` `对于`" "`进行替换
......@@ -171,16 +171,16 @@ Windows系统指令
# !/bin/bash
host=127.0.0.1
port=6667
rpcPort=6667
user=root
pass=root
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "set storage group to root.demo"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "create timeseries root.demo.s1 WITH DATATYPE=INT32, ENCODING=RLE"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(1,10)"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(2,11)"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(3,12)"
./sbin/start-cli.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "select s1 from root.demo"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "set storage group to root.demo"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "create timeseries root.demo.s1 WITH DATATYPE=INT32, ENCODING=RLE"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(1,10)"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(2,11)"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "insert into root.demo(timestamp,s1) values(3,12)"
./sbin/start-cli.sh -h ${host} -p ${rpcPort} -u ${user} -pw ${pass} -e "select s1 from root.demo"
```
打印出来的结果显示在下图,通过这种方式进行的操作与客户端的输入模式以及通过JDBC进行操作结果是一致的。
......
......@@ -50,9 +50,9 @@
* 初始化Session
```
​Session(String host, int port)
​Session(String host, String port, String username, String password)
​Session(String host, int port, String username, String password)
​Session(String host, int rpcPort)
​Session(String host, String rpcPort, String username, String password)
​Session(String host, int rpcPort, String username, String password)
```
* 开启Session
......
......@@ -175,7 +175,7 @@ TsFile可以通过以下三个步骤生成,完整的代码参见"写入 TsFile
```
在上面的例子中,数据文件将存储在 HDFS 中,而不是本地文件系统中。如果你想在本地文件系统中存储数据文件,你可以使用`conf.setTSFileStorageFs("LOCAL")`,这也是默认的配置。
您还可以通过`config.setHdfsIp(...)`和`config.setHdfsPort(...)`来配置 HDFS 的 IP 和端口。默认的 IP是`localhost`,默认的端口是`9000`.
您还可以通过`config.setHdfsIp(...)`和`config.setHdfsPort(...)`来配置 HDFS 的 IP 和端口。默认的 IP是`localhost`,默认的`RPC`端口是`9000`.
**参数:**
......
......@@ -73,7 +73,7 @@ public class Session {
private static final Logger logger = LoggerFactory.getLogger(Session.class);
private final TSProtocolVersion protocolVersion = TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V3;
private String host;
private int port;
private int rpcPort;
private String username;
private String password;
private TSIService.Iface client = null;
......@@ -84,25 +84,25 @@ public class Session {
private long statementId;
private int fetchSize;
public Session(String host, int port) {
this(host, port, Config.DEFAULT_USER, Config.DEFAULT_PASSWORD);
public Session(String host, int rpcPort) {
this(host, rpcPort, Config.DEFAULT_USER, Config.DEFAULT_PASSWORD);
}
public Session(String host, String port, String username, String password) {
this(host, Integer.parseInt(port), username, password);
public Session(String host, String rpcPort, String username, String password) {
this(host, Integer.parseInt(rpcPort), username, password);
}
public Session(String host, int port, String username, String password) {
public Session(String host, int rpcPort, String username, String password) {
this.host = host;
this.port = port;
this.rpcPort = rpcPort;
this.username = username;
this.password = password;
this.fetchSize = Config.DEFAULT_FETCH_SIZE;
}
public Session(String host, int port, String username, String password, int fetchSize) {
public Session(String host, int rpcPort, String username, String password, int fetchSize) {
this.host = host;
this.port = port;
this.rpcPort = rpcPort;
this.username = username;
this.password = password;
this.fetchSize = fetchSize;
......@@ -122,7 +122,7 @@ public class Session {
return;
}
transport = new TFastFramedTransport(new TSocket(host, port, connectionTimeoutInMs));
transport = new TFastFramedTransport(new TSocket(host, rpcPort, connectionTimeoutInMs));
if (!transport.isOpen()) {
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册