PullRequest: 753 zyj-V4.0.0-aone8
This commit is contained in:
parent
e25251a7c2
commit
83a63d2e80
490
.menu_map.yml
490
.menu_map.yml
|
@ -1,245 +1,245 @@
|
|||
100.oceanbase-database-overview=OceanBase 简介
|
||||
200.quick-start=快速上手
|
||||
100.Getting-started-with-OceanBase-SQL=上手 OceanBase SQL
|
||||
200.Create-a-sample-application=创建示例应用程序
|
||||
300.Experience-the-advanced-features-of-OceanBase=体验 OceanBase 高级特性
|
||||
100.Experience-Scalable-OLTP=体验 Scalable OLTP
|
||||
300.developer-guide=应用开发
|
||||
100.client-connects-to-oceanbase-database=客户端连接 OceanBase 数据库
|
||||
1400.database-connection-pool-configuration-example=数据库连接池配置示例
|
||||
600.c-application=C 应用程序
|
||||
200.create-and-manage-database-objects=创建和管理数据库对象
|
||||
400.data-type=数据类型
|
||||
600.create-and-manage-tables=创建和管理表
|
||||
700.create-and-manage-partition-table=创建和管理分区表
|
||||
800.create-and-manage-indexes=创建和管理索引
|
||||
1000.create-and-manage-views=创建和管理视图
|
||||
1100.managing-and-creating-sequences=创建和管理序列
|
||||
1200.create-and-manage-triggers=创建和管理触发器
|
||||
300.query=查询
|
||||
800.multi-table-join-queries=多表关联查询
|
||||
900.use-operators-and-functions-in-queries=在查询中使用操作符和函数
|
||||
1000.execution-plan=执行计划
|
||||
400.about-dml-statements-and-transactions=关于 DML 语句和事务
|
||||
100.dml-statement=DML 语句
|
||||
200.transaction=事务
|
||||
500.common-errors-and-solutions-mysql=MySQL 模式下常见报错
|
||||
300.timeout=超时相关
|
||||
400.user-2=用户相关
|
||||
500.table-related-functions=表相关
|
||||
600.constraint-related-functions=约束相关
|
||||
700.sql-related-commands=SQL 相关
|
||||
400.installation-and-deployment=部署数据库
|
||||
200.local-deployment=本地部署
|
||||
400.highly-available-deployment=高可用部署
|
||||
500.administrator-guide=管理数据库
|
||||
500.database-connection-and-routing=数据库连接和路由
|
||||
200.obproxy-management=管理 OBProxy
|
||||
200.manage-obproxy-clusters=管理 OBProxy 集群
|
||||
300.obproxy-management=管理 OBProxy
|
||||
300.database-connection=连接数据库
|
||||
500.logical-connection=逻辑连接
|
||||
600.driver-management=驱动管理
|
||||
700.route-management=路由管理
|
||||
400.odp-routing-policy=ODP 路由策略
|
||||
600.basic-database-management=集群和多租户管理
|
||||
100.manage-clusters=管理集群
|
||||
300.manage-cluster-parameters=管理集群参数
|
||||
400.manage-zones-in-a-cluster=管理集群中的 Zone
|
||||
500.manage-observers=管理 OBServer
|
||||
200.configuration-management=配置管理
|
||||
300.manage-resources=管理资源
|
||||
300.manage-resource-units=管理资源单元
|
||||
500.manage-resource-pools-1=管理资源池
|
||||
400.manage-tenants-1=管理租户
|
||||
400.manage-tenants-2=管理租户
|
||||
500.manage-users-and-permissions=管理用户和权限
|
||||
100.users-and-permissions=用户及权限介绍
|
||||
300.mysql-3=MySQL 模式
|
||||
1300.manage-tenant-parameters=管理租户参数
|
||||
500.manage-data-storage=管理数据存储
|
||||
100.dump-management-1=转储管理
|
||||
200.merge-management-1=合并管理
|
||||
300.data-compression-1=数据压缩
|
||||
700.memory-management-1=管理内存
|
||||
800.management-process=管理进程
|
||||
900.manage-logs=管理日志
|
||||
200.log-print-level=日志打印级别
|
||||
300.manage-the-size-and-quantity-of-log-files-2=日志文件大小及数量管理
|
||||
400.view-logs-2=查看日志
|
||||
700.database-object-management=数据库对象管理
|
||||
100.manage-databases=管理数据库
|
||||
200.manage-tables=管理表
|
||||
400.manage-indexes=管理索引
|
||||
800.distributed-storage-management=分布式存储管理
|
||||
200.manage-partition-table=管理分区
|
||||
900.create-partition-table-index-3=创建分区表索引
|
||||
400.manage-replicas=管理副本
|
||||
500.locality-management-1=管理 Locality
|
||||
900.performance-tuning-guide=性能调优
|
||||
200.performance-related-tools=性能相关工具
|
||||
100.system-tools=系统工具
|
||||
200.internal-table=内部表
|
||||
300.log-information=日志
|
||||
300.system-tuning=系统调优
|
||||
200.database-parameter-tuning=数据库参数调优
|
||||
300.obproxy-parameter-optimization=OBProxy 参数调优
|
||||
400.business-model-tuning=业务模型调优
|
||||
500.sql-optimization=SQL 调优指南
|
||||
200.sql-execution-plan=SQL 执行计划
|
||||
200.execution-plan-operator=执行计划算子
|
||||
300.distributed-execution-plan=分布式执行计划
|
||||
400.sql-optimization-1=SQL 调优
|
||||
300.monitor-sql-execution-performance=SQL 执行性能监控
|
||||
400.sql-performance-analysis-example=SQL 性能分析示例
|
||||
400.optimizer-statistics=优化器统计信息
|
||||
200.statistics-collection-methods=统计信息收集方式
|
||||
300.statistics-management=统计信息管理
|
||||
500.query-rewrite=查询改写
|
||||
600.query-optimization=查询优化
|
||||
100.access-path=访问路径
|
||||
200.join-algorithm=联接算法
|
||||
700.manage-execution-plans=管理执行计划
|
||||
600.performance-whitepaper=性能测试
|
||||
1000.high-data-availability=高可用和容灾
|
||||
100.administrator-guide-flashback=闪回
|
||||
200.backup-and-restoration-management=备份恢复管理
|
||||
300.log-archive=日志归档
|
||||
400.data-backup=数据备份
|
||||
500.cleaning-up-backed-up-data=清理备份
|
||||
600.restore-data=恢复数据
|
||||
1100.operation-and-maintenance-management=运维管理
|
||||
200.scale-out-and-scale-in-1=扩容和缩容
|
||||
200.cluster-level-scale-out-and-scale-in=集群级别的扩容和缩容
|
||||
100.scale-out=扩容
|
||||
200.shrink-1=缩容
|
||||
300.scale-in-and-scale-out-of-tenant-resources=租户内资源的扩容和缩容
|
||||
400.monitoring-and-alerting=监控和告警
|
||||
200.monitoring-1=监控
|
||||
300.alert-1=告警
|
||||
500.daily-inspection=日常巡检
|
||||
200.full-link-detection=全链路诊断
|
||||
600.performance-diagnosis=性能诊断
|
||||
800.emergency-response=应急处理
|
||||
300.common-emergency-response=常见应急问题处理
|
||||
100.issues-in-the-hardware-environment=硬件环境导致的问题
|
||||
200.problems-caused-by-capacity-changes=容量变化导致的问题
|
||||
300.other-problems-within-the-cluster=集群内部其他问题
|
||||
1200.data-security-management=数据库安全
|
||||
600.data-migration=数据迁移
|
||||
200.migrate-data-from-MySQL-database-to-OceanBase-database=从 MySQL 迁移到 OceanBase 数据库
|
||||
400.migrate-data-from-CSV-file-to-OceanBase-database=从 CSV 文件迁移数据到 OceanBase 数据库
|
||||
700.migrate-data-from-OceanBase-database-to-MySQL=从 OceanBase 迁移到 MySQL 数据库
|
||||
700.reference=参考指南
|
||||
100.oceanbase-database-concepts=系统架构
|
||||
300.multi-tenant-architecture-1=多租户架构
|
||||
500.tenants-and-resource-management-1=租户与资源管理
|
||||
400.database-objects-1=数据库对象
|
||||
100.introduction-to-database-objects-1=数据库对象介绍
|
||||
200.table-1=表
|
||||
200.data-type-3=数据类型
|
||||
300.index-1=索引
|
||||
400.partition-2=分区
|
||||
500.view-2=视图
|
||||
600.system-view-2=系统视图
|
||||
700.data-integrity-1=数据完整性
|
||||
200.integrity-constraint-type-1=完整性约束类型
|
||||
500.distributed-database-objects=分布式数据库对象
|
||||
300.data-partitions-and-replicas=数据分区和分区副本
|
||||
300.partition-replica-type=分区副本类型
|
||||
400.dynamic-scaling=动态扩容和缩容
|
||||
200.scale-in-and-scale-out-of-tenant-resources-1=租户内资源的扩容和缩容
|
||||
600.data-link-1=数据链路
|
||||
200.database-proxy-1=数据库代理
|
||||
700.user-interface-and-query-language=用户接口和查询语言
|
||||
100.SQL=SQL
|
||||
100.sql-introduction=SQL 介绍
|
||||
200.sql-statement-2=SQL 语句
|
||||
500.distributed-execution-plan-2=分布式执行计划
|
||||
200.PL=PL
|
||||
800.transaction-management-1=事务管理
|
||||
100.transaction-2=事务
|
||||
500.transaction-control=事务控制
|
||||
800.distributed-transactions-1=分布式事务
|
||||
200.transaction-concurrency-and-consistency=事务并发和一致性
|
||||
300.concurrency-control-1=并发控制
|
||||
400.transaction-isolation-level=事务隔离级别
|
||||
900.storage-architecture-1=存储架构
|
||||
200.data-storage=数据存储
|
||||
300.dump-and-merge-1=转储和合并
|
||||
600.data-integrity-2=数据完整性
|
||||
1000.high-data-reliability-and-availability=数据可靠性和高可用
|
||||
100.high-availability-architecture=高可用架构
|
||||
400.data-protection=数据保护
|
||||
500.backup-and-restoration=备份恢复
|
||||
1100.database-security=数据安全
|
||||
1200.observer-node-architecture=OBServer 节点架构
|
||||
300.observer-thread-model=observer 线程模型
|
||||
500.memory-management=内存管理
|
||||
200.sql-syntax=SQL 语句
|
||||
100.system-tenants=系统租户
|
||||
200.alter-system=ALTER SYSTEM
|
||||
200.common-tenant-mysql-mode=普通租户
|
||||
100.basic-elements=基本元素
|
||||
100.data-type=数据类型
|
||||
200.numeric-1=数值类型
|
||||
300.date-and-time-types-1=日期时间类型
|
||||
400.string-2=字符类型
|
||||
500.large-object-1=大对象和文本类型
|
||||
800.json-formatted-data-type=JSON 数据类型
|
||||
200.expression-2=表达式
|
||||
300.character-set-and-collation=字符集与字符序
|
||||
400.literal=字面量
|
||||
200.operator=运算符
|
||||
400.functions=函数
|
||||
200.functions-1=单行函数
|
||||
100.date-and-time-functions-1=日期时间函数
|
||||
200.string-functions=字符串函数
|
||||
300.conversion-functions-1=转换函数
|
||||
400.mathematical-functions=数学函数
|
||||
500.comparison-functions=比较函数
|
||||
600.process-control-functions=流程控制函数
|
||||
300.aggregate-function=聚合函数
|
||||
400.analysis-functions-1=分析函数
|
||||
500.encryption-functions=加密函数
|
||||
600.information-functions=信息函数
|
||||
700.json-functions=JSON 函数
|
||||
100.create-a-function-with-json-text=创建 JSON 文本的函数
|
||||
200.a-function-to-search-for-json-text=搜索 JSON 文本的函数
|
||||
300.function-to-modify-json-text=修改 JSON 文本的函数
|
||||
400.function-that-returns-the-json-text-property=返回 JSON 文本属性的函数
|
||||
500.json-functions-1=JSON 工具函数
|
||||
600.json-aggregate-functions=JSON 聚合函数
|
||||
800.other-functions=其它函数
|
||||
500.queries-and-subqueries=查询和子查询
|
||||
600.sql-statement=SQL语句
|
||||
5100.SELECT-1-2=SELECT
|
||||
700.ddl-function=DDL 功能
|
||||
300.system-views=系统视图
|
||||
200.dictionary-view-5=字典视图
|
||||
300.performance-view-5=性能视图
|
||||
400.system-variables=系统变量
|
||||
500.system-configuration-items=系统配置项
|
||||
300.cluster-level-configuration-items-1=集群级别配置项
|
||||
400.tenant-level-configuration-items-1=租户级别配置项
|
||||
600.error-codes=错误码
|
||||
800.supporting-tools=生态工具
|
||||
100.ob-admin=ob_admin
|
||||
300.clog=clog
|
||||
200.ob-agent=OBAgent
|
||||
100.about-obagent=关于 OBAgent
|
||||
200.configuration-reference=配置引用
|
||||
300.install-and-deploy-obagent=安装部署
|
||||
400.obagent-metrics=OBAgent 指标
|
||||
400.cdc=CDC
|
||||
200.obcdc=obcdc
|
||||
100.deploy-and-use-obcdc=obcdc 部署和使用
|
||||
200.obcdc-parameters=obcdc 参数说明
|
||||
300.oblogproxy=oblogproxy
|
||||
100.install-and-deploy-oblogproxy=oblogproxy 安装部署
|
||||
400.oblogmsg=oblogmsg
|
||||
1000.mysqltest=mysqltest
|
||||
200.use-of-case=case 使用
|
||||
900.releasenotes=版本发布记录
|
||||
9900.V4.0=V4.0
|
||||
10000.V3.1=V3.1
|
||||
1.oceanbase-database-overview=OceanBase 简介
|
||||
2.quick-start=快速上手
|
||||
1.Getting-started-with-OceanBase-SQL=上手 OceanBase SQL
|
||||
2.Create-a-sample-application=创建示例应用程序
|
||||
3.Experience-the-advanced-features-of-OceanBase=体验 OceanBase 高级特性
|
||||
1.Experience-Scalable-OLTP=体验 Scalable OLTP
|
||||
3.developer-guide=应用开发
|
||||
1.client-connects-to-oceanbase-database=客户端连接 OceanBase 数据库
|
||||
14.database-connection-pool-configuration-example=数据库连接池配置示例
|
||||
6.c-application=C 应用程序
|
||||
2.create-and-manage-database-objects=创建和管理数据库对象
|
||||
4.data-type=数据类型
|
||||
6.create-and-manage-tables=创建和管理表
|
||||
7.create-and-manage-partition-table=创建和管理分区表
|
||||
8.create-and-manage-indexes=创建和管理索引
|
||||
10.create-and-manage-views=创建和管理视图
|
||||
11.managing-and-creating-sequences=创建和管理序列
|
||||
12.create-and-manage-triggers=创建和管理触发器
|
||||
3.query=查询
|
||||
8.multi-table-join-queries=多表关联查询
|
||||
9.use-operators-and-functions-in-queries=在查询中使用操作符和函数
|
||||
10.execution-plan=执行计划
|
||||
4.about-dml-statements-and-transactions=关于 DML 语句和事务
|
||||
1.dml-statement=DML 语句
|
||||
2.transaction=事务
|
||||
5.common-errors-and-solutions-mysql=MySQL 模式下常见报错
|
||||
3.timeout=超时相关
|
||||
4.user-2=用户相关
|
||||
5.table-related-functions=表相关
|
||||
6.constraint-related-functions=约束相关
|
||||
7.sql-related-commands=SQL 相关
|
||||
4.installation-and-deployment=部署数据库
|
||||
2.local-deployment=本地部署
|
||||
4.highly-available-deployment=高可用部署
|
||||
5.administrator-guide=管理数据库
|
||||
5.database-connection-and-routing=数据库连接和路由
|
||||
2.obproxy-management=管理 OBProxy
|
||||
2.manage-obproxy-clusters=管理 OBProxy 集群
|
||||
3.obproxy-management=管理 OBProxy
|
||||
3.database-connection=连接数据库
|
||||
5.logical-connection=逻辑连接
|
||||
6.driver-management=驱动管理
|
||||
7.route-management=路由管理
|
||||
4.odp-routing-policy=ODP 路由策略
|
||||
6.basic-database-management=集群和多租户管理
|
||||
1.manage-clusters=管理集群
|
||||
3.manage-cluster-parameters=管理集群参数
|
||||
4.manage-zones-in-a-cluster=管理集群中的 Zone
|
||||
5.manage-observers=管理 OBServer
|
||||
2.configuration-management=配置管理
|
||||
3.manage-resources=管理资源
|
||||
3.manage-resource-units=管理资源单元
|
||||
5.manage-resource-pools-1=管理资源池
|
||||
4.manage-tenants-1=管理租户
|
||||
4.manage-tenants-2=管理租户
|
||||
5.manage-users-and-permissions=管理用户和权限
|
||||
1.users-and-permissions=用户及权限介绍
|
||||
3.mysql-3=MySQL 模式
|
||||
13.manage-tenant-parameters=管理租户参数
|
||||
5.manage-data-storage=管理数据存储
|
||||
1.dump-management-1=转储管理
|
||||
2.merge-management-1=合并管理
|
||||
3.data-compression-1=数据压缩
|
||||
7.memory-management-1=管理内存
|
||||
8.management-process=管理进程
|
||||
9.manage-logs=管理日志
|
||||
2.log-print-level=日志打印级别
|
||||
3.manage-the-size-and-quantity-of-log-files-2=日志文件大小及数量管理
|
||||
4.view-logs-2=查看日志
|
||||
7.database-object-management=数据库对象管理
|
||||
1.manage-databases=管理数据库
|
||||
2.manage-tables=管理表
|
||||
4.manage-indexes=管理索引
|
||||
8.distributed-storage-management=分布式存储管理
|
||||
2.manage-partition-table=管理分区
|
||||
9.create-partition-table-index-3=创建分区表索引
|
||||
4.manage-replicas=管理副本
|
||||
5.locality-management-1=管理 Locality
|
||||
9.performance-tuning-guide=性能调优
|
||||
2.performance-related-tools=性能相关工具
|
||||
1.system-tools=系统工具
|
||||
2.internal-table=内部表
|
||||
3.log-information=日志
|
||||
3.system-tuning=系统调优
|
||||
2.database-parameter-tuning=数据库参数调优
|
||||
3.obproxy-parameter-optimization=OBProxy 参数调优
|
||||
4.business-model-tuning=业务模型调优
|
||||
5.sql-optimization=SQL 调优指南
|
||||
2.sql-execution-plan=SQL 执行计划
|
||||
2.execution-plan-operator=执行计划算子
|
||||
3.distributed-execution-plan=分布式执行计划
|
||||
4.sql-optimization-1=SQL 调优
|
||||
3.monitor-sql-execution-performance=SQL 执行性能监控
|
||||
4.sql-performance-analysis-example=SQL 性能分析示例
|
||||
4.optimizer-statistics=优化器统计信息
|
||||
2.statistics-collection-methods=统计信息收集方式
|
||||
3.statistics-management=统计信息管理
|
||||
5.query-rewrite=查询改写
|
||||
6.query-optimization=查询优化
|
||||
1.access-path=访问路径
|
||||
2.join-algorithm=联接算法
|
||||
7.manage-execution-plans=管理执行计划
|
||||
6.performance-whitepaper=性能测试
|
||||
10.high-data-availability=高可用和容灾
|
||||
1.administrator-guide-flashback=闪回
|
||||
2.backup-and-restoration-management=备份恢复管理
|
||||
3.log-archive=日志归档
|
||||
4.data-backup=数据备份
|
||||
5.cleaning-up-backed-up-data=清理备份
|
||||
6.restore-data=恢复数据
|
||||
11.operation-and-maintenance-management=运维管理
|
||||
2.scale-out-and-scale-in-1=扩容和缩容
|
||||
2.cluster-level-scale-out-and-scale-in=集群级别的扩容和缩容
|
||||
1.scale-out=扩容
|
||||
2.shrink-1=缩容
|
||||
3.scale-in-and-scale-out-of-tenant-resources=租户内资源的扩容和缩容
|
||||
4.monitoring-and-alerting=监控和告警
|
||||
2.monitoring-1=监控
|
||||
3.alert-1=告警
|
||||
5.daily-inspection=日常巡检
|
||||
2.full-link-detection=全链路诊断
|
||||
6.performance-diagnosis=性能诊断
|
||||
8.emergency-response=应急处理
|
||||
3.common-emergency-response=常见应急问题处理
|
||||
1.issues-in-the-hardware-environment=硬件环境导致的问题
|
||||
2.problems-caused-by-capacity-changes=容量变化导致的问题
|
||||
3.other-problems-within-the-cluster=集群内部其他问题
|
||||
12.data-security-management=数据库安全
|
||||
6.data-migration=数据迁移
|
||||
2.migrate-data-from-MySQL-database-to-OceanBase-database=从 MySQL 迁移到 OceanBase 数据库
|
||||
4.migrate-data-from-CSV-file-to-OceanBase-database=从 CSV 文件迁移数据到 OceanBase 数据库
|
||||
7.migrate-data-from-OceanBase-database-to-MySQL=从 OceanBase 迁移到 MySQL 数据库
|
||||
7.reference=参考指南
|
||||
1.oceanbase-database-concepts=系统架构
|
||||
3.multi-tenant-architecture-1=多租户架构
|
||||
5.tenants-and-resource-management-1=租户与资源管理
|
||||
4.database-objects-1=数据库对象
|
||||
1.introduction-to-database-objects-1=数据库对象介绍
|
||||
2.table-1=表
|
||||
2.data-type-3=数据类型
|
||||
3.index-1=索引
|
||||
4.partition-2=分区
|
||||
5.view-2=视图
|
||||
6.system-view-2=系统视图
|
||||
7.data-integrity-1=数据完整性
|
||||
2.integrity-constraint-type-1=完整性约束类型
|
||||
5.distributed-database-objects=分布式数据库对象
|
||||
3.data-partitions-and-replicas=数据分区和分区副本
|
||||
3.partition-replica-type=分区副本类型
|
||||
4.dynamic-scaling=动态扩容和缩容
|
||||
2.scale-in-and-scale-out-of-tenant-resources-1=租户内资源的扩容和缩容
|
||||
6.data-link-1=数据链路
|
||||
2.database-proxy-1=数据库代理
|
||||
7.user-interface-and-query-language=用户接口和查询语言
|
||||
1.SQL=SQL
|
||||
1.sql-introduction=SQL 介绍
|
||||
2.sql-statement-2=SQL 语句
|
||||
5.distributed-execution-plan-2=分布式执行计划
|
||||
2.PL=PL
|
||||
8.transaction-management-1=事务管理
|
||||
1.transaction-2=事务
|
||||
5.transaction-control=事务控制
|
||||
8.distributed-transactions-1=分布式事务
|
||||
2.transaction-concurrency-and-consistency=事务并发和一致性
|
||||
3.concurrency-control-1=并发控制
|
||||
4.transaction-isolation-level=事务隔离级别
|
||||
9.storage-architecture-1=存储架构
|
||||
2.data-storage=数据存储
|
||||
3.dump-and-merge-1=转储和合并
|
||||
6.data-integrity-2=数据完整性
|
||||
10.high-data-reliability-and-availability=数据可靠性和高可用
|
||||
1.high-availability-architecture=高可用架构
|
||||
4.data-protection=数据保护
|
||||
5.backup-and-restoration=备份恢复
|
||||
11.database-security=数据安全
|
||||
12.observer-node-architecture=OBServer 节点架构
|
||||
3.observer-thread-model=observer 线程模型
|
||||
5.memory-management=内存管理
|
||||
2.sql-syntax=SQL 语句
|
||||
1.system-tenants=系统租户
|
||||
2.alter-system=ALTER SYSTEM
|
||||
2.common-tenant-mysql-mode=普通租户
|
||||
1.basic-elements=基本元素
|
||||
1.data-type=数据类型
|
||||
2.numeric-1=数值类型
|
||||
3.date-and-time-types-1=日期时间类型
|
||||
4.string-2=字符类型
|
||||
5.large-object-1=大对象和文本类型
|
||||
8.json-formatted-data-type=JSON 数据类型
|
||||
2.expression-2=表达式
|
||||
3.character-set-and-collation=字符集与字符序
|
||||
4.literal=字面量
|
||||
2.operator=运算符
|
||||
4.functions=函数
|
||||
2.functions-1=单行函数
|
||||
1.date-and-time-functions-1=日期时间函数
|
||||
2.string-functions=字符串函数
|
||||
3.conversion-functions-1=转换函数
|
||||
4.mathematical-functions=数学函数
|
||||
5.comparison-functions=比较函数
|
||||
6.process-control-functions=流程控制函数
|
||||
3.aggregate-function=聚合函数
|
||||
4.analysis-functions-1=分析函数
|
||||
5.encryption-functions=加密函数
|
||||
6.information-functions=信息函数
|
||||
7.json-functions=JSON 函数
|
||||
1.create-a-function-with-json-text=创建 JSON 文本的函数
|
||||
2.a-function-to-search-for-json-text=搜索 JSON 文本的函数
|
||||
3.function-to-modify-json-text=修改 JSON 文本的函数
|
||||
4.function-that-returns-the-json-text-property=返回 JSON 文本属性的函数
|
||||
5.json-functions-1=JSON 工具函数
|
||||
6.json-aggregate-functions=JSON 聚合函数
|
||||
8.other-functions=其它函数
|
||||
5.queries-and-subqueries=查询和子查询
|
||||
6.sql-statement=SQL语句
|
||||
51.SELECT-1-2=SELECT
|
||||
7.ddl-function=DDL 功能
|
||||
3.system-views=系统视图
|
||||
2.dictionary-view-5=字典视图
|
||||
3.performance-view-5=性能视图
|
||||
4.system-variables=系统变量
|
||||
5.system-configuration-items=系统配置项
|
||||
3.cluster-level-configuration-items-1=集群级别配置项
|
||||
4.tenant-level-configuration-items-1=租户级别配置项
|
||||
6.error-codes=错误码
|
||||
8.supporting-tools=生态工具
|
||||
1.ob-admin=ob_admin
|
||||
3.clog=clog
|
||||
2.ob-agent=OBAgent
|
||||
1.about-obagent=关于 OBAgent
|
||||
2.configuration-reference=配置引用
|
||||
3.install-and-deploy-obagent=安装部署
|
||||
4.obagent-metrics=OBAgent 指标
|
||||
4.cdc=CDC
|
||||
2.obcdc=obcdc
|
||||
1.deploy-and-use-obcdc=obcdc 部署和使用
|
||||
2.obcdc-parameters=obcdc 参数说明
|
||||
3.oblogproxy=oblogproxy
|
||||
1.install-and-deploy-oblogproxy=oblogproxy 安装部署
|
||||
4.oblogmsg=oblogmsg
|
||||
10.mysqltest=mysqltest
|
||||
2.use-of-case=case 使用
|
||||
9.releasenotes=版本发布记录
|
||||
99.V4.0=V4.0
|
||||
100.V3.1=V3.1
|
|
@ -1,37 +1,37 @@
|
|||
100.oceanbase-database-overview=Overview
|
||||
200.quick-start=Get Started
|
||||
200.Hands-on-for-OceanBase-SQL=Hands on for OceanBase SQL
|
||||
300.Create-a-sample-application=Create a sample application
|
||||
400.Experience-OceanBase-Advanced-Features=Experience OceanBase advanced features
|
||||
100.Experience-Scalable-OLTP=Experience scalable OLTP
|
||||
300.developer-guide=Develop
|
||||
100.client-connects-to-oceanbase-database=Connect to Oceanbase Database with client
|
||||
600.c-application=C application
|
||||
1400.database-connection-pool-configuration-example=Example of Database connection pool configuration
|
||||
200.create-and-manage-database-objects=Create and manage database objects
|
||||
400.data-type=Data type
|
||||
600.create-and-manage-tables=Create and manage tables
|
||||
700.create-and-manage-partition-table=Create and manage partition tables
|
||||
800.create-and-manage-indexes=Create and manage indexes
|
||||
1000.create-and-manage-views=Create and manage views
|
||||
1100.managing-and-creating-sequences=Create and manage sequences
|
||||
300.query=Query
|
||||
800.multi-table-join-queries=Query data from multiple tables
|
||||
900.use-operators-and-functions-in-queries=Use operators and functions in a query
|
||||
1000.execution-plan=Execution plan
|
||||
400.about-dml-statements-and-transactions=DML statements and transactions
|
||||
100.dml-statement=DML statement
|
||||
200.transaction=Transactions
|
||||
500.common-errors-and-solutions-mysql=Common errors and solutions
|
||||
0300.timeout=About timeout
|
||||
0400.user-2=About user
|
||||
0500.table-related-functions=About table
|
||||
0600.constraint-related-functions=About constraint
|
||||
0700.sql-related-commands=About SQL commands
|
||||
400.installation-and-deployment=Deploy
|
||||
200.local-deployment=On-premises deployment
|
||||
400.highly-available-deployment=High availability deployment
|
||||
600.data-migration=Migrate
|
||||
200.migrate-data-from-MySQL-database-to-OceanBase-database=Migrate data from MySQL Database to OceanBase
|
||||
400.migrate-data-from-CSV-file-to-OceanBase-database=Migrate data from CSV-file to OceanBase
|
||||
700.migrate-data-from-OceanBase-database-to-MySQL=Migrate data from OceanBase Database to MySQL
|
||||
1.oceanbase-database-overview=Overview
|
||||
2.quick-start=Get Started
|
||||
2.Hands-on-for-OceanBase-SQL=Hands on for OceanBase SQL
|
||||
3.Create-a-sample-application=Create a sample application
|
||||
4.Experience-OceanBase-Advanced-Features=Experience OceanBase advanced features
|
||||
1.Experience-Scalable-OLTP=Experience scalable OLTP
|
||||
3.developer-guide=Develop
|
||||
1.client-connects-to-oceanbase-database=Connect to Oceanbase Database with client
|
||||
6.c-application=C application
|
||||
14.database-connection-pool-configuration-example=Example of Database connection pool configuration
|
||||
2.create-and-manage-database-objects=Create and manage database objects
|
||||
4.data-type=Data type
|
||||
6.create-and-manage-tables=Create and manage tables
|
||||
7.create-and-manage-partition-table=Create and manage partition tables
|
||||
8.create-and-manage-indexes=Create and manage indexes
|
||||
10.create-and-manage-views=Create and manage views
|
||||
11.managing-and-creating-sequences=Create and manage sequences
|
||||
3.query=Query
|
||||
8.multi-table-join-queries=Query data from multiple tables
|
||||
9.use-operators-and-functions-in-queries=Use operators and functions in a query
|
||||
10.execution-plan=Execution plan
|
||||
4.about-dml-statements-and-transactions=DML statements and transactions
|
||||
1.dml-statement=DML statement
|
||||
2.transaction=Transactions
|
||||
5.common-errors-and-solutions-mysql=Common errors and solutions
|
||||
03.timeout=About timeout
|
||||
04.user-2=About user
|
||||
05.table-related-functions=About table
|
||||
06.constraint-related-functions=About constraint
|
||||
07.sql-related-commands=About SQL commands
|
||||
4.installation-and-deployment=Deploy
|
||||
2.local-deployment=On-premises deployment
|
||||
4.highly-available-deployment=High availability deployment
|
||||
6.data-migration=Migrate
|
||||
2.migrate-data-from-MySQL-database-to-OceanBase-database=Migrate data from MySQL Database to OceanBase
|
||||
4.migrate-data-from-CSV-file-to-OceanBase-database=Migrate data from CSV-file to OceanBase
|
||||
7.migrate-data-from-OceanBase-database-to-MySQL=Migrate data from OceanBase Database to MySQL
|
|
@ -0,0 +1,13 @@
|
|||
# Document overview
|
||||
|
||||
OceanBase is an enterprise-grade open source distributed SQL database. It supports transparent scalability, distributed transaction, multi-tenancy, and is highly compatible with MySQL
|
||||
|
||||
|
||||
|
||||
| Get started | Develop | Migrate |
|
||||
|----------------------------|-------------------------------------|-------------------------------------|
|
||||
| [OceanBase Overview](1.oceanbase-database-overview/1.what-is-oceanbase-database.md) | [Connect to OceanBase via OBClient](3.developer-guide/1.client-connects-to-oceanbase-database/3.connect-oceanbase-tenants-through-obclient.md) | [Use Canal to synchronize MySQL data to OceanBase Database in real time](6.data-migration/2.migrate-data-from-MySQL-database-to-OceanBase-database/7.use-canal-to-synchronize-MySQL-data-to-OceanBase-database-in-real-time.md) |
|
||||
| [Quick experience](2.quick-start/1.Quickly-experience-OceanBase.md) | [Manage database objects](3.developer-guide/2.create-and-manage-database-objects/1.about-ddl-statements.md) |[Use DBCAT to migrate MySQL table schemas to OceanBase Database](6.data-migration/2.migrate-data-from-MySQL-database-to-OceanBase-database/10.use-DBCAT-to-migrate-MySQL-table-structure-to-OceanBase-database.md) |
|
||||
| [Basic SQL operations](2.quick-start/2.Hands-on-for-OceanBase-SQL/2.SQL-operations.md) | [Write data](3.developer-guide/4.about-dml-statements-and-transactions/1.dml-statement/1.about-dml-statements.md) |[Migrate MySQL table schemas to OceanBase Database by using mysqldump](6.data-migration/2.migrate-data-from-MySQL-database-to-OceanBase-database/12.use-MySQLDump-to-migrate-MySQL-table-structure-to-OceanBase-database.md) |
|
||||
| [Connect to OceanBase](2.quick-start/3.Create-a-sample-application/1.Connect-a-Python-application-to-OceanBase-Database.md) |[Query data](3.developer-guide/3.query/1.about-queries.md) |[Migrate MySQL table data to OceanBase Database by using mysqldump](6.data-migration/2.migrate-data-from-MySQL-database-to-OceanBase-database/13.use-MySQLDump-to-migrate-MySQL-table-data-to-OceanBase-database.md) |
|
||||
| [Run the TPC-C benchmark test on OceanBase Database](2.quick-start/4.Experience-OceanBase-Advanced-Features/1.Experience-Scalable-OLTP/1.TPC-C-test-on-OceanBase.md) |[Transaction](3.developer-guide/4.about-dml-statements-and-transactions/2.transaction/1.about-transactional-control-statements.md) | [Use DataX to migrate MySQL data to OceanBase Database](6.data-migration/2.migrate-data-from-MySQL-database-to-OceanBase-database/9.migrate-MySQL-data-to-OceanBase-database-using-dataX.md) |
|
|
@ -1,13 +0,0 @@
|
|||
# Document overview
|
||||
|
||||
OceanBase is an enterprise-grade open source distributed SQL database. It supports transparent scalability, distributed transaction, multi-tenancy, and is highly compatible with MySQL
|
||||
|
||||
|
||||
|
||||
| Get started | Develop | Migrate |
|
||||
|----------------------------|-------------------------------------|-------------------------------------|
|
||||
| [OceanBase Overview](100.oceanbase-database-overview/100.what-is-oceanbase-database.md) | [Connect to OceanBase via OBClient](300.developer-guide/100.client-connects-to-oceanbase-database/300.connect-oceanbase-tenants-through-obclient.md) | [Use Canal to synchronize MySQL data to OceanBase Database in real time](600.data-migration/200.migrate-data-from-MySQL-database-to-OceanBase-database/700.use-canal-to-synchronize-MySQL-data-to-OceanBase-database-in-real-time.md) |
|
||||
| [Quick experience](200.quick-start/100.Quickly-experience-OceanBase.md) | [Manage database objects](300.developer-guide/200.create-and-manage-database-objects/100.about-ddl-statements.md) |[Use DBCAT to migrate MySQL table schemas to OceanBase Database](600.data-migration/200.migrate-data-from-MySQL-database-to-OceanBase-database/1000.use-DBCAT-to-migrate-MySQL-table-structure-to-OceanBase-database.md) |
|
||||
| [Basic SQL operations](200.quick-start/200.Hands-on-for-OceanBase-SQL/200.SQL-operations.md) | [Write data](300.developer-guide/400.about-dml-statements-and-transactions/100.dml-statement/100.about-dml-statements.md) |[Migrate MySQL table schemas to OceanBase Database by using mysqldump](600.data-migration/200.migrate-data-from-MySQL-database-to-OceanBase-database/1200.use-MySQLDump-to-migrate-MySQL-table-structure-to-OceanBase-database.md) |
|
||||
| [Connect to OceanBase](200.quick-start/300.Create-a-sample-application/100.Connect-a-Python-application-to-OceanBase-Database.md) |[Query data](300.developer-guide/300.query/100.about-queries.md) |[Migrate MySQL table data to OceanBase Database by using mysqldump](600.data-migration/200.migrate-data-from-MySQL-database-to-OceanBase-database/1300.use-MySQLDump-to-migrate-MySQL-table-data-to-OceanBase-database.md) |
|
||||
| [Run the TPC-C benchmark test on OceanBase Database](200.quick-start/400.Experience-OceanBase-Advanced-Features/100.Experience-Scalable-OLTP/100.TPC-C-test-on-OceanBase.md) |[Transaction](300.developer-guide/400.about-dml-statements-and-transactions/200.transaction/100.about-transactional-control-statements.md) | [Use DataX to migrate MySQL data to OceanBase Database](600.data-migration/200.migrate-data-from-MySQL-database-to-OceanBase-database/900.migrate-MySQL-data-to-OceanBase-database-using-dataX.md) |
|
|
@ -0,0 +1,35 @@
|
|||
# Overview
|
||||
|
||||
OceanBase Database is an enterprise-grade distributed database management system (DBMS) with excellent transactional and analytical processing capabilities. It is used in various business scenarios and has a complete peripheral support system.
|
||||
|
||||
As a proprietary DBMS, OceanBase Database supports both hybrid transactional and analytical processing (HTAP) with a single architecture, which combines the high scalability of a distributed system and the high efficiency of a centralized system.
|
||||
|
||||
OceanBase Database provides the same atomicity, consistency, isolation, and durability (ACID) capability in both centralized and distributed modes. It uses the Paxos protocol-based multi-replica synchronization algorithm, which guarantees consistency among multiple data replicas. In case a hardware failure occurs, OceanBase Database can quickly perform a replica switchover to ensure the availability of database services. In addition, it is compatible with MySQL syntaxes, making it easy to migrate your data from a MySQL database to an OceanBase database. Moreover, OceanBase Database uses code-based compression to significantly reduce storage space required.
|
||||
|
||||
OceanBase Database ranks No.1 in the TPC-C benchmark test with a performance result of 707.35 million tpmC and ranks No.2 in the TPC-H benchmark test with a performance result of 15.26 million QphH@30,000 GB.
|
||||
|
||||
OceanBase Database has supported the stable and efficient operation of core business systems of customers in various industries, such as banking, insurance, transportation, and telecommunications.
|
||||
|
||||
## Core features
|
||||
|
||||
OceanBase Database provides the following features:
|
||||
|
||||
* Higher stability
|
||||
|
||||
OceanBase Database has been supporting the Double 11 Shopping Festival (the biggest online shopping festival in the world) for 9 consecutive years and has been tested in core systems of Ant Group with more than a million servers. It supports single-server failure recovery, cross-city cross-IDC disaster recovery, and multi-replica data storage. OceanBase has innovatively launched a new city-level disaster recovery standard of "Five IDCs across Three Cities". OceanBase can achieve Recovery Point Objective (RPO) = 0, Recovery Time Objective (RTO) ≤ 8 seconds, which reaches the financial-grade disaster recovery standard level 6.
|
||||
|
||||
* Stronger performance
|
||||
|
||||
OceanBase Database supports online transaction processing (OLTP) and online analytical processing (OLAP), even in the case of massive data. OLTP and OLAP resources are isolated from each other and can be linearly scaled. OceanBase Database achieves a performance result of 707.35 million tpmC in the TPC-C benchmark test and a performance result of 15.26 million QphH@30,000 GB in the TPC-H benchmark test.
|
||||
|
||||
* Improved KV query performance
|
||||
|
||||
OceanBase Database has the OBKV capability, which provides NoSQL capabilities for the HBase and Table models. The performance of OBKV is exponentially improved with secondary indexing, which avoids HBase performance jitters.
|
||||
|
||||
* Lower storage and O&M costs
|
||||
|
||||
OceanBase Database can be deployed on PC servers with low-end SSDs. Its high compression ratio reduces storage costs, and its decentralized multi-tenant architecture significantly improves the utilization of compute resources. It also supports popular tools in the database ecosystem, such as Prometheus and Canal, which makes O&M easier.
|
||||
|
||||
* Compatible with MySQL open source ecosystem
|
||||
|
||||
OceanBase Database is highly compatible with the MySQL ecosystem and provides modular tools that allow users to manage the entire lifecycle of a database, including development, debugging, production, O&M, and data transmission.
|
|
@ -1,48 +0,0 @@
|
|||
# Overview
|
||||
|
||||
OceanBase Database is an enterprise-grade distributed database management system (DBMS) with excellent transactional and analytical processing capabilities. It is used in various business scenarios and has a complete peripheral support system.
|
||||
|
||||
As a proprietary DBMS, OceanBase Database supports both hybrid transactional and analytical processing (HTAP) with a single architecture, which combines the high scalability of a distributed system and the high efficiency of a centralized system.
|
||||
|
||||
OceanBase Database provides the same atomicity, consistency, isolation, and durability (ACID) capability in both centralized and distributed modes. It uses the Paxos protocol-based multi-replica synchronization algorithm, which guarantees consistency among multiple data replicas. In case a hardware failure occurs, OceanBase Database can quickly perform a replica switchover to ensure the availability of database services. In addition, it is compatible with MySQL syntaxes, making it easy to migrate your data from a MySQL database to an OceanBase database. Moreover, OceanBase Database uses code-based compression to significantly reduce storage space required.
|
||||
|
||||
OceanBase Database ranks No.1 in the TPC-C benchmark test with a performance result of 707.35 million tpmC and ranks No.2 in the TPC-H benchmark test with a performance result of 15.26 million QphH@30,000 GB.
|
||||
|
||||
OceanBase Database has supported the stable and efficient operation of core business systems of customers in various industries, such as banking, insurance, transportation, and telecommunications.
|
||||
|
||||
## Core features
|
||||
|
||||
OceanBase Database provides the following features:
|
||||
|
||||
### High availability
|
||||
|
||||
OceanBase Database implements a unique disaster recovery solution with five IDCs across three regions, which sets forth a new standard for lossless disaster recovery in the financial industry. OceanBase Database supports multi-active IDCs deployed across multiple regions for zone- and geo-disaster recovery, which meets the Level 6 disaster recovery requirements of the financial industry with a recovery point objective (RPO) of 0 and a recovery time objective (RTO) of less than 8 seconds.
|
||||
|
||||
### High compatibility
|
||||
|
||||
OceanBase Database is highly compatible with most general features of MySQL, and supports advanced features such as procedural language and triggers. OceanBase Migration Service (OMS), an automatic migration tool, is provided to support reverse synchronization to ensure data migration security when a core system is migrated to OceanBase Database in key industries such as finance, public governance, and communication service.
|
||||
|
||||
### Scaling out
|
||||
|
||||
OceanBase Database supports rapid transparent horizontal scaling in response to business fluctuations, and achieves high performance based on a quasi-memory transaction processing architecture. You can deploy thousands of nodes in an OceanBase cluster, where the maximum data volume can exceed 3 PB and a single table can contain trillions of rows.
|
||||
|
||||
### Low costs
|
||||
|
||||
OceanBase Database adopts a storage engine based on the log-structured merge-tree (LSM-tree), which can achieve a high compression ratio and reduce storage costs by 70% to 90%. OceanBase Database also supports native multitenancy, which means that the same cluster can serve multiple business lines with the data of one tenant isolated from that of others. These features reduce deployment and O&M costs.
|
||||
|
||||
### Real-time HTAP
|
||||
|
||||
OceanBase Database uses the same database engine to perform online real-time transactions and real-time analysis on the same set of data. Multiple replicas of the same set of data can be stored in different forms for different purposes. This fundamentally ensures data consistency.
|
||||
|
||||
### Security and reliability
|
||||
|
||||
The OceanBase team has been independently developing OceanBase Database for 12 years and has full control over its source code. The integrated architecture of OceanBase Database has reliably supported large-scale financial core systems for nine years. In addition to a sound roles and permissions management system, OceanBase Database also meets the Level 3 requirements of Multi-Level Protection Scheme (MLPS).
|
||||
|
||||
### Complete ownership of intellectual property rights
|
||||
|
||||
OceanBase Database is developed independently by Ant Group. It is not based on open-source databases such as MySQL or PostgreSQL. OceanBase Database is autonomous, controllable, and free from the technical limits of open-source databases.
|
||||
|
||||
|
||||
<!-- ### Compatibility with products from Chinese manufacturers
|
||||
|
||||
OceanBase Database supports products from Chinese manufacturers in full stack. OceanBase Database can work on physical servers from Chinese manufacturers including Sugon H620 series, TaiShan 200 series, and Great Wall Optimus DF720. OceanBase Database is also adaptive to CPUs including Hygon 7185/7280, Kunpeng 920, and FeiTeng 2000+. In addition, OceanBase Database supports operating systems from Chinese manufacturers, such as Kylin V4, Kylin V10, and UOS V20. OceanBase Database is also adaptive to upper-layer middleware including TongWeb V7.0 and Apusic Application Server V9.0. -->
|
|
@ -29,7 +29,7 @@ OceanBase Database allows you to address this issue by using any of the followin
|
|||
To enable write throttling when the tenant memory usage reaches 80% and ensure that the remaining memory is sufficient for data writing for 1 hour, log on to the database as the tenant administrator and execute the following statements:
|
||||
|
||||
```sql
|
||||
obclient -h127.0.0.1 -P2881 -uroot@test -Doceanbase -p******
|
||||
obclient -h127.0.0.1 -P2881 -uroot@test -Doceanbase -p
|
||||
|
||||
ALTER SYSTEM SET writing_throttling_trigger_percentage = 80;
|
||||
ALTER SYSTEM SET writing_throttling_maximum_duration = '1h';
|
||||
|
@ -42,7 +42,7 @@ OceanBase Database allows you to address this issue by using any of the followin
|
|||
1. Log on to the sys tenant of the OceanBase cluster as the administrator and execute the following SQL statement to confirm the unit_config name used by the current tenant.
|
||||
|
||||
```sql
|
||||
obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -p******
|
||||
obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -p
|
||||
|
||||
SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS\G ##The sys_unit_config parameter is a parameter of the sys tenant and you do not need to modify it. In this example, the test tenant is used and its unit_config name is test_unit.
|
||||
```
|
||||
|
@ -64,7 +64,7 @@ OceanBase Database allows you to address this issue by using any of the followin
|
|||
Log on to the sys tenant as the root user and execute the following statements:
|
||||
|
||||
```SQL
|
||||
obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -p******
|
||||
obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -p
|
||||
|
||||
ALTER SYSTEM SET freeze_trigger_percentage=40;
|
||||
ALTER SYSTEM SET memstore_limit_percentage=70;
|
File diff suppressed because it is too large
Load Diff
|
@ -1,87 +1,87 @@
|
|||
# Connect a Java application to OceanBase Database
|
||||
|
||||
You can connect to OceanBase Database by using MySQL Connector/J, which is the official Java Database Connectivity (JDBC) driver for MySQL.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* You have installed or upgraded to JDK 8 or later on your computer.
|
||||
|
||||
* You have installed MySQL Connector/J and configured its runtime environment.
|
||||
|
||||
We recommend that you use MySQL Connector/J 5.1.47. For more information about the download and installation methods, see [Connector/J Downloads](https://downloads.mysql.com/archives/c-j/) and [Connector/J Installation](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-installing.html).
|
||||
|
||||
## Connect to OceanBase Database
|
||||
|
||||
The following example shows how to connect to a database by using `MySQL Connector/J 5.1.47` in Linux.
|
||||
|
||||
After you install MySQL Connector/J 5.1.47 and configure its runtime environment, you can connect to the database based on the following sample code, which uses the `Test.java` file as an example:
|
||||
|
||||
> **Notice**
|
||||
>
|
||||
> If you use MySQL Connector/J 8.x, replace `com.mysql.jdbc.Driver` in the `Class.forName("com.mysql.jdbc.Driver")` field with `com.mysql.cj.jdbc.Driver`.
|
||||
|
||||
```java
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
|
||||
try{
|
||||
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://172.30.xx.xx:2883/test?user=r***&password=");
|
||||
System.out.println(connection.getAutoCommit());
|
||||
Statement sm = connection.createStatement();
|
||||
//Drop or create a table, and insert data.
|
||||
String q1="drop table if exists t_meta_form";
|
||||
sm.executeUpdate(q1);
|
||||
String q2="CREATE TABLE t_meta_form ( name varchar(36) NOT NULL DEFAULT ' ', id int NOT NULL ) DEFAULT CHARSET = utf8mb4";
|
||||
String q3="insert into t_meta_form (name,id) values ('an','1')";
|
||||
sm.executeUpdate(q2);
|
||||
sm.executeUpdate(q3);
|
||||
|
||||
}catch(SQLException se){
|
||||
System.out.println("error!");
|
||||
se.printStackTrace() ;
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Parameters
|
||||
|
||||
```java
|
||||
connection = DriverManager.getConnection("jdbc:mysql://{hostname}:{port}/{dbname}?user={username}&password={password}")
|
||||
```
|
||||
|
||||
* **hostname**: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
|
||||
* **port**: the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
|
||||
* **dbname**: the name of the database to be connected.
|
||||
|
||||
* **username**: the connection account of the tenant. By default, the username of the tenant administrator is `root`.
|
||||
|
||||
* **password**: the password of the connection account.
|
||||
|
||||
Example: `jdbc:mysql://172.30.xx.xx:2883/test?user=r***&password=******`
|
||||
|
||||
After you edit the code, run the following command to compile and execute the file. If `true` is returned, the database is connected.
|
||||
|
||||
```bash
|
||||
//Specify the actual installation path of mysql-connector-java-5.1.47.jar.
|
||||
export CLASSPATH=/usr/share/java/mysql-connector-java-5.1.47.jar:$CLASSPATH
|
||||
//Compile the file.
|
||||
javac Test.java
|
||||
//Run the file.
|
||||
java Test
|
||||
```
|
||||
# Connect a Java application to OceanBase Database
|
||||
|
||||
You can connect to OceanBase Database by using MySQL Connector/J, which is the official Java Database Connectivity (JDBC) driver for MySQL.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* You have installed or upgraded to JDK 8 or later on your computer.
|
||||
|
||||
* You have installed MySQL Connector/J and configured its runtime environment.
|
||||
|
||||
We recommend that you use MySQL Connector/J 5.1.47. For more information about the download and installation methods, see [Connector/J Downloads](https://downloads.mysql.com/archives/c-j/) and [Connector/J Installation](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-installing.html).
|
||||
|
||||
## Connect to OceanBase Database
|
||||
|
||||
The following example shows how to connect to a database by using `MySQL Connector/J 5.1.47` in Linux.
|
||||
|
||||
After you install MySQL Connector/J 5.1.47 and configure its runtime environment, you can connect to the database based on the following sample code, which uses the `Test.java` file as an example:
|
||||
|
||||
> **Notice**
|
||||
>
|
||||
> If you use MySQL Connector/J 8.x, replace `com.mysql.jdbc.Driver` in the `Class.forName("com.mysql.jdbc.Driver")` field with `com.mysql.cj.jdbc.Driver`.
|
||||
|
||||
```java
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
|
||||
try{
|
||||
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://172.30.xx.xx:2883/test?user=r***&password=");
|
||||
System.out.println(connection.getAutoCommit());
|
||||
Statement sm = connection.createStatement();
|
||||
//Drop or create a table, and insert data.
|
||||
String q1="drop table if exists t_meta_form";
|
||||
sm.executeUpdate(q1);
|
||||
String q2="CREATE TABLE t_meta_form ( name varchar(36) NOT NULL DEFAULT ' ', id int NOT NULL ) DEFAULT CHARSET = utf8mb4";
|
||||
String q3="insert into t_meta_form (name,id) values ('an','1')";
|
||||
sm.executeUpdate(q2);
|
||||
sm.executeUpdate(q3);
|
||||
|
||||
}catch(SQLException se){
|
||||
System.out.println("error!");
|
||||
se.printStackTrace() ;
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Parameters
|
||||
|
||||
```java
|
||||
connection = DriverManager.getConnection("jdbc:mysql://{hostname}:{port}/{dbname}?user={username}&password={password}")
|
||||
```
|
||||
|
||||
* **hostname**: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
|
||||
* **port**: the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
|
||||
* **dbname**: the name of the database to be connected.
|
||||
|
||||
* **username**: the connection account of the tenant. By default, the username of the tenant administrator is `root`.
|
||||
|
||||
* **password**: the password of the connection account.
|
||||
|
||||
Example: `jdbc:mysql://172.30.xx.xx:2883/test?user=r***&password=***1**`
|
||||
|
||||
After you edit the code, run the following command to compile and execute the file. If `true` is returned, the database is connected.
|
||||
|
||||
```bash
|
||||
//Specify the actual installation path of mysql-connector-java-5.1.47.jar.
|
||||
export CLASSPATH=/usr/share/java/mysql-connector-java-5.1.47.jar:$CLASSPATH
|
||||
//Compile the file.
|
||||
javac Test.java
|
||||
//Run the file.
|
||||
java Test
|
||||
```
|
|
@ -1,12 +1,12 @@
|
|||
# Connect a C application to OceanBase Database
|
||||
|
||||
This topic describes how to connect a C application to OceanBase Database.
|
||||
This topic describes how to connect a C application to OceanBase Database.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you install OceanBase Connector/C, make sure that you have set up the basic database development environment that meets the following requirements:
|
||||
|
||||
* The GNU Compiler Collection (GCC) version is 3.4.6 or later. Version 4.8.5 is recommended.
|
||||
* The GNU Compiler Collection (GCC) version is 3.4.6 or later. Version 4.8.5 is recommended.
|
||||
|
||||
* The CMake version is 2.8.12 or later.
|
||||
|
||||
|
@ -14,17 +14,17 @@ Before you install OceanBase Connector/C, make sure that you have set up the bas
|
|||
|
||||
### Install Linux
|
||||
|
||||
Obtain the RPM packages of OBClient and OceanBase Connector/C, which is also known as `libobclient`.
|
||||
Obtain the RPM packages of OBClient and OceanBase Connector/C, which is also known as `libobclient`.
|
||||
|
||||
You need to visit the image repository and find the installation packages based on your system version. For more information, see [Software and hardware requirements](../../400.installation-and-deployment/200.local-deployment/100.requirements-for-software-and-hardware.md).
|
||||
You need to visit the image repository and find the installation packages based on your system version. For more information, see [Software and hardware requirements](../../4.installation-and-deployment/2.local-deployment/1.requirements-for-software-and-hardware.md).
|
||||
|
||||
1. Install `libobclient`.
|
||||
1. Install `libobclient`.
|
||||
|
||||
```c
|
||||
sudo rpm -ivh libobclient-xx.x86_64.rpm
|
||||
```
|
||||
|
||||
2. Install OBClient.
|
||||
2. Install OBClient.
|
||||
|
||||
```c
|
||||
sudo rpm -ivh obclient-xx.x86_64.rpm
|
||||
|
@ -32,13 +32,13 @@ You need to visit the image repository and find the installation packages based
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> OBClient depends on `libobclient`. Therefore, you must install `libobclient` first.
|
||||
> OBClient depends on `libobclient`. Therefore, you must install `libobclient` first.
|
||||
|
||||
### Compile OBClient from source code
|
||||
|
||||
OceanBase Database provides the source code of the latest [OBClient](https://github.com/oceanbase/obclient) in its repository on Github, which also includes the repository of `libobclient`.
|
||||
OceanBase Database provides the source code of the latest [OBClient](https://github.com/oceanbase/obclient) in its repository on Github, which also includes the repository of `libobclient`.
|
||||
|
||||
1. Install the dependency tool.
|
||||
1. Install the dependency tool.
|
||||
|
||||
```c
|
||||
sudo yum install -y git cmake gcc make openssl-devel ncurses-devel rpm-build gcc-c++ bison bison-devel zlib-devel gnutls-devel libxml2-devel openssl-devel \
|
||||
|
@ -47,42 +47,42 @@ OceanBase Database provides the source code of the latest [OBClient](https://git
|
|||
|
||||
2. Compile and package the code.
|
||||
|
||||
1. Download the source code of [OBClient](https://github.com/oceanbase/obclient), which also includes sub-repositories.
|
||||
1. Download the source code of [OBClient](https://github.com/oceanbase/obclient), which also includes sub-repositories.
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/oceanbase/obclient #Download the source code of OBClient, which also includes sub-repositories.
|
||||
cd obclient
|
||||
```
|
||||
|
||||
2. Compile the script of `libobclient`.
|
||||
2. Compile the script of `libobclient`.
|
||||
|
||||
```bash
|
||||
cd obclient/libmariadb
|
||||
sh build.sh
|
||||
```
|
||||
|
||||
3. Compress the `libobclient` program in an RPM package.
|
||||
3. Compress the `libobclient` program in an RPM package.
|
||||
|
||||
```bash
|
||||
cd rpm
|
||||
sh libobclient-build.sh
|
||||
```
|
||||
|
||||
4. Compile the script of OBClient.
|
||||
4. Compile the script of OBClient.
|
||||
|
||||
```bash
|
||||
cd ../.. # Return to the obclient directory
|
||||
sh build.sh
|
||||
````
|
||||
|
||||
5. Compress the OBClient program in an RPM package.
|
||||
5. Compress the OBClient program in an RPM package.
|
||||
|
||||
```bash
|
||||
cd rpm
|
||||
sh obclient-build.sh
|
||||
```
|
||||
|
||||
3. Install `libobclient` and OBClient.
|
||||
3. Install `libobclient` and OBClient.
|
||||
|
||||
```bash
|
||||
cd /obclient/libmariadb/rpm
|
||||
|
@ -93,56 +93,56 @@ OceanBase Database provides the source code of the latest [OBClient](https://git
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> OBClient depends on `libobclient`. Therefore, you must install `libobclient` first.
|
||||
> OBClient depends on `libobclient`. Therefore, you must install `libobclient` first.
|
||||
|
||||
## Examples
|
||||
|
||||
The basic methods for an application to interact with an OBServer by using OceanBase Connector/C include:
|
||||
|
||||
1. Call `mysql_library_init()` to initialize the MySQL library.
|
||||
1. Call `mysql_library_init()` to initialize the MySQL library.
|
||||
|
||||
```c
|
||||
mysql_library_init(0, NULL, NULL);
|
||||
```
|
||||
|
||||
2. Call `mysql_init()` to initialize a connection handle.
|
||||
2. Call `mysql_init()` to initialize a connection handle.
|
||||
|
||||
```c
|
||||
MYSQL *mysql = mysql_init(NULL);
|
||||
```
|
||||
|
||||
3. Call `mysql_real_connect()` to connect to the OBServer.
|
||||
3. Call `mysql_real_connect()` to connect to the OBServer.
|
||||
|
||||
```c
|
||||
mysql_real_connect (mysql, host_name, user_name, password,
|
||||
db_name, port_num, socket_name, CLIENT_MULTI_STATEMENTS)
|
||||
```
|
||||
|
||||
4. Call `mysql_real_query()` or `mysql_query()` to send an SQL statement to the OBServer.
|
||||
4. Call `mysql_real_query()` or `mysql_query()` to send an SQL statement to the OBServer.
|
||||
|
||||
```c
|
||||
mysql_query(mysql,"sql_statement");
|
||||
```
|
||||
|
||||
5. Call `mysql_store_result()` or `mysql_use_result()` to process the result.
|
||||
5. Call `mysql_store_result()` or `mysql_use_result()` to process the result.
|
||||
|
||||
```c
|
||||
result=mysql_store_result(mysql);
|
||||
```
|
||||
|
||||
6. Call `mysql_free_result()` to release the memory.
|
||||
6. Call `mysql_free_result()` to release the memory.
|
||||
|
||||
```c
|
||||
mysql_free_result(result);
|
||||
```
|
||||
|
||||
7. Call `mysql_close()` to disconnect from the OBServer.
|
||||
7. Call `mysql_close()` to disconnect from the OBServer.
|
||||
|
||||
```c
|
||||
mysql_close(mysql);
|
||||
```
|
||||
|
||||
8. Call `mysql_library_end()` to stop using `libobclient`.
|
||||
8. Call `mysql_library_end()` to stop using `libobclient`.
|
||||
|
||||
```c
|
||||
mysql_library_end();
|
||||
|
@ -163,7 +163,7 @@ int main(int argc, char** argv)
|
|||
MYSQL *mysql = mysql_init(NULL);
|
||||
char* host_name = "172.xx.xx.xx";//set your mysql host
|
||||
char* user_name = "r***"; //set your user_name
|
||||
char* password = "******"; //set your password
|
||||
char* password = "***1**"; //set your password
|
||||
char* db_name = "test"; //set your databasename
|
||||
int port_num = 2883; //set your mysql port
|
||||
char* socket_name = NULL;
|
||||
|
@ -227,15 +227,15 @@ int main(int argc, char** argv)
|
|||
|
||||
Parameters
|
||||
|
||||
* **hostname**: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
* **hostname**: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
|
||||
* **username**: the connection account of the tenant. By default, the username of the tenant administrator is `root`.
|
||||
* **username**: the connection account of the tenant. By default, the username of the tenant administrator is `root`.
|
||||
|
||||
* **password**: the password of the connection account.
|
||||
* **password**: the password of the connection account.
|
||||
|
||||
* **dbname**: the name of the database to be connected.
|
||||
* **dbname**: the name of the database to be connected.
|
||||
|
||||
* **port**: the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
* **port**: the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
|
||||
After you edit the code, run the following command to compile and execute the file:
|
||||
|
||||
|
@ -250,4 +250,4 @@ export LD_LIBRARY_PATH=/u01/obclient/lib
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> By default, OBClient is installed in the `/u01/obclient` directory.
|
||||
> By default, OBClient is installed in the `/u01/obclient` directory.
|
|
@ -1,8 +1,8 @@
|
|||
# Run the TPC-C benchmark test on OceanBase Database
|
||||
|
||||
The TPC-C benchmark test is one of the performance test standards defined by the Transaction Processing Performance Council (TPC). Since its release, the TPC-C benchmark test has become an important reference for performance tests in the database industry. Major database vendors around the world submit their test results to the TPC from time to time, expecting to rank higher in the TPC-C benchmark test. OceanBase Database set new world records in the TPC-C benchmark test twice in 2019 and 2020 as the first distributed relational database in the list.
|
||||
The TPC-C benchmark test is one of the performance test standards defined by the Transaction Processing Performance Council (TPC). Since its release, the TPC-C benchmark test has become an important reference for performance tests in the database industry. Major database vendors around the world submit their test results to the TPC from time to time, expecting to rank higher in the TPC-C benchmark test. OceanBase Database set new world records in the TPC-C benchmark test twice in 2019 and 2020 as the first distributed relational database in the list.
|
||||
|
||||
This topic describes how to run the TPC-C benchmark test on OceanBase Database to experience its online transaction processing (OLTP) capability.
|
||||
This topic describes how to run the TPC-C benchmark test on OceanBase Database to experience its online transaction processing (OLTP) capability.
|
||||
|
||||
## About the TPC-C benchmark test
|
||||
|
||||
|
@ -14,28 +14,28 @@ The TPC-C benchmark test specifies the initial state of the database under test,
|
|||
- The DISTRICT table must contain W × 10 records, indicating that each warehouse serves 10 districts.
|
||||
- The CUSTOMER table must contain W × 10 × 3,000 records, indicating that 3,000 customers are distributed in each district.
|
||||
- The HISTORY table must contain W × 10 × 3,000 records, with one transaction history record for each customer.
|
||||
- The ORDER table must contain W × 10 × 3,000 records, indicating that 3,000 orders are generated in each district. The last 900 orders generated will be added to the NEW-ORDER table, and 5 to 15 order lines will be randomly generated for each order.
|
||||
- The ORDER table must contain W × 10 × 3,000 records, indicating that 3,000 orders are generated in each district. The last 900 orders generated will be added to the NEW-ORDER table, and 5 to 15 order lines will be randomly generated for each order.
|
||||
|
||||
During the test, a terminal is deployed in each district to simulate user services. Each terminal cyclically performs all types of transactions within its service life. After a terminal completes the cycle of one transaction, it enters the cycle of the next transaction.
|
||||
After a customer places an order, an order containing several order lines is generated and added to the NEW-ORDER table.
|
||||
A transaction history record is generated after a customer pays for an order. Each order contains 10 order lines on average, and 1% of the order lines are obtained from remote warehouses. These are the nine data tables in the TPC-C model.
|
||||
A transaction history record is generated after a customer pays for an order. Each order contains 10 order lines on average, and 1% of the order lines are obtained from remote warehouses. These are the nine data tables in the TPC-C model.
|
||||
|
||||
### Transaction types
|
||||
|
||||
The TPC-C benchmark test involves the following five types of transactions:
|
||||
|
||||
- New-Order transaction: A New-Order transaction randomly selects 5 to 15 commodities from a warehouse to create an order. A fixed 1% of the transactions are chosen to simulate errors and rolled back. Generally, this type of transactions cannot exceed 45% of all types of transactions.
|
||||
- Payment transaction: A Payment transaction updates the balance of a customer to reflect the payment of the customer. This type of transactions accounts for 43% of all types of transactions.
|
||||
- Order-Status transaction: An Order-Status transaction randomly selects a customer to query the latest order of the customer and displays the status of each commodity in the order. This type of transactions accounts for 4% of all types of transactions.
|
||||
- Delivery transaction: A Delivery transaction batch-processes orders, updates the balances of the customers who placed the orders, and deletes the orders from the New-Order table. This type of transactions accounts for 4% of all types of transactions.
|
||||
- Stock-Level transaction: A Stock-Level transaction analyzes the stock level status of commodities. This type of transactions accounts for 4% of all types of transactions.
|
||||
- New-Order transaction: A New-Order transaction randomly selects 5 to 15 commodities from a warehouse to create an order. A fixed 1% of the transactions are chosen to simulate errors and rolled back. Generally, this type of transactions cannot exceed 45% of all types of transactions.
|
||||
- Payment transaction: A Payment transaction updates the balance of a customer to reflect the payment of the customer. This type of transactions accounts for 43% of all types of transactions.
|
||||
- Order-Status transaction: An Order-Status transaction randomly selects a customer to query the latest order of the customer and displays the status of each commodity in the order. This type of transactions accounts for 4% of all types of transactions.
|
||||
- Delivery transaction: A Delivery transaction batch-processes orders, updates the balances of the customers who placed the orders, and deletes the orders from the New-Order table. This type of transactions accounts for 4% of all types of transactions.
|
||||
- Stock-Level transaction: A Stock-Level transaction analyzes the stock level status of commodities. This type of transactions accounts for 4% of all types of transactions.
|
||||
|
||||
## Environment preparations
|
||||
|
||||
### OceanBase cluster
|
||||
|
||||
You can observe the performance of OceanBase Database in different ways based on the type of your OceanBase cluster. If you have created a single-node OceanBase cluster, you can observe the performance of OceanBase Database in standalone deployment mode. For more information about how to create an OceanBase cluster, see Quick Start. To experience the scalable OLTP capability of the distributed architecture of OceanBase Database, we recommend that you create an OceanBase cluster with at least three nodes. For more information, see [Installation and deployment](../../../400.installation-and-deployment/100.deployment-overview.md).
|
||||
In this example, the tenant name is `test`. You can create your own tenant. For more information, see [Experience the multitenancy feature](../400.Experience-the-multi-tenancy-feature.md).
|
||||
You can observe the performance of OceanBase Database in different ways based on the type of your OceanBase cluster. If you have created a single-node OceanBase cluster, you can observe the performance of OceanBase Database in standalone deployment mode. For more information about how to create an OceanBase cluster, see Quick Start. To experience the scalable OLTP capability of the distributed architecture of OceanBase Database, we recommend that you create an OceanBase cluster with at least three nodes. For more information, see [Installation and deployment](../../../4.installation-and-deployment/1.deployment-overview.md).
|
||||
In this example, the tenant name is `test`. You can create your own tenant. For more information, see [Experience the multitenancy feature](../4.Experience-the-multi-tenancy-feature.md).
|
||||
|
||||
### Install BenchmarkSQL
|
||||
|
||||
|
@ -45,7 +45,7 @@ To shorten the time for preparing the test environment, the OceanBase team modif
|
|||
|
||||
> **Notice**
|
||||
>
|
||||
> A Java runtime environment not earlier than V1.8.0 is required.
|
||||
> A Java runtime environment not earlier than V1.8.0 is required.
|
||||
|
||||
### Modify the configuration file
|
||||
|
||||
|
@ -56,7 +56,7 @@ db=oracle
|
|||
driver=com.mysql.cj.jdbc.Driver
|
||||
conn=jdbc:oceanbase://127.0.0.1:2881/tpccdb?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&allowMultiQueries=true
|
||||
user=root@test
|
||||
password=******
|
||||
password=root
|
||||
|
||||
warehouses=10
|
||||
loadWorkers=2
|
||||
|
@ -96,14 +96,14 @@ osCollectorInterval=1
|
|||
> **Note**
|
||||
>
|
||||
> - `db`: the database type. Retain the setting in the template.
|
||||
> - `driver`: the driver file. Retain the setting in the template.
|
||||
> - `conn`: the connection information. We recommend that you specify the IP address of the OBServer and enable Port 2883 of the OBProxy for access. Retain other settings in the template.
|
||||
> - `user` and `password`: the username, tenant name, and password specified in your environment. If multiple OceanBase clusters are created in your environment, we recommend that you set the user parameter in the {user_name}@{tenant_name}#{cluster_name} format.
|
||||
> - `warehouses`: the number of warehouses. This parameter determines the results of the performance test. If you want to test a multi-node OceanBase cluster, we recommend that you specify at least 1,000 warehouses. If the servers have limited configurations, you can specify 100 warehouses.
|
||||
> - `loadWorkers`: the number of concurrent worker threads for loading the warehouse data. If the servers have high configurations, you can set this parameter to a large value, for example, 100. If the servers have limited configurations, you can set this parameter to a small value, for example, 10. High concurrency increases memory consumption, which leads to errors or even failures in data loading.
|
||||
> - `terminals`: the number of concurrent users for stress testing. We recommend that you set this parameter to a value that is not greater than 10 times the number of warehouses. Otherwise, unnecessary lock waits occur. In a production environment, we recommend that you set this parameter to at most 1000. In a test environment, we recommend that you first set this parameter to 100.
|
||||
> - `runMins`: the duration of the performance test in minutes. Longer duration poses higher challenges to the performance and stability of the database. We recommend that you set this parameter to at least 10 in a test environment and at least 60 in a production environment.
|
||||
> - `LoadStartW` and `LoadStopW`: the thresholds for starting and stopping the warehouse reloading. If the data import to a warehouse fails due to, for example, a large transaction timeout, you can re-import data to the warehouse.
|
||||
> - `driver`: the driver file. Retain the setting in the template.
|
||||
> - `conn`: the connection information. We recommend that you specify the IP address of the OBServer and enable Port 2883 of the OBProxy for access. Retain other settings in the template.
|
||||
> - `user` and `password`: the username, tenant name, and password specified in your environment. If multiple OceanBase clusters are created in your environment, we recommend that you set the user parameter in the {user_name}@{tenant_name}#{cluster_name} format.
|
||||
> - `warehouses`: the number of warehouses. This parameter determines the results of the performance test. If you want to test a multi-node OceanBase cluster, we recommend that you specify at least 1,000 warehouses. If the servers have limited configurations, you can specify 100 warehouses.
|
||||
> - `loadWorkers`: the number of concurrent worker threads for loading the warehouse data. If the servers have high configurations, you can set this parameter to a large value, for example, 100. If the servers have limited configurations, you can set this parameter to a small value, for example, 10. High concurrency increases memory consumption, which leads to errors or even failures in data loading.
|
||||
> - `terminals`: the number of concurrent users for stress testing. We recommend that you set this parameter to a value that is not greater than 10 times the number of warehouses. Otherwise, unnecessary lock waits occur. In a production environment, we recommend that you set this parameter to at most 1000. In a test environment, we recommend that you first set this parameter to 100.
|
||||
> - `runMins`: the duration of the performance test in minutes. Longer duration poses higher challenges to the performance and stability of the database. We recommend that you set this parameter to at least 10 in a test environment and at least 60 in a production environment.
|
||||
> - `LoadStartW` and `LoadStopW`: the thresholds for starting and stopping the warehouse reloading. If the data import to a warehouse fails due to, for example, a large transaction timeout, you can re-import data to the warehouse.
|
||||
|
||||
## Data preparations
|
||||
|
||||
|
@ -118,7 +118,7 @@ create database tpccdb;
|
|||
### Create tables
|
||||
|
||||
The table creation script is usually stored in the `run/sql.common` directory of BenchmarkSQL or a specified directory. You can use the following table creation script to create partitioned tables. Most tables are hash-partitioned by warehouse ID. The number of partitions depends on the amount of data and the number of servers under test.
|
||||
If your cluster contains only one or three servers, you can set the number of partitions to 9. If 5,000 or more warehouses or a large number of servers in the cluster are under test, you can set the number of partitions to 99.
|
||||
If your cluster contains only one or three servers, you can set the number of partitions to 9. If 5,000 or more warehouses or a large number of servers in the cluster are under test, you can set the number of partitions to 99.
|
||||
|
||||
```sql
|
||||
[root@obce-0000 run]# cat sql.common/tableCreates_parts.sql
|
||||
|
@ -260,7 +260,7 @@ PRIMARY KEY (s_w_id, s_i_id)
|
|||
)tablegroup='tpcc_group' use_bloom_filter=true partition by hash(s_w_id) partitions 9;
|
||||
```
|
||||
|
||||
Run the following command to create the tables:
|
||||
Run the following command to create the tables:
|
||||
|
||||
```test
|
||||
./runSQL.sh props.ob sql.common/tableCreates_parts.sql
|
||||
|
@ -268,17 +268,17 @@ Run the following command to create the tables:
|
|||
|
||||
### Load data
|
||||
|
||||
Data is initialized during loading. More warehouses lead to a longer loading time. Data loading for 1,000 warehouses takes about 1 hour, and that for 5,000 warehouses takes more than half a day. The specific performance depends on server configurations.
|
||||
Data is initialized during loading. More warehouses lead to a longer loading time. Data loading for 1,000 warehouses takes about 1 hour, and that for 5,000 warehouses takes more than half a day. The specific performance depends on server configurations.
|
||||
|
||||
```test
|
||||
./runLoader.sh props.ob
|
||||
```
|
||||
|
||||
The INSERT SQL statement for loading data uses the batch insert feature, which is specified in the JDBC URL field in the `props.ob` file. The write performance is significantly improved with this feature enabled.
|
||||
The INSERT SQL statement for loading data uses the batch insert feature, which is specified in the JDBC URL field in the `props.ob` file. The write performance is significantly improved with this feature enabled.
|
||||
|
||||
### Create an index
|
||||
|
||||
After the data is initialized, log on to the test tenant and execute the following statement to create two indexes in the tpccdb database.
|
||||
After the data is initialized, log on to the test tenant and execute the following statement to create two indexes in the tpccdb database.
|
||||
|
||||
```sql
|
||||
[root@obce-0000 run]# cat sql.common/indexCreates.sql
|
||||
|
@ -290,7 +290,7 @@ create index bmsql_oorder_idx1
|
|||
|
||||
## Start the test
|
||||
|
||||
Before you start the performance test, we recommend that you log on to the sys tenant as the administrator and perform a major compaction, to achieve better test results. You can execute the following SQL statement to trigger a major compaction.
|
||||
Before you start the performance test, we recommend that you log on to the sys tenant as the administrator and perform a major compaction, to achieve better test results. You can execute the following SQL statement to trigger a major compaction.
|
||||
|
||||
```sql
|
||||
obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -A -p -c
|
||||
|
@ -316,16 +316,16 @@ After the major compaction is completed, run the following command to start the
|
|||
./runBenchmark.sh props.ob
|
||||
```
|
||||
|
||||
In the TPC-C benchmark test, the tpmC value (transactions per minute) measures the maximum effective throughput of the system. In fact, New-Order transactions are counted. Therefore, the tpmC value is the number of orders processed per minute.
|
||||
In the TPC-C benchmark test, the tpmC value (transactions per minute) measures the maximum effective throughput of the system. In fact, New-Order transactions are counted. Therefore, the tpmC value is the number of orders processed per minute.
|
||||
|
||||
## Experience the OLTP capabilities of an OceanBase cluster in scalable mode
|
||||
|
||||
Regardless of whether you use a single-node or multi-node cluster in the preceding test, only one replica participates in the transaction processing, which is the leader of the tenant. This is because, by default, the leader of the tenant is distributed to zones by priority.
|
||||
As a distributed database, OceanBase Database allows you to shuffle leader partitions of a tenant to multiple zones, to enable linear scaling of computing and processing capabilities across servers.
|
||||
If your cluster consists of three or more nodes, you can run the following command as the administrator and perform the test again to experience the processing capabilities of the distributed cluster in scalable mode.
|
||||
If your cluster consists of three or more nodes, you can run the following command as the administrator and perform the test again to experience the processing capabilities of the distributed cluster in scalable mode.
|
||||
|
||||
```sql
|
||||
alter tenant test set primary_zone='RANDOM';
|
||||
```
|
||||
|
||||
After the leader partitions are shuffled, the test results gain an approximately linear improvement.
|
||||
After the leader partitions are shuffled, the test results gain an approximately linear improvement.
|
27
en-US/200.quick-start/400.Experience-OceanBase-Advanced-Features/100.Experience-Scalable-OLTP/200.Experience-OceanBase-hot-row-update-capability.md → en-US/2.quick-start/4.Experience-OceanBase-Advanced-Features/1.Experience-Scalable-OLTP/2.Experience-OceanBase-hot-row-update-capability.md
Normal file → Executable file
27
en-US/200.quick-start/400.Experience-OceanBase-Advanced-Features/100.Experience-Scalable-OLTP/200.Experience-OceanBase-hot-row-update-capability.md → en-US/2.quick-start/4.Experience-OceanBase-Advanced-Features/1.Experience-Scalable-OLTP/2.Experience-OceanBase-hot-row-update-capability.md
Normal file → Executable file
|
@ -3,11 +3,11 @@
|
|||
With the development of online transactions and the e-commerce industry, hotspot concurrency poses increasing challenges to business systems. For example, the balances of hot accounts are frequently updated within a short time, or sellers launch flash sell events for popular products during massive online promotions. The hot row update is essentially a process in which some fields, such as the balance and inventory, of the same data row in the database are modified with high concurrency within a short time. However, to maintain transaction consistency in a relational database, the update of a data row must go through the process of locking, update, write log commit, and lock release, which is a serial process. Therefore, the hot row update capability is a performance bottleneck of a database.
|
||||
The key to improving the hot row update capability lies in reducing the lock time of a transaction. Although the early lock release (ELR) technique has long been proposed in the academic world, it lacks mature industrial implementations due to its complex exception handling scenarios. In view of this, OceanBase has carried out continuous exploration and proposed an implementation of ELR based on a distributed architecture to improve the database capability of concurrent single-row updates in similar business scenarios. This implementation, the ELR feature of OceanBase Database, has become a key capability of OceanBase Database in scalable online transaction processing (OLTP).
|
||||
This topic describes how to use the ELR feature of OceanBase Database in the case of concurrent single-row updates and analyzes the results. The ELR feature must be verified in scenarios with high concurrency stress. Therefore, we recommend that you use at least the same server configurations as those in the following example to achieve better results. The design and principle of the ELR feature are complex and not discussed in detail in this topic.
|
||||
In the following example, OceanBase Database is deployed on a server with 16 CPU cores and 128 GB of memory by using OceanBase Deployer (OBD). For more information about the deployment procedure, see Quick Start. To use the ELR feature of OceanBase Database, perform the following steps:
|
||||
In the following example, OceanBase Database is deployed on a server with 16 CPU cores and 128 GB of memory by using OceanBase Deployer (OBD). For more information about the deployment procedure, see Quick Start. To use the ELR feature of OceanBase Database, perform the following steps:
|
||||
|
||||
## 1. Create a test table and insert the test data
|
||||
|
||||
Execute the following statement to create a table in the test database and insert the test data.
|
||||
Execute the following statement to create a table in the test database and insert the test data.
|
||||
|
||||
```sql
|
||||
CREATE TABLE `sbtest1` (
|
||||
|
@ -21,11 +21,11 @@ CREATE TABLE `sbtest1` (
|
|||
insert into sbtest1 values(1,0,'aa','aa');
|
||||
```
|
||||
|
||||
In this example, a statement similar to `update sbtest1 set k=k+1 where id=1` is used to initiate a query that uses the primary key to concurrently update Column k. You can also insert more data for testing, which does not make much difference in the result because this stress test is specific to a single row.
|
||||
In this example, a statement similar to `update sbtest1 set k=k+1 where id=1` is used to initiate a query that uses the primary key to concurrently update Column k. You can also insert more data for testing, which does not make much difference in the result because this stress test is specific to a single row.
|
||||
|
||||
## 2. Construct a concurrent update scenario
|
||||
|
||||
In this example, concurrent updates are simulated by using multithreading in Python. 50 threads are simultaneously started. These threads run concurrently and each of them increments the value of Column k in the same row (id=1) by 1. You can also use the following `ob_elr.py` script for testing in your own environment. Remember to modify the database connection information in the script before you use it.
|
||||
In this example, concurrent updates are simulated by using multithreading in Python. 50 threads are simultaneously started. These threads run concurrently and each of them increments the value of Column k in the same row (id=1) by 1. You can also use the following `ob_elr.py` script for testing in your own environment. Remember to modify the database connection information in the script before you use it.
|
||||
|
||||
```python
|
||||
#!/usr/bin/env python3
|
||||
|
@ -38,8 +38,8 @@ import threading
|
|||
# database connection info
|
||||
config = {
|
||||
'user': 'root@test',
|
||||
'password': '******',
|
||||
'host': 'xxx.xxx.xxx.xxx',
|
||||
'password': 'root',
|
||||
'host': '172.19.81.183',
|
||||
'port': 2881,
|
||||
'database': 'test'
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ print('TPS on Hot Row:' ,round(parallel*batch_num/elapse_time,2),'/s')
|
|||
## 3. Run the test with default configurations
|
||||
|
||||
Run the `ob_elr.py` script on the test server without enabling the ELR feature.
|
||||
In this example, 50 threads run concurrently to perform a total of 100,000 updates.
|
||||
In this example, 50 threads run concurrently to perform a total of 100,000 updates.
|
||||
|
||||
```shell
|
||||
./ob_elr.py
|
||||
|
@ -114,7 +114,7 @@ alter system set enable_early_lock_release=true tenant= test;
|
|||
|
||||
## 5. Run the test with the ELR feature enabled
|
||||
|
||||
After the ELR feature is enabled, run the test script again. Before you run the script, query the record with an ID of 1 in the sbtest table. The value of Column k is 100000. This is because 100,000 updates were performed with the default configurations.
|
||||
After the ELR feature is enabled, run the test script again. Before you run the script, query the record with an ID of 1 in the sbtest table. The value of Column k is 100000. This is because 100,000 updates were performed with the default configurations.
|
||||
|
||||
```sql
|
||||
select * from sbtest1 where id=1;
|
||||
|
@ -126,7 +126,7 @@ select * from sbtest1 where id=1;
|
|||
1 row in set (0.00 sec)
|
||||
```
|
||||
|
||||
Then, run the `ob_elr.py script` on the test server again. Run 50 threads concurrently to perform a total of 100,000 updates.
|
||||
Then, run the `ob_elr.py script` on the test server again. Run 50 threads concurrently to perform a total of 100,000 updates.
|
||||
|
||||
```shell
|
||||
./ob_elr.py
|
||||
|
@ -145,7 +145,7 @@ TPS on Hot Row: 8223.68 /s
|
|||
### Results
|
||||
|
||||
After the ELR feature of OceanBase Database is enabled, the TPS for concurrent single-row updates reaches 8223.68/s, which is about 4.5 times the result achieved with the default configurations.
|
||||
The value of Column k in the sbtest1 table changes to 200,000, which indicates that this test also performed 100,000 updates.
|
||||
The value of Column k in the sbtest1 table changes to 200,000, which indicates that this test also performed 100,000 updates.
|
||||
|
||||
```sql
|
||||
select * from sbtest1 where id=1;
|
||||
|
@ -157,9 +157,8 @@ select * from sbtest1 where id=1;
|
|||
1 row in set (0.00 sec)
|
||||
```
|
||||
|
||||
This example describes only concurrent single-row updates. The ELR feature of OceanBase Database also supports concurrent updates for multi-statement transactions. The ELR feature significantly improves the database performance in concurrent updates regardless of the number of statements and the differences in scenarios.
|
||||
This example describes only concurrent single-row updates. The ELR feature of OceanBase Database also supports concurrent updates for multi-statement transactions. The ELR feature significantly improves the database performance in concurrent updates regardless of the number of statements and the differences in scenarios.
|
||||
|
||||
The ELR feature of OceanBase Database also applies to multi-region deployment scenarios with high network latency. For example, the execution of a single transaction requires 30 ms in the default scenario. If you enable the ELR feature and concurrent execution, the TPS can increase by about 100 times.
|
||||
|
||||
The log protocol of OceanBase Database is based on multi-Paxos, with the optimized two-phase commit (2PC) process. Therefore, after the ELR feature is enabled, transaction consistency can still be ensured in the case of server restart or leader switchover. You can try these tests to experience the ELR feature.
|
||||
The ELR feature of OceanBase Database also applies to multi-region deployment scenarios with high network latency. For example, the execution of a single transaction requires 30 ms in the default scenario. If you enable the ELR feature and concurrent execution, the TPS can increase by about 100 times.
|
||||
|
||||
The log protocol of OceanBase Database is based on multi-Paxos, with the optimized two-phase commit (2PC) process. Therefore, after the ELR feature is enabled, transaction consistency can still be ensured in the case of server restart or leader switchover. You can try these tests to experience the ELR feature.
|
|
@ -1,179 +1,179 @@
|
|||
# Experience the multitenancy feature
|
||||
|
||||
The multitenancy feature of OceanBase Database allows you to create instance resource pools for clusters. Each tenant in OceanBase Database is an instance, which is similar to a MySQL instance. Data, privileges, and resources of a tenant are isolated from those of other tenants. Each tenant has its own access ports and CPU and memory resources.
|
||||
|
||||
## Background
|
||||
|
||||
OceanBase Database allows you to flexibly adjust the CPU and memory resources allocated to a tenant, which is transparent to the upper-layer business system. The multitenancy mechanism allows you to efficiently use OceanBase cluster resources, reduce costs, ensure high availability and performance, and implement on-demand scaling based on your business requirements.
|
||||
|
||||
To help you understand the multitenancy feature of OceanBase Database, this topic describes how to create OceanBase tenants and modify their resource configurations.
|
||||
|
||||
## Create unit configs
|
||||
|
||||
In OceanBase Database, a resource unit is the minimum logical unit for a tenant to use CPU and memory resources. It is also the basic unit for cluster scaling and load balancing. When a cluster node goes online or offline or a cluster is scaled in or out, the distribution of resource units on the nodes is dynamically adjusted to balance the resource usage. A unit config is a configuration file that specifies the specifications of the computing and storage resources (including memory, CPU, and I/O resources) required for a resource unit.
|
||||
|
||||
Based on the distributed architecture of OceanBase Database, an OceanBase Database tenant can be flexibly defined in different dimensions such as resource specifications, resource pool, replica type, and replica distribution. Therefore, if you want to create a tenant, you must create a unit config, a resource pool, and a tenant in sequence.
|
||||
|
||||
You must determine a unit config before you create an OceanBase Database tenant. You can log on to OceanBase Database as the administrator of the sys tenant and execute the following SQL statement to create unit configs.
|
||||
|
||||
In this example, unit1 and unit2 are created, and their CPU and memory resources, IOPS, and maximum and minimum thresholds of disk usage are specified.
|
||||
|
||||
* unit1 is configured with 3 CPU cores and 6 GB of memory. The IOPS and disk size of unit1 are 128 and 10 GB, respectively.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE RESOURCE UNIT unit1 MAX_CPU 3, MAX_MEMORY '6G', MAX_IOPS 128,MAX_DISK_SIZE '10G', MAX_SESSION_NUM 64, MIN_CPU=3, MIN_MEMORY='6G', MIN_IOPS=128;
|
||||
```
|
||||
|
||||
* unit2 is configured with 4 CPU cores and 8 GB of memory. The IOPS and disk size of unit2 are 128 and 20 GB, respectively.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE RESOURCE UNIT unit2 MAX_CPU 4, MAX_MEMORY '8G', MAX_IOPS 128,MAX_DISK_SIZE '20G', MAX_SESSION_NUM 64, MIN_CPU=4, MIN_MEMORY='8G', MIN_IOPS=128;
|
||||
```
|
||||
|
||||
## Create resource pools and associate them with the unit configs
|
||||
|
||||
A unit config is a set of configuration specifications for a tenant, whereas a resource pool is a set of entity resources for a tenant. Therefore, in this step, you must create resource pools and associate them with the unit configs.
|
||||
|
||||
In this example, pool1 and pool2 are created and associated with unit1 and unit2 respectively. As a result, the resource units are mapped to the resource pools. UNIT_NUM indicates the number of units specified in one zone. In the same tenant, you can allocate at most one unit to each node. ZONE_LIST specifies the zones where the tenant is deployed in the current cluster.
|
||||
|
||||
In this example, the OceanBase cluster contains only one node. Therefore, only one unit and one zone list are specified. Before you create a resource pool, make sure that the available resources are sufficient. If the resources are insufficient, you can delete the existing test tenants or decrease the unit configs of the existing tenants. For more information, see [Modify tenant configurations and adjust instance resource specifications](#Modify%20tenant%20configurations%20and%20adjust%20instance%20resource%20specifications).
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE RESOURCE POOL pool1 UNIT='unit1',UNIT_NUM=1,ZONE_LIST=('zone1');
|
||||
obclient [oceanbase]> CREATE RESOURCE POOL pool2 UNIT='unit2',UNIT_NUM=1,ZONE_LIST=('zone1');
|
||||
```
|
||||
|
||||
> **Notice**
|
||||
>
|
||||
> A single-node cluster is used as an example in the preceding sample code. If your cluster has three nodes, you need to set the value of the `ZONE_LIST` parameter in the format of `('zone1','zone2','zone3')`. Replace 'zone1', 'zone2', and 'zone3' with the actual zone names.
|
||||
|
||||
## Create tenants based on the created resource pools
|
||||
|
||||
After the unit configs and resource pools are created and associated, you can create a tenant.
|
||||
|
||||
In this example, the OceanBase cluster contains only one node. Therefore, you can create only a single-replica tenant. If you want to create a three-replica tenant, the OceanBase cluster must contain at least three nodes.
|
||||
|
||||
Define a single-replica tenant named `tenant1`, set the character set to `utf8mb4`, and set the resource pool to `pool1`. `ob_tcp_invited_nodes` specifies the whitelist for the tenant. You can set the initial value to `%` to allow access from all IP addresses. You can change the value as required later on.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE TENANT IF NOT EXISTS tenant1 CHARSET='utf8mb4', ZONE_LIST=('zone1'), PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('pool1') SET ob_tcp_invited_nodes='%';
|
||||
```
|
||||
|
||||
> **Notice**
|
||||
>
|
||||
> A single-node cluster is used as an example in the preceding sample code. In this case, you can create only a single-replica tenant. If your cluster has three nodes, you need to set the value of the `ZONE_LIST` parameter in the format of ('zone1','zone2','zone3') and the `PRIMARY_ZONE` parameter to `'zone1;zone2;zone3'`, which indicates that the leader of the tenant is preferentially distributed to zone1 and then zone2.
|
||||
|
||||
Likewise, define a single-replica tenant named `tenant2`, set the character set to `utf8mb4`, and set the resource pool to `pool2`.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE TENANT IF NOT EXISTS tenant2 CHARSET='utf8mb4', ZONE_LIST=('zone1'), PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('pool2') SET ob_tcp_invited_nodes='%';
|
||||
```
|
||||
|
||||
After you create tenant1 and tenant2, you can query the oceanbase.DBA_OB_TENANTS view to verify whether the tenants exist in the cluster.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS;
|
||||
```
|
||||
|
||||
After you create tenant1 and tenant2, you can query the oceanbase.DBA_OB_TENANTS view to verify whether the tenants exist in the cluster.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS;
|
||||
```
|
||||
|
||||
If the preceding statement succeeds, you have created two tenants in the same cluster. Then, you can perform database operations in the tenants.
|
||||
|
||||
Log on to tenant1 and create a test table.
|
||||
|
||||
```sql
|
||||
obclient -hXXX.XX.XXX.106 -P2883 -uroot@tenant1#ob_test -p******
|
||||
obclient [(none)]> show databases;
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| oceanbase |
|
||||
| information_schema |
|
||||
| mysql |
|
||||
| test |
|
||||
+--------------------+
|
||||
4 rows in set
|
||||
|
||||
obclient [(none)]> use test;
|
||||
Database changed
|
||||
obclient [test]> create table t_f1(id decimal(10,0),id2 decimal(10,0),id3 date,id4 date,id5 float,id6 float,id7 varchar(30),id8 varchar(300));
|
||||
Query OK, 0 rows affected
|
||||
|
||||
obclient [test]> show tables;
|
||||
+----------------+
|
||||
| Tables_in_test |
|
||||
+----------------+
|
||||
| t_f1 |
|
||||
+----------------+
|
||||
1 row in set
|
||||
```
|
||||
|
||||
Log on to tenant2 and query the test database.
|
||||
|
||||
```sql
|
||||
obclient -hXXX.XX.XXX.106 -P2883 -uroot@tenant2#ob_test -p******
|
||||
|
||||
obclient [(none)]> show databases;
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| oceanbase |
|
||||
| information_schema |
|
||||
| mysql |
|
||||
| test |
|
||||
+--------------------+
|
||||
4 rows in set
|
||||
|
||||
obclient [(none)]> use test;
|
||||
Database changed
|
||||
obclient [test]> show tables;
|
||||
Empty set
|
||||
```
|
||||
|
||||
The query results show that the resources, data, and permissions of the two tenants in the cluster are isolated. You can perform more tests to verify the tenant isolation feature of OceanBase Database.
|
||||
|
||||
## Modify tenant configurations and adjust instance resource specifications
|
||||
|
||||
OceanBase Database allows you to flexibly adjust the CPU and memory resources of tenants in real time, which is transparent to the business system. To modify the CPU and memory resources of a tenant, you only need to adjust the unit config used by the tenant, without modifying the resource pool or tenant.
|
||||
|
||||
You can check the unit config used by a tenant by querying the \__all_unit_config system table.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM oceanbase.__all_unit_config;
|
||||
+----------------------------+----------------------------+----------------+--------------------------------------+---------+---------+--------------+--------------+----------+----------+---------------+---------------------+
|
||||
| gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | max_memory | min_memory | max_iops | min_iops | max_disk_size | max_session_num |
|
||||
+----------------------------+----------------------------+----------------+--------------------------------------+---------+---------+--------------+--------------+----------+----------+---------------+---------------------+
|
||||
| 2022-07-05 17:32:17.519436 | 2022-07-05 17:32:17.519436 | 1 | sys_unit_config | 5 | 2.5 | 17179869184 | 12884901888 | 10000 | 5000 | 2608854990848 | 9223372036854775807 |
|
||||
| 2022-07-10 12:58:33.279509 | 2022-07-10 12:58:33.279509 | 1026 | unit1 | 3 | 3 | 6442450944 | 6442450944 | 128 | 128 | 10737418240 | 64 |
|
||||
| 2022-07-10 12:58:39.276495 | 2022-07-10 12:58:39.276495 | 1027 | unit2 | 4 | 4 | 8589934592 | 8589934592 | 128 | 128 | 21474836480 | 64 |
|
||||
+----------------------------+----------------------------+----------------+--------------------------------------+---------+---------+--------------+--------------+----------+----------+---------------+---------------------+
|
||||
```
|
||||
|
||||
As shown in the preceding example, unit1 is configured with 3 CPU cores and 6 GB of memory.
|
||||
|
||||
You can adjust the CPU and memory resources of unit1 to 5 CPU cores and 10 GB of memory.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> ALTER resource unit unit1 max_cpu =5,min_cpu =5 ,memory_size ='10G';
|
||||
Query OK, 0 rows affected
|
||||
|
||||
obclient [oceanbase]> SELECT * FROM oceanbase.__all_unit_config;
|
||||
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
|
||||
| gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | memory_size | log_disk_size | max_iops | min_iops | iops_weight |
|
||||
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
|
||||
| 2022-09-29 17:07:14.647714 | 2022-09-29 17:07:14.647714 | 1 | sys_unit_config | 2.5 | 2.5 | 8589934592 | 8589934592 | 25000 | 25000 | 2 |
|
||||
| 2022-09-29 18:27:21.231880 | 2022-09-30 10:53:49.522260 | 1004 | unit1 | 5 | 5 | 10737418240 | 51539607552 | 80000 | 80000 | 8 |
|
||||
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
|
||||
```
|
||||
|
||||
As shown in the preceding example, the adjustment of the tenant configurations takes effect immediately. After the adjustment, the CPU and memory resources of unit1 are 5 CPU cores and 10 GB of memory. Based on kernel virtualization, OceanBase Database allows the modifications on CPU and memory resources of a tenant to take effect immediately without data migration or switchover. Therefore, the modifications are transparent to your business system.
|
||||
|
||||
You can query the DBA_OB_UNITS view to learn of information about resource units, resource pools, tenants in the cluster, and the CPU and memory resource information of the tenants.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM DBA_OB_UNITS;
|
||||
```
|
||||
# Experience the multitenancy feature
|
||||
|
||||
The multitenancy feature of OceanBase Database allows you to create instance resource pools for clusters. Each tenant in OceanBase Database is an instance, which is similar to a MySQL instance. Data, privileges, and resources of a tenant are isolated from those of other tenants. Each tenant has its own access ports and CPU and memory resources.
|
||||
|
||||
## Background
|
||||
|
||||
OceanBase Database allows you to flexibly adjust the CPU and memory resources allocated to a tenant, which is transparent to the upper-layer business system. The multitenancy mechanism allows you to efficiently use OceanBase cluster resources, reduce costs, ensure high availability and performance, and implement on-demand scaling based on your business requirements.
|
||||
|
||||
To help you understand the multitenancy feature of OceanBase Database, this topic describes how to create OceanBase tenants and modify their resource configurations.
|
||||
|
||||
## Create unit configs
|
||||
|
||||
In OceanBase Database, a resource unit is the minimum logical unit for a tenant to use CPU and memory resources. It is also the basic unit for cluster scaling and load balancing. When a cluster node goes online or offline or a cluster is scaled in or out, the distribution of resource units on the nodes is dynamically adjusted to balance the resource usage. A unit config is a configuration file that specifies the specifications of the computing and storage resources (including memory, CPU, and I/O resources) required for a resource unit.
|
||||
|
||||
Based on the distributed architecture of OceanBase Database, an OceanBase Database tenant can be flexibly defined in different dimensions such as resource specifications, resource pool, replica type, and replica distribution. Therefore, if you want to create a tenant, you must create a unit config, a resource pool, and a tenant in sequence.
|
||||
|
||||
You must determine a unit config before you create an OceanBase Database tenant. You can log on to OceanBase Database as the administrator of the sys tenant and execute the following SQL statement to create unit configs.
|
||||
|
||||
In this example, unit1 and unit2 are created, and their CPU and memory resources, IOPS, and maximum and minimum thresholds of disk usage are specified.
|
||||
|
||||
* unit1 is configured with 3 CPU cores and 6 GB of memory. The IOPS and disk size of unit1 are 128 and 10 GB, respectively.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE RESOURCE UNIT unit1 MAX_CPU 3, MAX_MEMORY '6G', MAX_IOPS 128,MAX_DISK_SIZE '10G', MAX_SESSION_NUM 64, MIN_CPU=3, MIN_MEMORY='6G', MIN_IOPS=128;
|
||||
```
|
||||
|
||||
* unit2 is configured with 4 CPU cores and 8 GB of memory. The IOPS and disk size of unit2 are 128 and 20 GB, respectively.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE RESOURCE UNIT unit2 MAX_CPU 4, MAX_MEMORY '8G', MAX_IOPS 128,MAX_DISK_SIZE '20G', MAX_SESSION_NUM 64, MIN_CPU=4, MIN_MEMORY='8G', MIN_IOPS=128;
|
||||
```
|
||||
|
||||
## Create resource pools and associate them with the unit configs
|
||||
|
||||
A unit config is a set of configuration specifications for a tenant, whereas a resource pool is a set of entity resources for a tenant. Therefore, in this step, you must create resource pools and associate them with the unit configs.
|
||||
|
||||
In this example, pool1 and pool2 are created and associated with unit1 and unit2 respectively. As a result, the resource units are mapped to the resource pools. UNIT_NUM indicates the number of units specified in one zone. In the same tenant, you can allocate at most one unit to each node. ZONE_LIST specifies the zones where the tenant is deployed in the current cluster.
|
||||
|
||||
In this example, the OceanBase cluster contains only one node. Therefore, only one unit and one zone list are specified. Before you create a resource pool, make sure that the available resources are sufficient. If the resources are insufficient, you can delete the existing test tenants or decrease the unit configs of the existing tenants. For more information, see [Modify tenant configurations and adjust instance resource specifications](#Modify%20tenant%20configurations%20and%20adjust%20instance%20resource%20specifications).
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE RESOURCE POOL pool1 UNIT='unit1',UNIT_NUM=1,ZONE_LIST=('zone1');
|
||||
obclient [oceanbase]> CREATE RESOURCE POOL pool2 UNIT='unit2',UNIT_NUM=1,ZONE_LIST=('zone1');
|
||||
```
|
||||
|
||||
> **Notice**
|
||||
>
|
||||
> A single-node cluster is used as an example in the preceding sample code. If your cluster has three nodes, you need to set the value of the `ZONE_LIST` parameter in the format of `('zone1','zone2','zone3')`. Replace 'zone1', 'zone2', and 'zone3' with the actual zone names.
|
||||
|
||||
## Create tenants based on the created resource pools
|
||||
|
||||
After the unit configs and resource pools are created and associated, you can create a tenant.
|
||||
|
||||
In this example, the OceanBase cluster contains only one node. Therefore, you can create only a single-replica tenant. If you want to create a three-replica tenant, the OceanBase cluster must contain at least three nodes.
|
||||
|
||||
Define a single-replica tenant named `tenant1`, set the character set to `utf8mb4`, and set the resource pool to `pool1`. `ob_tcp_invited_nodes` specifies the whitelist for the tenant. You can set the initial value to `%` to allow access from all IP addresses. You can change the value as required later on.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE TENANT IF NOT EXISTS tenant1 CHARSET='utf8mb4', ZONE_LIST=('zone1'), PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('pool1') SET ob_tcp_invited_nodes='%';
|
||||
```
|
||||
|
||||
> **Notice**
|
||||
>
|
||||
> A single-node cluster is used as an example in the preceding sample code. In this case, you can create only a single-replica tenant. If your cluster has three nodes, you need to set the value of the `ZONE_LIST` parameter in the format of ('zone1','zone2','zone3') and the `PRIMARY_ZONE` parameter to `'zone1;zone2;zone3'`, which indicates that the leader of the tenant is preferentially distributed to zone1 and then zone2.
|
||||
|
||||
Likewise, define a single-replica tenant named `tenant2`, set the character set to `utf8mb4`, and set the resource pool to `pool2`.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> CREATE TENANT IF NOT EXISTS tenant2 CHARSET='utf8mb4', ZONE_LIST=('zone1'), PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('pool2') SET ob_tcp_invited_nodes='%';
|
||||
```
|
||||
|
||||
After you create tenant1 and tenant2, you can query the oceanbase.DBA_OB_TENANTS view to verify whether the tenants exist in the cluster.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS;
|
||||
```
|
||||
|
||||
After you create tenant1 and tenant2, you can query the oceanbase.DBA_OB_TENANTS view to verify whether the tenants exist in the cluster.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS;
|
||||
```
|
||||
|
||||
If the preceding statement succeeds, you have created two tenants in the same cluster. Then, you can perform database operations in the tenants.
|
||||
|
||||
Log on to tenant1 and create a test table.
|
||||
|
||||
```sql
|
||||
obclient -hXXX.XX.XXX.106 -P2883 -uroot@tenant1#ob_test -p
|
||||
obclient [(none)]> show databases;
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| oceanbase |
|
||||
| information_schema |
|
||||
| mysql |
|
||||
| test |
|
||||
+--------------------+
|
||||
4 rows in set
|
||||
|
||||
obclient [(none)]> use test;
|
||||
Database changed
|
||||
obclient [test]> create table t_f1(id decimal(10,0),id2 decimal(10,0),id3 date,id4 date,id5 float,id6 float,id7 varchar(30),id8 varchar(300));
|
||||
Query OK, 0 rows affected
|
||||
|
||||
obclient [test]> show tables;
|
||||
+----------------+
|
||||
| Tables_in_test |
|
||||
+----------------+
|
||||
| t_f1 |
|
||||
+----------------+
|
||||
1 row in set
|
||||
```
|
||||
|
||||
Log on to tenant2 and query the test database.
|
||||
|
||||
```sql
|
||||
obclient -hXXX.XX.XXX.106 -P2883 -uroot@tenant2#ob_test -p
|
||||
|
||||
obclient [(none)]> show databases;
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| oceanbase |
|
||||
| information_schema |
|
||||
| mysql |
|
||||
| test |
|
||||
+--------------------+
|
||||
4 rows in set
|
||||
|
||||
obclient [(none)]> use test;
|
||||
Database changed
|
||||
obclient [test]> show tables;
|
||||
Empty set
|
||||
```
|
||||
|
||||
The query results show that the resources, data, and permissions of the two tenants in the cluster are isolated. You can perform more tests to verify the tenant isolation feature of OceanBase Database.
|
||||
|
||||
## Modify tenant configurations and adjust instance resource specifications
|
||||
|
||||
OceanBase Database allows you to flexibly adjust the CPU and memory resources of tenants in real time, which is transparent to the business system. To modify the CPU and memory resources of a tenant, you only need to adjust the unit config used by the tenant, without modifying the resource pool or tenant.
|
||||
|
||||
You can check the unit config used by a tenant by querying the \__all_unit_config system table.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM oceanbase.__all_unit_config;
|
||||
+----------------------------+----------------------------+----------------+--------------------------------------+---------+---------+--------------+--------------+----------+----------+---------------+---------------------+
|
||||
| gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | max_memory | min_memory | max_iops | min_iops | max_disk_size | max_session_num |
|
||||
+----------------------------+----------------------------+----------------+--------------------------------------+---------+---------+--------------+--------------+----------+----------+---------------+---------------------+
|
||||
| 2022-07-05 17:32:17.519436 | 2022-07-05 17:32:17.519436 | 1 | sys_unit_config | 5 | 2.5 | 17179869184 | 12884901888 | 10000 | 5000 | 2608854990848 | 9223372036854775807 |
|
||||
| 2022-07-10 12:58:33.279509 | 2022-07-10 12:58:33.279509 | 1026 | unit1 | 3 | 3 | 6442450944 | 6442450944 | 128 | 128 | 10737418240 | 64 |
|
||||
| 2022-07-10 12:58:39.276495 | 2022-07-10 12:58:39.276495 | 1027 | unit2 | 4 | 4 | 8589934592 | 8589934592 | 128 | 128 | 21474836480 | 64 |
|
||||
+----------------------------+----------------------------+----------------+--------------------------------------+---------+---------+--------------+--------------+----------+----------+---------------+---------------------+
|
||||
```
|
||||
|
||||
As shown in the preceding example, unit1 is configured with 3 CPU cores and 6 GB of memory.
|
||||
|
||||
You can adjust the CPU and memory resources of unit1 to 5 CPU cores and 10 GB of memory.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> ALTER resource unit unit1 max_cpu =5,min_cpu =5 ,memory_size ='10G';
|
||||
Query OK, 0 rows affected
|
||||
|
||||
obclient [oceanbase]> SELECT * FROM oceanbase.__all_unit_config;
|
||||
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
|
||||
| gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | memory_size | log_disk_size | max_iops | min_iops | iops_weight |
|
||||
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
|
||||
| 2022-09-29 17:07:14.647714 | 2022-09-29 17:07:14.647714 | 1 | sys_unit_config | 2.5 | 2.5 | 8589934592 | 8589934592 | 25000 | 25000 | 2 |
|
||||
| 2022-09-29 18:27:21.231880 | 2022-09-30 10:53:49.522260 | 1004 | unit1 | 5 | 5 | 10737418240 | 51539607552 | 80000 | 80000 | 8 |
|
||||
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
|
||||
```
|
||||
|
||||
As shown in the preceding example, the adjustment of the tenant configurations takes effect immediately. After the adjustment, the CPU and memory resources of unit1 are 5 CPU cores and 10 GB of memory. Based on kernel virtualization, OceanBase Database allows the modifications on CPU and memory resources of a tenant to take effect immediately without data migration or switchover. Therefore, the modifications are transparent to your business system.
|
||||
|
||||
You can query the DBA_OB_UNITS view to learn of information about resource units, resource pools, tenants in the cluster, and the CPU and memory resource information of the tenants.
|
||||
|
||||
```sql
|
||||
obclient [oceanbase]> SELECT * FROM DBA_OB_UNITS;
|
||||
```
|
|
@ -27,7 +27,7 @@ static {
|
|||
map.put("url", "jdbc:oceanbase://10.100.xxx.xxx:18815/test");
|
||||
map.put("driverClassName", "com.alipay.oceanbase.jdbc.Driver");
|
||||
map.put("username", "admin@mysql");
|
||||
map.put("password", "******");
|
||||
map.put("password", "admin");
|
||||
try {
|
||||
Class.forName(map.get("driverClassName"));
|
||||
jdbcTemplate = new JdbcTemplate(DruidDataSourceFactory.createDataSource(map));
|
|
@ -132,7 +132,7 @@ The following example shows the content of a configuration file:
|
|||
jdbc.driver=com.alipay.oceanbase.jdbc.Driver
|
||||
jdbc.url=jdbc:oceanbase://10.100.xxx.xxx:18815/test
|
||||
jdbc.username=admin
|
||||
jdbc.password=******
|
||||
jdbc.password=admin
|
||||
database.dialect=MYSQL
|
||||
dbcp.maxIdle=5
|
||||
dbcp.maxActive=40
|
||||
|
@ -164,7 +164,7 @@ Configure the data source and JPA part in the configuration file as follows:
|
|||
```java
|
||||
spring.datasource.url=jdbc:oceanbase://10.100.xxx.xxx:18815/test
|
||||
spring.datasource.username=admin@mysql
|
||||
spring.datasource.password=******
|
||||
spring.datasource.password=admin
|
||||
spring.datasource.driver-class-name=com.alipay.oceanbase.jdbc.Driver
|
||||
|
||||
spring.jpa.hibernate.ddl-auto=update
|
|
@ -36,7 +36,7 @@ The following example shows the content of a configuration file:
|
|||
<property name="driver" value="com.alipay.oceanbase.jdbc.Driver"/>
|
||||
<property name="url" value="jdbc:oceanbase://10.100.xxx.xxx:18817/test?useUnicode=true&characterEncoding=utf-8&useServerPrepStmts=false&useCursorFetch=true"/>
|
||||
<property name="username" value="admin@mysql"/>
|
||||
<property name="password" value="******"/>
|
||||
<property name="password" value="admin"/>
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
|
@ -26,7 +26,7 @@ This topic describes how to configure dependencies and configuration files for a
|
|||
```dart
|
||||
jdbcUrl=jdbc:oceanbase://10.100.xxx.xxx:18817/test?useSSL=false&useServerPrepStmts=true&serverTimezone=UTC
|
||||
username=admin@mysql
|
||||
password=******
|
||||
password=admin
|
||||
dataSource.cachePrepStmts=true
|
||||
dataSource.prepStmtCacheSize=250
|
||||
dataSource.prepStmtCacheSqlLimit=2048
|
|
@ -46,7 +46,7 @@ url=jdbc:oceanbase://10.100.xxx.xxx:18817/test?useSSL=false&useServerPrepStmts=t
|
|||
#Username
|
||||
username=admin@mysql
|
||||
#Password
|
||||
password=******
|
||||
password=admin
|
||||
#Number of initial connections
|
||||
initialSize=30
|
||||
#Maximum number of active connections
|
||||
|
@ -145,7 +145,7 @@ public class DBConn {
|
|||
Class.forName("com.alipay.oceanbase.jdbc.Driver");
|
||||
DriverManager.registerDriver(new com.alipay.oceanbase.jdbc.Driver());
|
||||
String dbUrl = "jdbc:oceanbase://10.100.xxx.xxx:18817/test?useSSL=false&useServerPrepStmts=true&serverTimezone=UTC";
|
||||
conn = DriverManager.getConnection(dbUrl, "admin@mysql", "******");
|
||||
conn = DriverManager.getConnection(dbUrl, "admin@mysql", "admin");
|
||||
// System.out.println("========Database connected========");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
|
@ -40,7 +40,7 @@ import javax.persistence.*;
|
|||
@Table(name = "user_test")
|
||||
public class User {
|
||||
|
||||
public User() { }
|
||||
public User() { }
|
||||
|
||||
@Id
|
||||
|
||||
|
@ -139,14 +139,14 @@ Hibernate configuration file:
|
|||
<property name="connection.driver_class">com.alipay.oceanbase.jdbc.Driver</property>
|
||||
<property name="connection.url">jdbc:oceanbase://10.100.xxx.xxx:18815/test</property>
|
||||
<property name="connection.username">admin@mysql</property>
|
||||
<property name="connection.password">******</property>
|
||||
<property name="connection.password">admin</property>
|
||||
|
||||
<!-- Optional configuration -->
|
||||
|
||||
<!-- Specifies whether to support dialects. -->
|
||||
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Specifies whether to print SQL statements when create, read, update, and delete (CRUD) operations are performed. -->
|
||||
<property name="show_sql">true</property>
|
|
@ -1,26 +1,26 @@
|
|||
# Connect to OceanBase Database by using a MySQL client
|
||||
|
||||
You can use a MySQL client to connect to a MySQL tenant of OceanBase Database. This topic describes the methods and procedure of connecting to OceanBase Database by using a MySQL client.
|
||||
You can use a MySQL client to connect to a MySQL tenant of OceanBase Database. This topic describes the methods and procedure of connecting to OceanBase Database by using a MySQL client.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you connect to an OceanBase database by using a MySQL client, make sure that the following conditions are met:
|
||||
|
||||
* A MySQL client is installed on your server. OceanBase Database supports MySQL clients of the following versions: 5.5, 5.6, and 5.7.
|
||||
* A MySQL client is installed on your server. OceanBase Database supports MySQL clients of the following versions: 5.5, 5.6, and 5.7.
|
||||
|
||||
* The environment variable `PATH` contains the directory where the MySQL client is located.
|
||||
* The environment variable `PATH` contains the directory where the MySQL client is located.
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> When you connect to OceanBase Database by using a MySQL 8.0 client, you must specify the following string in the connection command: --default_auth=mysql_native_pasowrd.
|
||||
>
|
||||
> This is because the default encryption algorithm is mysql_native_password for MySQL 5.6 and MySQL 5.7 and caching_sha2_password for MySQL 8.0.
|
||||
> This is because the default encryption algorithm is mysql_native_password for MySQL 5.6 and MySQL 5.7 and caching_sha2_password for MySQL 8.0.
|
||||
|
||||
## Procedure
|
||||
|
||||
1. Open a command line.
|
||||
1. Open a command line.
|
||||
|
||||
2. Connect to OceanBase Database by using MySQL commands.
|
||||
2. Connect to OceanBase Database by using MySQL commands.
|
||||
|
||||
* To connect to the MySQL tenant by using an OBProxy, run the following command:
|
||||
|
||||
|
@ -36,19 +36,19 @@ Before you connect to an OceanBase database by using a MySQL client, make sure t
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> * -h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
> * -h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
>
|
||||
> * -u: specifies the tenant account. Two account formats are supported: `Username@Tenant name#Cluster name` and `Cluster name:Tenant name:Username`. The default username of the tenant administrator is `root`.
|
||||
> * -u: specifies the tenant account. Two account formats are supported: `Username@Tenant name#Cluster name` and `Cluster name:Tenant name:Username`. The default username of the tenant administrator is `root`.
|
||||
>
|
||||
> * -P: specifies the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
> * -P: specifies the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
>
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
>
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
>
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
>
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
|
||||
* To directly connect to the MySQL tenant, run the following command:
|
||||
|
||||
|
@ -58,41 +58,41 @@ Before you connect to an OceanBase database by using a MySQL client, make sure t
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> * -h: specifies the IP address for connecting to an OceanBase database, which is usually the IP address of an OBServer.
|
||||
> * -h: specifies the IP address for connecting to an OceanBase database, which is usually the IP address of an OBServer.
|
||||
>
|
||||
> * -u: specifies the tenant account in the `Username@Tenant name` format. The default username of the tenant administrator is `root`.
|
||||
> * -u: specifies the tenant account in the `Username@Tenant name` format. The default username of the tenant administrator is `root`.
|
||||
>
|
||||
> * -P: specifies the port for connecting to OceanBase Database. Default value: 2881, which can be customized.
|
||||
> * -P: specifies the port for connecting to OceanBase Database. Default value: 2881, which can be customized.
|
||||
>
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
>
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
>
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
>
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
>
|
||||
> * When you use the direct connection method, make sure that the tenant resources are distributed on the OBServer you specified. Otherwise, you cannot connect to the tenant by using this OBServer.
|
||||
> * When you use the direct connection method, make sure that the tenant resources are distributed on the OBServer you specified. Otherwise, you cannot connect to the tenant by using this OBServer.
|
||||
|
||||
3. After the connection is established, the following command-line prompt is displayed by default:
|
||||
3. After the connection is established, the following command-line prompt is displayed by default:
|
||||
|
||||
```sql
|
||||
MySQL [oceanbase]>
|
||||
```
|
||||
|
||||
4. To exit the MySQL command line, enter `exit` and press Enter, or press the shortcut key **Ctrl** + **D**.
|
||||
4. To exit the MySQL command line, enter `exit` and press Enter, or press the shortcut key **Ctrl** + **D**.
|
||||
|
||||
## Example
|
||||
|
||||
Connect to OceanBase Database by using a MySQL client
|
||||
Connect to OceanBase Database by using a MySQL client
|
||||
|
||||
```sql
|
||||
$mysql -h10.10.10.1 -u****@obmysql#obdemo -P2883 -p****** -c -A oceanbase
|
||||
$mysql -h10.10.10.1 -u****@obmysql#obdemo -P2883 -p**1*** -c -A oceanbase
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MySQL connection id is 5751
|
||||
Server version: 5.6.25 OceanBase 4.0.0 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22)
|
||||
|
||||
<...>
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
|
@ -112,4 +112,4 @@ Bye
|
|||
|
||||
## More information
|
||||
|
||||
If errors occur when you connect to an OceanBase database from a MySQL client, we recommend that you refer to the official MySQL documentation.
|
||||
If errors occur when you connect to an OceanBase database from a MySQL client, we recommend that you refer to the official MySQL documentation.
|
|
@ -1,6 +1,6 @@
|
|||
# Connect to OceanBase Database by using OBClient
|
||||
|
||||
OceanBase Client (OBClient) is an interactive batch query tool. You can use it to connect to OceanBase Database.
|
||||
OceanBase Client (OBClient) is an interactive batch query tool. You can use it to connect to OceanBase Database.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
@ -12,15 +12,15 @@ The OBClient application is downloaded and installed. You can install the OBClie
|
|||
yum install -y obclient
|
||||
```
|
||||
|
||||
* Download the installation package: visit [Software Center](https://open.oceanbase.com/softwareCenter/community), go to the download page of OBClient, and then select the required version to download.
|
||||
* Download the installation package: visit [Software Center](https://open.oceanbase.com/softwareCenter/community), go to the download page of OBClient, and then select the required version to download.
|
||||
|
||||
## Procedure
|
||||
|
||||
1. Open a command line.
|
||||
1. Open a command line.
|
||||
|
||||
2. Connect to OceanBase Database.
|
||||
2. Connect to OceanBase Database.
|
||||
|
||||
You can connect to an OceanBase database directly or connect to it by using an OBProxy.
|
||||
You can connect to an OceanBase database directly or connect to it by using an OBProxy.
|
||||
|
||||
* To connect to the MySQL tenant by using an OBProxy, run the following command:
|
||||
|
||||
|
@ -36,30 +36,30 @@ The OBClient application is downloaded and installed. You can install the OBClie
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> * -h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
> * -h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
>
|
||||
> * -u: specifies the tenant account. Two account formats are supported: `Username@Tenant name#Cluster name` and `Cluster name:Tenant name:Username`. The default username of the tenant administrator is `root`.
|
||||
> * -u: specifies the tenant account. Two account formats are supported: `Username@Tenant name#Cluster name` and `Cluster name:Tenant name:Username`. The default username of the tenant administrator is `root`.
|
||||
>
|
||||
> * -P: specifies the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
> * -P: specifies the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
>
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
>
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
>
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
>
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
|
||||
Examples:
|
||||
|
||||
```sql
|
||||
obclient -h10.10.10.1 -u****@obtenant#obdemo -P2883 -p****** -c -A oceanbase
|
||||
obclient -h10.10.10.1 -u****@obtenant#obdemo -P2883 -p**1*** -c -A oceanbase
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sql
|
||||
obclient -h10.10.10.1 -uobdemo:obtenant:**** -P2883 -p****** -c -A oceanbase
|
||||
obclient -h10.10.10.1 -uobdemo:obtenant:**** -P2883 -p**1*** -c -A oceanbase
|
||||
```
|
||||
|
||||
* To directly connect to the MySQL tenant, run the following command:
|
||||
|
@ -70,42 +70,42 @@ The OBClient application is downloaded and installed. You can install the OBClie
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> * -h: specifies the IP address for connecting to an OceanBase database, which is usually the IP address of an OBServer.
|
||||
> * -h: specifies the IP address for connecting to an OceanBase database, which is usually the IP address of an OBServer.
|
||||
>
|
||||
> * -u: specifies the tenant account in the `Username@Tenant name` format. The default username of the tenant administrator is `root`.
|
||||
>
|
||||
> * -P: specifies the port for connecting to OceanBase Database. Default value: 2881, which can be customized.
|
||||
> * -P: specifies the port for connecting to OceanBase Database. Default value: 2881, which can be customized.
|
||||
>
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
> * -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
|
||||
>
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
> * -c: specifies not to ignore comments in the runtime environment.
|
||||
>
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
> * -A: specifies not to automatically retrieve the statistical information when connecting to the tenant.
|
||||
>
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
> * oceanbase: the name of the database to be accessed. You can change it to a business database.
|
||||
>
|
||||
> * When you use the direct connection method, make sure that the tenant resources are distributed on the OBServer you specified. Otherwise, you cannot connect to the tenant by using this OBServer.
|
||||
> * When you use the direct connection method, make sure that the tenant resources are distributed on the OBServer you specified. Otherwise, you cannot connect to the tenant by using this OBServer.
|
||||
|
||||
Example:
|
||||
|
||||
```sql
|
||||
obclient -h10.10.10.1 -u******@obtenant -P2881 -p****** -c -A oceanbase
|
||||
obclient -h10.10.10.1 -u******@obtenant -P2881 -p**1*** -c -A oceanbase
|
||||
```
|
||||
|
||||
3. After the connection is established, the following command-line prompt is displayed by default:
|
||||
3. After the connection is established, the following command-line prompt is displayed by default:
|
||||
|
||||
```sql
|
||||
obclient>
|
||||
```
|
||||
|
||||
4. To exit the OBClient command line, enter `exit` and press Enter, or press the shortcut key **Ctrl** + **D**.
|
||||
4. To exit the OBClient command line, enter `exit` and press Enter, or press the shortcut key **Ctrl** + **D**.
|
||||
|
||||
## Example
|
||||
|
||||
Connect to OceanBase Database by using OBClient
|
||||
Connect to OceanBase Database by using OBClient
|
||||
|
||||
```sql
|
||||
$obclient -h10.10.10.1 -u****@obmysql#obdemo -P2883 -p****** -c -A sys
|
||||
$obclient -h10.10.10.1 -u****@obmysql#obdemo -P2883 -p**1*** -c -A sys
|
||||
Welcome to the OceanBase. Commands end with ; or \g.
|
||||
Your OceanBase connection id is 5751
|
||||
Server version: 5.6.25 OceanBase 4.0.0 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22)
|
|
@ -16,7 +16,7 @@ Before you install OceanBase Connector/C, make sure that you have set up the bas
|
|||
|
||||
You must obtain the installation package of OBClient and OceanBase Connector/C, which is also known as `libobclient`.
|
||||
|
||||
Find the required installation packages in the image repository based on your system version and download the installation packages. For more information, see **Software resources** in [Software and hardware requirements](../../../400.installation-and-deployment/200.local-deployment/100.requirements-for-software-and-hardware.md).
|
||||
Find the required installation packages in the image repository based on your system version and download the installation packages. For more information, see **Software resources** in [Software and hardware requirements](../../../4.installation-and-deployment/2.local-deployment/1.requirements-for-software-and-hardware.md).
|
||||
|
||||
1. Install OceanBase Connector/C.
|
||||
|
||||
|
@ -163,7 +163,7 @@ int main(int argc, char** argv)
|
|||
MYSQL *mysql = mysql_init(NULL);
|
||||
char* host_name = "172.xx.xx.xx";// Set your mysql host.
|
||||
char* user_name = "r***"; // Set your username.
|
||||
char* password = "******"; // Set your password.
|
||||
char* password = "***1**"; // Set your password.
|
||||
char* db_name = "test"; // Set your database name.
|
||||
int port_num = 2883; // Set your MySQL port number.
|
||||
char* socket_name = NULL;
|
||||
|
@ -250,4 +250,4 @@ export LD_LIBRARY_PATH=/u01/obclient/lib
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> By default, OBClient is installed in the `/u01/obclient` directory.
|
||||
> By default, OBClient is installed in the `/u01/obclient` directory.
|
|
@ -1,6 +1,6 @@
|
|||
# Connect to OceanBase Database by using Go MySQL Driver
|
||||
|
||||
This topic describes how to connect to OceanBase Database by using Go MySQL Driver.
|
||||
This topic describes how to connect to OceanBase Database by using Go MySQL Driver.
|
||||
|
||||
## Install Go MySQL Driver
|
||||
|
||||
|
@ -12,20 +12,20 @@ If you use Go 1.13 to 1.16, you can run the following command to install Go MySQ
|
|||
go get -u github.com/go-sql-driver/mysql
|
||||
```
|
||||
|
||||
For more information about Go MySQL Driver, see [Project description on Github](https://github.com/go-sql-driver/mysql).
|
||||
For more information about Go MySQL Driver, see [Project description on Github](https://github.com/go-sql-driver/mysql).
|
||||
|
||||
### Use the `go install` command to install Go MySQL Driver
|
||||
|
||||
If you cannot use the `go get` command due to the version or network issues, you can perform the following steps to install Go MySQL Driver:
|
||||
If you cannot use the `go get` command due to the version or network issues, you can perform the following steps to install Go MySQL Driver:
|
||||
|
||||
1. Clone the Go MySQL Driver repository from Github to the `/src` directory.
|
||||
1. Clone the Go MySQL Driver repository from Github to the `/src` directory.
|
||||
|
||||
```bash
|
||||
cd /usr/local/go/src
|
||||
cd /usr/local/go/src
|
||||
git clone https://github.com/go-sql-driver/mysql.git
|
||||
```
|
||||
|
||||
2. Run the `go install` command.
|
||||
2. Run the `go install` command.
|
||||
|
||||
```bash
|
||||
go install mysql
|
||||
|
@ -33,11 +33,11 @@ If you cannot use the `go get` command due to the version or network issues, you
|
|||
|
||||
> **Notice**
|
||||
>
|
||||
> For some Go versions, the `go install` command cannot be executed in the `/src` directory. You can identify the correct directory based on the error returned after you run the `go install` command. For example, put the `mysql` folder in the `/src/vendor` directory and then run the `go install` command if the following error is returned: `cannot find package "mysql" in: /usr/local/go/src/vendor/mysql`.
|
||||
> For some Go versions, the `go install` command cannot be executed in the `/src` directory. You can identify the correct directory based on the error returned after you run the `go install` command. For example, put the `mysql` folder in the `/src/vendor` directory and then run the `go install` command if the following error is returned: `cannot find package "mysql" in: /usr/local/go/src/vendor/mysql`.
|
||||
|
||||
## Use Go MySQL Driver
|
||||
|
||||
You can set the connection string in the format of `username:password@protocol(address)/dbname?param=value`.
|
||||
You can set the connection string in the format of `username:password@protocol(address)/dbname?param=value`.
|
||||
|
||||
The following sample code takes the `test.go` file as an example:
|
||||
|
||||
|
@ -63,7 +63,7 @@ func main() {
|
|||
}
|
||||
|
||||
func select_all() {
|
||||
conn := "root:******@tcp(127.0.0.1:2881)/testdb"
|
||||
conn := "root:@tcp(127.0.0.1:2881)/testdb"
|
||||
db, err := sql.Open("mysql", conn)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -106,17 +106,17 @@ Parameters
|
|||
conn := "{username}:{password}@tcp({hostname}:{port})/{dbname}"
|
||||
```
|
||||
|
||||
* **username**: the connection account of the tenant. By default, the username of the tenant administrator is `root`.
|
||||
* **username**: the connection account of the tenant. By default, the username of the tenant administrator is `root`.
|
||||
|
||||
* **password**: the password of the account.
|
||||
* **password**: the password of the account.
|
||||
|
||||
* **hostname**: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
* **hostname**: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
|
||||
|
||||
* **port**: the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
* **port**: the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
|
||||
|
||||
* **dbname**: the name of the database to be accessed.
|
||||
* **dbname**: the name of the database to be accessed.
|
||||
|
||||
Example: `conn := "root:******@tcp(127.0.0.1:2881)/testdb"`
|
||||
Example: `conn := "root:@tcp(127.0.0.1:2881)/testdb"`
|
||||
|
||||
After you edit the code, run the following command:
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Connect to OceanBase Database by using Unix ODBC
|
||||
|
||||
This topic describes how to connect to OceanBase Database by using Unix ODBC.
|
||||
This topic describes how to connect to OceanBase Database by using Unix ODBC.
|
||||
|
||||
## Install dependencies
|
||||
|
||||
|
@ -54,11 +54,11 @@ $sudo vim /etc/odbc.ini
|
|||
[ob_db]
|
||||
Description = Data source OceanBase
|
||||
Driver = OceanBase
|
||||
Server = 127.0.0.1
|
||||
Server = 127.0.0.1
|
||||
Database = testdb
|
||||
Port = 2881
|
||||
User = root
|
||||
Password = ******
|
||||
Password =
|
||||
CHARSET = UTF8
|
||||
```
|
||||
|
|
@ -47,7 +47,7 @@ spring:
|
|||
url: jdbc:oceanbase://10.100.xxx.xxx:18815/test
|
||||
driver-class-name: com.alipay.oceanbase.jdbc.Driver
|
||||
username: admin@mysql
|
||||
password: ******
|
||||
password: admin
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: update
|
|
@ -56,10 +56,10 @@ SQL syntax:
|
|||
obclient> ALTER USER username IDENTIFIED BY 'password';
|
||||
```
|
||||
|
||||
Example for changing the password of sqluser01 to `******`:
|
||||
Example for changing the password of sqluser01 to `***1**`:
|
||||
|
||||
```sql
|
||||
obclient> ALTER USER sqluser01 IDENTIFIED BY ******;
|
||||
obclient> ALTER USER sqluser01 IDENTIFIED BY ***1**;
|
||||
```
|
||||
|
||||
### Change the password of a user by using the SET PASSWORD statement
|
||||
|
@ -78,9 +78,9 @@ Notes:
|
|||
|
||||
* If the `FOR user` clause is specified, this statement changes the password of the specified user. To change the password of a specified user, you must have the global `CREATE USER` privilege.
|
||||
|
||||
Example for changing the password of `sqluser01` to `******`:
|
||||
Example for changing the password of `sqluser01` to `***1**`:
|
||||
|
||||
```sql
|
||||
obclient> SET PASSWORD FOR sqluser01 = password('******');
|
||||
obclient> SET PASSWORD FOR sqluser01 = password('***1**');
|
||||
Query OK, 0 rows affected
|
||||
```
|
|
@ -30,6 +30,8 @@ table_definition:
|
|||
REFERENCES reference_definition
|
||||
[match_action][opt_reference_option_list]
|
||||
| {INDEX | KEY} [index_name] index_desc
|
||||
| FULLTEXT [INDEX | KEY]
|
||||
[index_name] fulltext_index_desc
|
||||
|
||||
column_definition_list:
|
||||
column_definition [, column_definition ...]
|
||||
|
@ -54,6 +56,9 @@ opt_reference_option_list:
|
|||
reference_option:
|
||||
ON {DELETE | UPDATE} {RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT}
|
||||
|
||||
fulltext_index_desc:
|
||||
(column_desc_list) CTXCAT(column_desc_list) [index_option_list]
|
||||
|
||||
column_desc_list:
|
||||
column_desc [, column_desc ...]
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# About table structure modification
|
||||
|
||||
This topic describes how to **rename a table**, **rename a column**, **modify a column type**, **rename a column and change the column type**, **change a normal column to an auto-increment column**, **add a column**, **delete a column**, **add a primary key**, **modify a primary key**, **delete a primary ke**y, **add a foreign key**, **delete a foreign key**, **add a CHECK constraint**, and **modify a table partition**.
|
||||
This topic describes how to [rename a table](#example%201-1%20rename%20a%20table), [rename a column](#example%201-2%20rename%20a%20column), [modify a column type](#example%201-3%20change%20the%20type%20of%20a%20column), [rename a column and change the column type](#example%201-4%20rename%20a%20column%20and%20change%20the%20column%20type%20at%20the%20same%20time), [change a normal column to an auto-increment column](#example%201-5%20change%20a%20normal%20column%20to%20an%20auto%20increment%20column), [add a column](#example%201-6%20add%20a%20column), [delete a column](#example%201-7%20drop%20a%20column), [add a primary key](#example%201-8%20add%20a%20primary%20key), [modify a primary key](#example%201-9%20modify%20a%20primary%20key), [delete a primary key](#example%201-10%20drop%20a%20primary%20key), [add a foreign key](#example%201-11%20add%20a%20foreign%20key), [delete a foreign key](#example%201-12%20drop%20a%20foreign%20key), [add a CHECK constraint](#example%201-13%20add%20a%20check%20constraint), and [modify a table partition](#example%202-modify%20the%20partitioning%20rule%20of%20a%20table).
|
||||
|
||||
## Prerequisites
|
||||
|
|
@ -487,4 +487,4 @@ CREATE TABLE table_name (column_name column_type[,column_name column_type])
|
|||
|
||||
## Subsequent operations
|
||||
|
||||
After creating a partition, you can add, drop, or truncate the partition. For information about partition management, see [Manage a partitioned table](../700.create-and-manage-partition-table/300.manage-level-1-partition-table.md).
|
||||
After creating a partition, you can add, drop, or truncate the partition. For information about partition management, see [Manage a partitioned table](3.manage-level-1-partition-table.md).
|
|
@ -6,7 +6,7 @@ You can use the `CREATE INDEX` statement to create an index on a table.
|
|||
|
||||
OceanBase Database allows you to create an index on both partitioned and non-partitioned tables. An index can be either a local index or a global index. In addition, it can either be a unique index or a normal index. A local unique index on a partitioned table must include a partitioning key of the table.
|
||||
|
||||
This topic describes how to create an index on a non-partitioned table. For information about how to create an index on a partitioned table, see [Indexes on partitioned tables](../700.create-and-manage-partition-table/700.partition-table-index.md).
|
||||
This topic describes how to create an index on a non-partitioned table. For information about how to create an index on a partitioned table, see [Indexes on partitioned tables](../7.create-and-manage-partition-table/7.partition-table-index.md).
|
||||
|
||||
## Syntax
|
||||
|
||||
|
@ -31,6 +31,7 @@ table_definition:
|
|||
| [CONSTRAINT [constraint_name]] PRIMARY KEY index_desc
|
||||
| [CONSTRAINT [constraint_name]] UNIQUE {INDEX | KEY} [index_name] index_desc
|
||||
| {INDEX | KEY} [index_name] index_desc
|
||||
| FULLTEXT [INDEX | KEY] [index_name] fulltext_index_desc
|
||||
|
||||
column_definition_list:
|
||||
column_definition [, column_definition ...]
|
||||
|
@ -43,6 +44,9 @@ column_definition:
|
|||
index_desc:
|
||||
(column_desc_list) [index_type] [index_option_list]
|
||||
|
||||
fulltext_index_desc:
|
||||
(column_desc_list) CTXCAT(column_desc_list) [index_option_list]
|
||||
|
||||
column_desc_list:
|
||||
column_desc [, column_desc ...]
|
||||
|
||||
|
@ -141,7 +145,7 @@ In a MySQL tenant, index names must be unique at the table level. You can use th
|
|||
In MySQL mode, you can also use the ALTER TABLE statement to create an index.
|
||||
|
||||
```sql
|
||||
ALTER TABLE table_name
|
||||
ALTER TABLE table_name
|
||||
ADD INDEX|KEY index_name ( column_list );
|
||||
```
|
||||
|
|
@ -43,24 +43,24 @@ Note the difference between the `WHERE` and `HAVING` clauses. The `WHERE` clause
|
|||
Create tables named `emp` and `dept` and insert data to the tables.
|
||||
|
||||
```sql
|
||||
CREATE TABLE dept(
|
||||
deptno NUMBER(2,0),
|
||||
dname VARCHAR(14),
|
||||
location VARCHAR(13),
|
||||
CONSTRAINT pk_dept PRIMARY KEY(deptno)
|
||||
CREATE TABLE dept(
|
||||
deptno NUMBER(2,0),
|
||||
dname VARCHAR(14),
|
||||
location VARCHAR(13),
|
||||
CONSTRAINT pk_dept PRIMARY KEY(deptno)
|
||||
);
|
||||
|
||||
CREATE TABLE emp(
|
||||
empno NUMBER(4,0),
|
||||
empname VARCHAR(10),
|
||||
job VARCHAR(9),
|
||||
mgr NUMBER(4,0),
|
||||
hiredate DATE,
|
||||
sal NUMBER(7,2),
|
||||
comm NUMBER(7,2),
|
||||
deptno NUMBER(2,0),
|
||||
CREATE TABLE emp(
|
||||
empno NUMBER(4,0),
|
||||
empname VARCHAR(10),
|
||||
job VARCHAR(9),
|
||||
mgr NUMBER(4,0),
|
||||
hiredate DATE,
|
||||
sal NUMBER(7,2),
|
||||
comm NUMBER(7,2),
|
||||
deptno NUMBER(2,0),
|
||||
CONSTRAINT PK_emp PRIMARY KEY (empno),
|
||||
CONSTRAINT FK_deptno FOREIGN KEY (deptno) REFERENCES dept (deptno)
|
||||
CONSTRAINT FK_deptno FOREIGN KEY (deptno) REFERENCES dept (deptno)
|
||||
);
|
||||
|
||||
INSERT INTO dept VALUES (20,'ACCOUNTING','Los Angeles');
|
||||
|
@ -209,6 +209,6 @@ obclient> SELECT LOWER(empname), sal, deptno FROM emp;
|
|||
6 rows in set
|
||||
```
|
||||
|
||||
In addition, you can use the `WHERE` clause to query specified columns. For more information, see [WHERE queries](../300.query/400.conditional-query.md).
|
||||
In addition, you can use the `WHERE` clause to query specified columns. For more information, see [WHERE queries](4.conditional-query.md).
|
||||
|
||||
For more information, see [Use operators and functions in queries](900.use-operators-and-functions-in-queries/100.use-arithmetic-operators-in-queries.md).
|
||||
For more information, see [Use operators and functions in queries](9.use-operators-and-functions-in-queries/1.use-arithmetic-operators-in-queries.md).
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue