SeekdbAdminClient
SeekdbAdminClient provides database management operations. It uses the same database connection mode as SeekdbClient, but only supports database management-related operations.
Connect to a remote server
You can use SeekdbAdminClient to connect to a remote server. This client supports connecting to seekdb or OceanBase Database.
Before you connect to a remote server, make sure that you have deployed the server mode of seekdb or OceanBase Database.
For information about how to deploy the server mode of seekdb, see Deploy seekdb by using yum install.
For information about how to deploy OceanBase Database, see Overview.
Example: Connect to the server mode of seekdb
import { SeekdbAdminClient } from "seekdb";
// Remote server mode - database management (seekdb Server)
const admin = new SeekdbAdminClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: ""
});
Parameters:
| Parameter | Value type | Required | Description | Example value |
|---|---|---|---|---|
host | string | Yes | The IP address of the server where the instance is located. | 127.0.0.1 |
port | string | Yes | The port of the instance. The default value is 2881. | 2881 |
user | string | Yes | The username. The default value is root. | root |
password | string | Yes | The password corresponding to the user. If you do not specify the password parameter or specify an empty string, the system retrieves the password from the SEEKDB_PASSWORD environment variable. |
Example: Connect to OceanBase Database
import { SeekdbAdminClient } from "seekdb";
// Remote server mode - database management (OceanBase Server)
const admin = new SeekdbAdminClient({
host: "127.0.0.1",
port: 2881,
tenant: "sys", // The default tenant of OceanBase Database
user: "root",
password: ""
});
Parameters:
| Parameter | Value type | Required | Description | Example value |
|---|---|---|---|---|
host | string | Yes | The IP address of the server where the database is located. | 127.0.0.1 |
port | string | Yes | The port of OceanBase Database. The default value is 2881. | 2881 |
tenant | string | No | The name of the tenant. This parameter is not required for seekdb, but it is required for OceanBase Database. The default value is sys. | sys |
user | string | Yes | The username corresponding to the tenant. The default value is root. | root |
password | string | Yes | The password corresponding to the user. |
APIs supported when you use SeekdbAdminClient to connect to a database
When you use SeekdbAdminClient to connect to a database, you can call the following APIs.
| API | Description | Related document link |
|---|---|---|
createDatabase | Creates a new database. | Documentation |
getDatabase | Queries a specified database. | Documentation |
deleteDatabase | Deletes a specified database. | Documentation |
listDatabases | Lists all databases. | Documentation |