Skip to content

Commit

Permalink
chore: refine the connection description for SDKs (#1158)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicecui authored Sep 2, 2024
1 parent a929ad9 commit 73bbb38
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/user-guide/ingest-data/for-iot/grpc-sdks/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ cfg := greptime.NewConfig("127.0.0.1").
// Enable secure connection if your server is secured by TLS
// WithInsecure(false).
// set authentication information
// If the database doesn't require authentication, just remove the WithAuth method
WithAuth("username", "password")

cli, _ := greptime.NewClient(cfg)
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/ingest-data/for-iot/grpc-sdks/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ For more information, refer to [Automatic Schema Generation](/user-guide/ingest-

## Connect to database

Username and password are always required to connect to GreptimeDB.
For how to set authentication to GreptimeDB, see [Authentication](/user-guide/clients/authentication.md).
Here we set the username and password when using the library to connect to GreptimeDB.
If you have set the [`--user-provider` configuration](/user-guide/clients/authentication.md) when starting GreptimeDB,
you will need to provide a username and password to connect to GreptimeDB.
The following example shows how to set the username and password when using the library to connect to GreptimeDB.

<InjectContent id="ingester-lib-connect" content={props.children}/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ cfg := greptime.NewConfig("127.0.0.1").
// 如果服务配置了 TLS ,设置 TLS 选项来启用安全连接
// WithInsecure(false).
// 设置鉴权信息
// 如果数据库不需要鉴权,移除 WithAuth 方法即可
WithAuth("username", "password")

cli, _ := greptime.NewClient(cfg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ GreptimeDB 提供了用于高吞吐量数据写入的 ingester 库。

## 连接数据库

连接 GreptimeDB 时,通常需要用户名和密码。
关于如何设置 GreptimeDB 的鉴权方式,请参考[鉴权](/user-guide/clients/authentication.md)
这里我们在使用 ingester 库连接 GreptimeDB 时设置用户名和密码
如果你在启动 GreptimeDB 时设置了 [`--user-provider`](/user-guide/clients/authentication.md)
则需要提供用户名和密码才能连接到 GreptimeDB。
以下示例显示了使用 SDK 连接到 GreptimeDB 时如何设置用户名和密码

<InjectContent id="ingester-lib-connect" content={props.children}/>

Expand Down

0 comments on commit 73bbb38

Please sign in to comment.