暂无图片
暂无图片
5
暂无图片
暂无图片
暂无图片

OceanBase 1.4集群——跨节点访问问题

原创 gelyon 2020-08-10
3111

一步一步学习OceanBase系列回顾:
第一篇:OceanBase 1.4 集群手动安装步骤
第二篇:obproxy的安装、配置和使用
第三篇:OceanBase 1.4 集群——租户的创建和使用
第四篇:OceanBase1.4 集群扩容
第五篇:OceanBase1.4 集群——租户的扩容
第六篇:OceanBase1.4 集群——节点宕机故障体验

本篇是第七篇 oceanbase 1.4集群跨节点访问问题。

oceanbase 1.4集群跨节点访问问题 ERROR 1235 (0A000): strong consistency across distributed node not supported 数据分布情况: MySQL [oceanbase]> SELECT t1.tenant_id,t1.tenant_name,t2.database_name,t3.table_id,t3.table_Name,t3.tablegroup_id,t3.part_num,t4.partition_Id, -> t4.zone,t4.svr_ip,t4.role, round(t4.data_size/1024/1024) data_size_mb -> from `gv$tenant` t1 -> join `gv$database` t2 on (t1.tenant_id = t2.tenant_id) -> join gv$table t3 on (t2.tenant_id = t3.tenant_id and t2.database_id = t3.database_id and t3.index_type = 0) -> left join `gv$partition` t4 on (t2.tenant_id = t4.tenant_id and ( t3.table_id = t4.table_id or t3.tablegroup_id = t4.table_id ) and t4.role in (1,2)) -> where t1.tenant_id = 1001 -> order by t3.tablegroup_id, t3.table_name,t4.partition_Id ; | tenant_id | tenant_name | database_name | table_id | table_Name | tablegroup_id | part_num | partition_Id | zone | svr_ip | role | data_size_mb | +-----------+--------------+---------------+------------------+------------+---------------+----------+--------------+-------+---------------+------+--------------+ | 1001 | my_test_tent | testdb | 1100611139453777 | test | -1 | 1 | 0 | zone2 | 192.168.0.89 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453777 | test | -1 | 1 | 0 | zone3 | 192.168.0.41 | 1 | 0 | | 1001 | my_test_tent | testdb | 1100611139453777 | test | -1 | 1 | 0 | zone1 | 192.168.0.106 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 0 | zone2 | 192.168.0.89 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 0 | zone3 | 192.168.0.41 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 0 | zone1 | 192.168.0.151 | 1 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 1 | zone2 | 192.168.0.43 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 1 | zone3 | 192.168.0.41 | 1 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 1 | zone1 | 192.168.0.106 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 2 | zone3 | 192.168.0.143 | 1 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 2 | zone1 | 192.168.0.106 | 2 | 0 | | 1001 | my_test_tent | testdb | 1100611139453778 | test_hash | -1 | 3 | 2 | zone2 | 192.168.0.43 | 2 | 0 | +-----------+--------------+---------------+------------------+------------+---------------+----------+--------------+-------+---------------+------+--------------+ 12 rows in set (0.06 sec) MySQL [oceanbase]> 非分区表test的p0号分区,主副本在zone3下的41节点,两个备副本在zone1的106节点和zone2的89节点。 test_hash分区表的p0分区,主副本在zone1下的151节点,两个备副本在zone2的89节点和zone3下的41节点。 test_hash分区表的p1分区,主副本在zone3下的41节点,两个备副本在zone1的106节点和zone2的43节点。 test_hash分区表的p2分区,主副本在zone3的143节点,两个备副本在zone1下的106节点和zone2的43节点。 $ mysql -h192.168.0.151 -uaps2@my_test_tent#obdemo -P2883 -paps2#12345 -c -A testdb Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 524814 Server version: 5.6.25 OceanBase 1.4.60 (r1571952-758a58e85846f9efb907b1c14057204cb6353846) (Built Mar 9 2018 14:32:07) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [testdb]> 查询test非分区表,不会涉及跨节点访问,查询不会有问题。 MySQL [testdb]> select * from test; +------+---------+------+---------------------+ | id | name | age | dt | +------+---------+------+---------------------+ | 1 | ob1.4.6 | 20 | 2020-08-07 14:05:40 | | 2 | 张三 | 26 | 1998-06-17 00:00:00 | | 3 | 李四 | 32 | 1989-10-13 00:00:00 | | 4 | Tom | 30 | 1990-02-21 00:00:00 | +------+---------+------+---------------------+ 4 rows in set (0.01 sec) MySQL [testdb]> 查询test_hash分区表,指定分区键,也不会涉及跨节点访问,查询也不会有问题。 MySQL [testdb]> select * from test_hash where id=1; +----+--------+------+---------------------+ | id | name | age | dt | +----+--------+------+---------------------+ | 1 | 张三 | 26 | 1998-06-17 00:00:00 | +----+--------+------+---------------------+ 1 row in set (0.01 sec) MySQL [testdb]> 查询test_hash分区表,当涉及跨节点访问,查询会报错。 MySQL [testdb]> select * from test_hash; ERROR 1235 (0A000): strong consistency across distributed node not supported MySQL [testdb]> 从集中式数据库转分布式数据库,会面临一个挑战。一个查询读取的数据跨节点时如何保证强一致(全局一致性版本,或者理解为全局的 scn)。 这个需要数据库内部有全局时间服务(GTS)或者类似机制。 OB 1.4 没有GTS 服务,OB 2.0 以后都有了。 OB 1.4为了保证数据读取是全局一致的,当发现数据跨节点就直接报错。 ERROR 1235 (0A000): strong consistency across distributed node not supported 可以通过 对查询 加 弱一致性读 hint 规避 /*+ read_consistency(weak) */ MySQL [testdb]> select /*+ read_consistency(weak) */ * from test_hash; +----+--------+------+---------------------+ | id | name | age | dt | +----+--------+------+---------------------+ | 3 | Tom | 30 | 1990-02-21 00:00:00 | | 1 | 张三 | 26 | 1998-06-17 00:00:00 | | 2 | 李四 | 32 | 1989-10-13 00:00:00 | +----+--------+------+---------------------+ 3 rows in set (0.00 sec) MySQL [testdb]> 1.4版本会存在这个问题,其他功能之前文章已体验了,还是不错的。 高可用、负载均衡都是很完备的。 一步一步学习OceanBase系列 下次实操继续更新~~~~~
复制
最后修改时间:2020-08-12 12:02:04
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论