OceanBase支持在线扩容数据目录(data_dir)吗

OceanBase支持在线扩容数据目录(data_dir)吗

这个属于操作系统层面要求,支持的。
而且ob在遇到目录告警也是要这么做的。

OceanBase 的存储目前仅支持文件系统,ext4 或 xfs 都行。部署的时候指定 数据文件目录 。你的问题分两步:

    1. 文件系统能在线扩容吗?
      这个跟OB 无关。如果你的文件系统是建在 LVM 的 LV 上,你新增磁盘后,LVM 是可以在线扩容该 LV 容量 (lvextend) 。 文件系统也可以在线扩容(resize2fs )。
    1. 文件系统扩容后 OB 的数据文件能在线扩容吗?

OB 的数据文件容量是参数 datafile_disk_percentagedatafile_size 共同指定。如果 datafile_size 没有设置过(非0),那大小就看参数 datafile_disk_percentage 这个是根据数据文件所在文件系统的总空间大小乘以一个这个参数比例定的(所以 OB 数据文件强烈建议使用独立的文件系统,否则选这个参数很容易出现空间不足问题)。如果文件系统总空间扩容了,那么节点重启一下,按道理 OB数据文件的大小也会增长(blockfile 的大小)。
不过,更建议使用后面的参数 datafile_size 显示控制 OB 数据文件(blockfile)大小 (此时参数 datafile_disk_percentage 不起作用) 。这样当文件系统总可用空间增长时,你可以手动调大这个值。但是也不要一下子太大了,因为OB 的数据文件是预分配空间的。数据文件不支持收缩。调小是没有用的。

MySQL [oceanbase]> show parameters like '%datafile%';
+-------+----------+-----------+----------+--------------------------+-----------+-------+-------------------------------------------------------------------------------+---------+---------+---------+-------------------+
| zone  | svr_type | svr_ip    | svr_port | name                     | data_type | value | info                                                                          | section | scope   | source  | edit_level        |
+-------+----------+-----------+----------+--------------------------+-----------+-------+-------------------------------------------------------------------------------+---------+---------+---------+-------------------+
| ZONE3 | observer | 10.0.0.63 |     2882 | datafile_disk_percentage | NULL      | 90    | the percentage of disk space used by the data files. Range: [5,99] in integer | SSTABLE | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| ZONE3 | observer | 10.0.0.63 |     2882 | datafile_size            | NULL      | 100G  | size of the data file. Range: [0, +∞)                                         | SSTABLE | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| ZONE2 | observer | 10.0.0.62 |     2882 | datafile_disk_percentage | NULL      | 90    | the percentage of disk space used by the data files. Range: [5,99] in integer | SSTABLE | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| ZONE2 | observer | 10.0.0.62 |     2882 | datafile_size            | NULL      | 100G  | size of the data file. Range: [0, +∞)                                         | SSTABLE | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone1 | observer | 10.0.0.61 |     2882 | datafile_disk_percentage | NULL      | 90    | the percentage of disk space used by the data files. Range: [5,99] in integer | SSTABLE | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone1 | observer | 10.0.0.61 |     2882 | datafile_size            | NULL      | 100G  | size of the data file. Range: [0, +∞)                                         | SSTABLE | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+-----------+----------+--------------------------+-----------+-------+-------------------------------------------------------------------------------+---------+---------+---------+-------------------+
6 rows in set (0.04 sec)

你可以手动改大 alter system set datafile_size = ‘xxxG’;注意不能改小
另外在3.x版本 从3.1.4_CE版本开始支持数据文件动态按需分配
目前已经发布的4.x版本还不支持上面的特性,4.2版本会支持

1 个赞