OBD创建租户的系统参数配置问题

根据文档: 集群命令组-V4.2.0-OceanBase 安装部署工具文档-分布式数据库使用文档 描述,可以通过

obd cluster tenant create <deploy name> [-n <tenant name>] [flags]

# example
obd cluster tenant create test -n obmysql --max-cpu=2 --memory-size=2G --log-disk-size=3G --max-iops=10000 --iops-weight=2 --unit-num=1 --charset=utf8 -o htap -s 'ob_tcp_invited_nodes="%"'

通过:-s/–variables 参数设置系统变量

设置租户系统变量值,设置系统变量时需将变量放置到单引号('' )内。

但是没有说明多个参数配置应该怎么办,用什么分割? 还是不支持呢

1 个赞
root@ecs-54050553:~# obd cluster tenant create obcluster -n obmysql -s 'net_write_timeout="6000",net_read_timeout="6000",ob_query_timeout="1000000000",max_allowed_packet="838860800"'
Get local repositories ok
Open ssh connection ok
Tenant optimization scenario not specified, please specify the scenario you want to optimize.
1. express_oltp
2. complex_oltp
3. olap
4. htap (default, follow cluster)
5. kv
Please input the scenario you want to optimize [default: 4]: 
Connect to observer 192.168.3.2:2881 ok
Create tenant obmysql x
[ERROR] OBD-5000: create tenant obmysql replica_num=1,zone_list=('zone1'),primary_zone='RANDOM',resource_pool_list=('obmysql_pool')set net_write_timeout="6000",net_read_timeout="6000",ob_query_timeout="1000000000",max_allowed_packet="838860800", ob_compatibility_mode = 'mysql' execute failed

[ERROR] (1232, "Incorrect argument type to variable 'net_write_timeout'")

这样执行错误

@论坛小助手

在使用 obd cluster tenant create 命令时,通过 -s/–variables 参数设置租户系统变量值时,可以设置多个参数。多个参数之间应使用空格分隔,每个参数需要放在单引号(’’)内。例如,如果您需要设置多个系统变量,可以这样配置:

obd cluster tenant create test -n obmysql --max-cpu=2 --memory-size=2G --log-disk-size=3G --max-iops=10000 --iops-weight=2 --unit-num=1 --charset=utf8 -o htap -s 'ob_tcp_invited_nodes="%"' -s 'another_variable="value"'

这样,每个系统变量都在单引号内,并且多个变量之间用空格分隔。

更多信息请查看:

  1. 系统架构

obd版本是多少

root@ecs-54050553:~# obd --version
OceanBase Deploy: 4.0.0
REVISION: 44b780d08efba6de1ce19e6d4a67631eba4cff24
BUILD_BRANCH: HEAD
BUILD_TIME: Nov 17 2025 14:36:56OURCE
Copyright (C) 2025 OceanBase
License Apache 2.0: Apache version 2 or later https://www.apache.org/licenses/LICENSE-2.0.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

按小助手说的用空格也不行
root@ecs-54050553:~# obd cluster tenant create obcluster -n obmysql2 -s ‘net_write_timeout=“6000” net_read_timeout=“6000” ob_query_timeout=“1000000000” max_allowed_packet=“838860800”’
Get local repositories ok
Open ssh connection ok
Tenant optimization scenario not specified, please specify the scenario you want to optimize.

  1. express_oltp
  2. complex_oltp
  3. olap
  4. htap (default, follow cluster)
  5. kv
    Please input the scenario you want to optimize [default: 4]:
    Connect to observer 192.168.3.2:2881 ok
    Create tenant obmysql2 x
    [ERROR] OBD-5000: create tenant obmysql2 replica_num=1,zone_list=(‘zone1’),primary_zone=‘RANDOM’,resource_pool_list=(‘obmysql2_pool’)set net_write_timeout=“6000” net_read_timeout=“6000” ob_query_timeout=“1000000000” max_allowed_packet=“838860800”, ob_compatibility_mode = ‘mysql’ execute failed

[ERROR] (1064, ‘You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘net_read_timeout=“6000” ob_query_timeout=“1000000000” max_allowed_packet="838860’ at line 1’)
See https://www.oceanbase.com/product/ob-deployer/error-codes .
Trace ID: 8d60b1f2-28e3-11f1-a892-fa163ef83866
If you want to view detailed obd logs, please run: obd display-trace 8d60b1f2-28e3-11f1-a892-fa163ef83866

麻烦提供一份完整的obd日志看下

create tenant obmysql replica_num=1,zone_list=(‘zone1’),primary_zone=‘RANDOM’,resource_pool_list=(‘obmysql_pool’)set net_write_timeout=“6000”,net_read_timeout=“6000”,ob_query_timeout=“1000000000”,max_allowed_packet=“838860800” ;

ERROR 1232 (42000): Incorrect argument type to variable ‘net_write_timeout’
黑屏化测试,应是net_write_timeout不支持配置

测试使用下面几个变量试试

var_name 常用取值如下:

  • ob_compatibility_mode:用于指定租户的兼容模式(可选 MySQL 或 Oracle 模式),而且只能在创建时指定;如果不指定 ob_compatibility_mode,则默认兼容模式为 MySQL。
  • ob_tcp_invited_nodes:用于指定租户连接的白名单,即允许哪些客户端 IP 连接该租户。示例中 % 表示所有客户端都可登录,如果不指定 ob_tcp_invited_nodes 的值,则默认租户的连接方式为仅允许本机的 IP 登录该租户。
  • lower_case_table_names:用于控制大小写敏感,仅支持使用 CREATE TENANT 语句创建租户时指定并只在 MySQL 模式下生效,租户创建后不能通过 SQL 语句修改。
  • ob_compatibility_control:用于控制存在 MySQL 兼容行为冲突的功能表现为何种行为。当前取值 MYSQL5.7MYSQL8.0,表示与 MySQL 5.7 的行为保持一致还是与 MySQL 8.0 的行为保持一致。创建 MySQL 模式的租户时,需要指定该变量,并且只能在创建时指定,租户创建后不允许修改。如果不显式指定 ob_compatibility_control,则默认其兼容行为与 MySQL 5.7 保持一致。
  • read_only:指定租户为只读模式还是读写模式,如果不设置,默认为读写模式。
1 个赞

够详细的了,学到了