<p align="center">
<a href="https://github.com/oceanbase/oceanbase/blob/master/LICENSE">
<img alt="license" src="https://img.shields.io/badge/license-Apache--2.0-blue" />
</a>
<a href="https://en.oceanbase.com/docs/oceanbase-database">
<img alt="English doc" src="https://img.shields.io/badge/docs-English-blue" />
</a>
<a href="https://www.oceanbase.com/docs/oceanbase-database-cn">
<img alt="Chinese doc" src="https://img.shields.io/badge/文档-简体中文-blue" />
</a>
</p>
English | [Chinese](README_CN.md)
**OBShell-SDK-Python** is an SDK provided by the[OceanBase Community](https://open.oceanbase.com/) to facilitate developers with quick access to OBShell services, allowing them to conveniently call OBShell interfaces using this SDK.
## Install
```
pip install obshell
```
## Quick Start
Please ensure that OBShell is running when using it.
### Create a Client
Create a specified version client.
```python
from obshell import ClientV1
from obshell.auth import PasswordAuth
def main():
client = ClientV1("11.11.11.1", 2886, PasswordAuth("****"))
```
Create client_set.
```python
from obshell import ClientSet
from obshell.auth import PasswordAuth
def main():
client = ClientSet("11.11.11.1", 2886, PasswordAuth("****"))
```
### Deploy Cluster
OBShell-SDK-Python provides two types of methods to deploy an OBShell cluster: the first immediately returns after successfully making a request to the OBShell API, and the second waits for the OBShell task to complete after the API request is successful before returning. The former executes the task asynchronously, while the latter executes the task synchronously.
**Deploy a 1-1-1 cluster:**
* Asynchronous Task Execution
```python
from obshell import ClientSet
from obshell.auth import PasswordAuth
def main():
client = ClientSet("11.11.11.1", 2886, PasswordAuth("****"))
# join master
dag = client.v1.join("11.11.11.1", 2886, "zone1")
client.v1.wait_dag_succeed(dag.generic_id)
# join follower
dag = client.v1.join("11.11.11.2", 2886, "zone2")
client.v1.wait_dag_succeed(dag.generic_id)
dag = client.v1.join("11.11.11.3", 2886, "zone3")
client.v1.wait_dag_succeed(dag.generic_id)
# configure observer
configs = {
"datafile_size": "24G", "log_disk_size": "24G",
"cpu_count": "16", "memory_limit": "16G", "system_memory": "8G",
"enable_syslog_recycle": "true", "enable_syslog_wf": "true"}
dag = client.v1.config_observer(configs, "GLOBAL", [])
client.v1.wait_dag_succeed(dag.generic_id)
# configure obcluster
dag = client.v1.config_obcluster_sync("test-sdk", 11, "****")
client.v1.wait_dag_succeed(dag.generic_id)
# initialize obcluster
dag = client.v1.init_sync()
client.v1.wait_dag_succeed(dag.generic_id)
# get the status of the cluster
status = client.v1.get_status()
print(status)
```
* Synchronous Task Execution
```python
from obshell import ClientSet
from obshell.auth import PasswordAuth
def main():
client = ClientSet("11.11.11.1", 2886, PasswordAuth("****"))
# join master
client.v1.join_sync("11.11.11.1", 2886, "zone1")
# join follower
client.v1.join_sync("11.11.11.2", 2886, "zone2")
client.v1.join_sync("11.11.11.3", 2886, "zone3")
# configure observer
configs = {
"datafile_size": "24G", "log_disk_size": "24G",
"cpu_count": "16", "memory_limit": "16G", "system_memory": "8G",
"enable_syslog_recycle": "true", "enable_syslog_wf": "true"}
client.v1.config_observer_sync(configs, "GLOBAL", [])
# configure obcluster
client.v1.config_obcluster_sync("test-sdk", 11, "****")
# initialize obcluster
client.v1.init_sync()
# get the status of the cluster
status = client.v1.get_status()
print(status)
```
### Scale out
Scale out the agent '11.11.11.4' into the cluster where the agent '11.11.11.1' is located.
```python
from obshell import ClientSet
from obshell.auth import PasswordAuth
def main():
client = ClientSet("111.11.11.1", 2886, PasswordAuth("****"))
# scale out
configs = {
"datafile_size": "24G", "log_disk_size": "24G",
"cpu_count": "16", "memory_limit": "16G", "system_memory": "8G",
"enable_syslog_recycle": "true", "enable_syslog_wf": "true"}
client.v1.scale_out_sync("11.11.11.4", 2886, "zone3", configs)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/oceanbase/obshell-sdk-python",
"name": "obshell",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "OceanBase",
"author_email": "rongfeng.frf@oceanbase.com",
"download_url": "https://files.pythonhosted.org/packages/02/d9/25702d5b4f2c92b316d46c6bfd4e00f969466a0bce769b898a4c15021f5a/obshell-0.0.6.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <a href=\"https://github.com/oceanbase/oceanbase/blob/master/LICENSE\">\n <img alt=\"license\" src=\"https://img.shields.io/badge/license-Apache--2.0-blue\" />\n </a>\n <a href=\"https://en.oceanbase.com/docs/oceanbase-database\">\n <img alt=\"English doc\" src=\"https://img.shields.io/badge/docs-English-blue\" />\n </a>\n <a href=\"https://www.oceanbase.com/docs/oceanbase-database-cn\">\n <img alt=\"Chinese doc\" src=\"https://img.shields.io/badge/\u6587\u6863-\u7b80\u4f53\u4e2d\u6587-blue\" />\n </a>\n</p>\n\nEnglish | [Chinese](README_CN.md)\n\n**OBShell-SDK-Python** is an SDK provided by the[OceanBase Community](https://open.oceanbase.com/) to facilitate developers with quick access to OBShell services, allowing them to conveniently call OBShell interfaces using this SDK.\n\n## Install\n```\npip install obshell\n```\n\n## Quick Start\nPlease ensure that OBShell is running when using it.\n### Create a Client\nCreate a specified version client.\n```python\nfrom obshell import ClientV1\nfrom obshell.auth import PasswordAuth\n\ndef main():\n client = ClientV1(\"11.11.11.1\", 2886, PasswordAuth(\"****\"))\n```\nCreate client_set.\n```python\nfrom obshell import ClientSet\nfrom obshell.auth import PasswordAuth\n\ndef main():\n client = ClientSet(\"11.11.11.1\", 2886, PasswordAuth(\"****\"))\n```\n### Deploy Cluster\nOBShell-SDK-Python provides two types of methods to deploy an OBShell cluster: the first immediately returns after successfully making a request to the OBShell API, and the second waits for the OBShell task to complete after the API request is successful before returning. The former executes the task asynchronously, while the latter executes the task synchronously.\n\n**Deploy a 1-1-1 cluster:**\n* Asynchronous Task Execution\n```python\nfrom obshell import ClientSet\nfrom obshell.auth import PasswordAuth\ndef main():\n client = ClientSet(\"11.11.11.1\", 2886, PasswordAuth(\"****\"))\n\n # join master\n dag = client.v1.join(\"11.11.11.1\", 2886, \"zone1\")\n client.v1.wait_dag_succeed(dag.generic_id)\n # join follower\n dag = client.v1.join(\"11.11.11.2\", 2886, \"zone2\")\n client.v1.wait_dag_succeed(dag.generic_id)\n dag = client.v1.join(\"11.11.11.3\", 2886, \"zone3\")\n client.v1.wait_dag_succeed(dag.generic_id)\n\n # configure observer\n configs = {\n \"datafile_size\": \"24G\", \"log_disk_size\": \"24G\", \n \"cpu_count\": \"16\", \"memory_limit\": \"16G\", \"system_memory\": \"8G\", \n \"enable_syslog_recycle\": \"true\", \"enable_syslog_wf\": \"true\"}\n dag = client.v1.config_observer(configs, \"GLOBAL\", [])\n client.v1.wait_dag_succeed(dag.generic_id)\n\n # configure obcluster\n dag = client.v1.config_obcluster_sync(\"test-sdk\", 11, \"****\")\n client.v1.wait_dag_succeed(dag.generic_id)\n\n # initialize obcluster\n dag = client.v1.init_sync()\n client.v1.wait_dag_succeed(dag.generic_id)\n \n # get the status of the cluster\n status = client.v1.get_status()\n print(status)\n```\n* Synchronous Task Execution\n```python\nfrom obshell import ClientSet\nfrom obshell.auth import PasswordAuth\n\ndef main():\n client = ClientSet(\"11.11.11.1\", 2886, PasswordAuth(\"****\"))\n\n # join master\n client.v1.join_sync(\"11.11.11.1\", 2886, \"zone1\")\n # join follower\n client.v1.join_sync(\"11.11.11.2\", 2886, \"zone2\")\n client.v1.join_sync(\"11.11.11.3\", 2886, \"zone3\")\n\n # configure observer\n configs = {\n \"datafile_size\": \"24G\", \"log_disk_size\": \"24G\", \n \"cpu_count\": \"16\", \"memory_limit\": \"16G\", \"system_memory\": \"8G\", \n \"enable_syslog_recycle\": \"true\", \"enable_syslog_wf\": \"true\"}\n client.v1.config_observer_sync(configs, \"GLOBAL\", [])\n\n # configure obcluster\n client.v1.config_obcluster_sync(\"test-sdk\", 11, \"****\")\n\n # initialize obcluster\n client.v1.init_sync()\n \n # get the status of the cluster\n status = client.v1.get_status()\n print(status)\n```\n### Scale out\nScale out the agent '11.11.11.4' into the cluster where the agent '11.11.11.1' is located.\n```python\nfrom obshell import ClientSet\nfrom obshell.auth import PasswordAuth\n\ndef main():\n client = ClientSet(\"111.11.11.1\", 2886, PasswordAuth(\"****\"))\n\n # scale out\n configs = {\n \"datafile_size\": \"24G\", \"log_disk_size\": \"24G\", \n \"cpu_count\": \"16\", \"memory_limit\": \"16G\", \"system_memory\": \"8G\", \n \"enable_syslog_recycle\": \"true\", \"enable_syslog_wf\": \"true\"}\n client.v1.scale_out_sync(\"11.11.11.4\", 2886, \"zone3\", configs)\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "OBShell SDK is a powerful and easy-to-use Python library that provides developers with simple method calls to interact with the OBShell. OBShell SDK allows for quick integration, enabling developers to efficiently implement features and focus on creating value in their applications.",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/oceanbase/obshell-sdk-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "36708da566834a41ae2f965905b5ac7640a4a471a74ab1fe5c6396ace4338efc",
"md5": "3339aa0a468052d0f38afc5101ce9ca6",
"sha256": "173d67c451c4e2de72c7c6515a5f3648c98660ea67267ba0f401887e2c5bed56"
},
"downloads": -1,
"filename": "obshell-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3339aa0a468052d0f38afc5101ce9ca6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 62056,
"upload_time": "2025-07-11T07:44:03",
"upload_time_iso_8601": "2025-07-11T07:44:03.334600Z",
"url": "https://files.pythonhosted.org/packages/36/70/8da566834a41ae2f965905b5ac7640a4a471a74ab1fe5c6396ace4338efc/obshell-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "02d925702d5b4f2c92b316d46c6bfd4e00f969466a0bce769b898a4c15021f5a",
"md5": "718fac594e81b91457949479f092cc6e",
"sha256": "cdd89fec08b1da765ed18fadfa29f20b1a3afcba933c7b4038dd293e8e5e331a"
},
"downloads": -1,
"filename": "obshell-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "718fac594e81b91457949479f092cc6e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 47716,
"upload_time": "2025-07-11T07:44:04",
"upload_time_iso_8601": "2025-07-11T07:44:04.663911Z",
"url": "https://files.pythonhosted.org/packages/02/d9/25702d5b4f2c92b316d46c6bfd4e00f969466a0bce769b898a4c15021f5a/obshell-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-11 07:44:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "oceanbase",
"github_project": "obshell-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pycryptodome",
"specs": [
[
">=",
"3.20.0"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.32.3"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"68.0.0"
]
]
},
{
"name": "rpmfile",
"specs": [
[
">=",
"1.0.8"
]
]
},
{
"name": "paramiko",
"specs": [
[
">=",
"2.10.1"
]
]
}
],
"lcname": "obshell"
}