Skip to content

Commit 0c0d68d

Browse files
author
chenyunliang520
committed
Add GaussDB distributed load balancing demo with screenshots, logical replication example, and minor README/test fixes
1 parent e17bc2c commit 0c0d68d

File tree

17 files changed

+678
-13
lines changed

17 files changed

+678
-13
lines changed

example/GaussDB_distributed_readme.md

Lines changed: 527 additions & 0 deletions
Large diffs are not rendered by default.

example/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
```
1212

1313
- **GaussDB数据库已经购买**:具体步骤可参考华为云官网购买GaussDB。
14-
-
14+
1515
- **GaussDB驱动 pq 已安装**:具体步骤可参考readme中libpq的安装说明。
1616

1717
- **gaussdb 库已安装**:Python 的虚拟环境中需安装 `gaussdb` 库,用于连接 openGauss 数据库。
@@ -52,13 +52,22 @@ python ssl_demo.py
5252

5353
## 逻辑复制
5454

55+
运行示例代码,查看非ssl模式下逻辑复制的输出结果。
56+
57+
```bash
58+
# 配置环境变量
59+
export GAUSSDB_TEST_DSN="dbname=test01 user=root password=*** host=*** port=8000"
60+
61+
# 运行示例代码
62+
python logical_replication_demo.py
63+
```
5564

5665

5766
## 主备模式负载均衡
5867

59-
请查看 [GaussDB_master_standby_readme.md](GaussDB_master_standby_readme.md)
68+
请参考 [GaussDB_master_standby_readme.md](GaussDB_master_standby_readme.md)
6069

6170

6271
## 分布式模式负载均衡
6372

64-
请查看 [GaussDB_master_standby_readme.md](GaussDB_master_standby_readme.md)
73+
请参考 [GaussDB_distributed_readme.md](GaussDB_distributed_readme.md)

example/demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def main():
1212
dsn = os.environ.get("GAUSSDB_TEST_DSN")
1313
if not dsn:
14-
print("Please set the GAUSSDB_TEST_DSN environment variable, for example:")
14+
print("Please set the GAUSSDB_TEST_DSN environment variable, for example:")
1515
print(
1616
' export GAUSSDB_TEST_DSN="dbname=test01 user=root password=***'
1717
'host=** port=8000"'
@@ -30,7 +30,7 @@ def main():
3030

3131
with conn.cursor() as cur:
3232
server_version = conn.execute("select version()").fetchall()[0][0]
33-
print(f"Connected. Server version: {server_version}")
33+
print(f"Connected. Server version: {server_version}")
3434
print(f"Vendor: {conn.info.vendor}, Version: {conn.info.server_version}")
3535

3636
cur.execute(drop_table_sql)
@@ -39,11 +39,11 @@ def main():
3939
cur.execute(insert_data_sql, (2, "world"))
4040

4141
cur.execute(select_sql)
42-
print("📄origin: ", cur.fetchall())
42+
print("origin: ", cur.fetchall())
4343

4444
cur.execute(update_data_sql)
4545
cur.execute(select_sql)
46-
print("📄update: ", cur.fetchall())
46+
print("update: ", cur.fetchall())
4747

4848

4949
if __name__ == "__main__":

example/imgs/101.png

28.2 KB
Loading

example/imgs/102.png

22 KB
Loading

example/imgs/103.png

48.4 KB
Loading

example/imgs/104.png

60.6 KB
Loading

example/imgs/105.png

13.7 KB
Loading

example/imgs/106.png

46.3 KB
Loading

example/imgs/107.png

35.2 KB
Loading

0 commit comments

Comments
 (0)