如何将 starrocks 的 be 的多个存储目录剔除一个?

说明

starrocks 集群的 be 节点的多个存储目录,有一个磁盘空间过小,搭建时误配置上,如下所示:

$ df -lh
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                     94G     0   94G   0% /dev
tmpfs                        94G     0   94G   0% /dev/shm
tmpfs                        94G   43M   94G   1% /run
tmpfs                        94G     0   94G   0% /sys/fs/cgroup
/dev/mapper/rootvg-lv_root  127G  1.7G  126G   2% /
/dev/mapper/rootvg-lv_usr    97G  1.9G   96G   2% /usr
/dev/sda2                   506M  226M  281M  45% /boot
/dev/sda1                   200M   12M  189M   6% /boot/efi
/dev/sdc                    1.8T   61G  1.7T   4% /data19
/dev/sdo                    7.3T   59G  7.3T   1% /data12
/dev/sdn                    7.3T   62G  7.3T   1% /data11
/dev/sdb                    7.3T   65G  7.3T   1% /data
/dev/sdm                    7.3T   57G  7.3T   1% /data10
/dev/sdr                    7.3T   62G  7.3T   1% /data15
/dev/sdg                    7.3T   58G  7.3T   1% /data4
/dev/sdh                    7.3T   59G  7.3T   1% /data5
/dev/sdq                    7.3T   61G  7.3T   1% /data14
/dev/sdp                    7.3T   57G  7.3T   1% /data13
/dev/sdf                    7.3T   64G  7.3T   1% /data3
/dev/sdu                    7.3T   60G  7.3T   1% /data18
/dev/sdj                    7.3T   59G  7.3T   1% /data7
/dev/sdt                    7.3T   68G  7.3T   1% /data17
/dev/sdl                    7.3T   60G  7.3T   1% /data9
/dev/sdk                    7.3T   58G  7.3T   1% /data8
/dev/sdd                    7.3T   66G  7.3T   1% /data1
/dev/sde                    7.3T   62G  7.3T   1% /data2
/dev/sdi                    7.3T   79G  7.2T   2% /data6
/dev/sds                    7.3T   65G  7.3T   1% /data16
/dev/mapper/rootvg-lv_var   173G  4.1G  169G   3% /var
/dev/mapper/rootvg-lv_opt    50G  4.5G   46G   9% /opt
tmpfs                        19G     0   19G   0% /run/user/0
cm_processes                 94G  8.8M   94G   1% /run/cloudera-scm-agent/process
tmpfs                        19G     0   19G   0% /run/user/1001
$ 

其中,目录 /data19 相对其他数据目录过小,为统一存储目录空间大小保持一致,将其从 BE 的存储目录移除。具体操作流程,先停掉相应的 BE 服务,然后从 storage_root_path 中删掉对应盘的配置,然后重启 be 节点即可。但是做该操作之前一定要保证没有单副本的表,如果有的话,下掉该磁盘就很可能丢失数据,因为单副本的表的数据有可能就存储在要下掉的盘上。之后可以通过 show PROC '/statistic' 查看对应不健康的副本数。

查看对应不健康的副本数

$ mysql -h 192.168.37.10 -P9030 -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.0 StarRocks version 2.2.1

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 [(none)]> show PROC '/statistic';
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
| DbId  | DbName                       | TableNum | PartitionNum | IndexNum | TabletNum | ReplicaNum | UnhealthyTabletNum | InconsistentTabletNum | CloningTabletNum |
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
| 10002 | default_cluster:_statistics_ | 1        | 1            | 1        | 10        | 10         | 0                  | 0                     | 0                |
| 11001 | default_cluster:hive_test    | 0        | 0            | 0        | 0         | 0          | 0                  | 0                     | 0                |
| 10111 | default_cluster:dw           | 1        | 61           | 61       | 610       | 1830       | 0                  | 0                     | 0                |
| Total | 3                            | 2        | 62           | 62       | 620       | 1840       | 0                  | 0                     | 0                |
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
4 rows in set (0.07 sec)

停止相应的 be 实例

$ cd be
$ ./bin/stop_be.sh 
stop starrocks_be, and remove pid file. 
$ 

再次查看对应不健康的副本数

MySQL [(none)]> show PROC '/statistic';
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
| DbId  | DbName                       | TableNum | PartitionNum | IndexNum | TabletNum | ReplicaNum | UnhealthyTabletNum | InconsistentTabletNum | CloningTabletNum |
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
| 10002 | default_cluster:_statistics_ | 1        | 1            | 1        | 10        | 30         | 5                  | 0                     | 0                |
| 11001 | default_cluster:hive_test    | 0        | 0            | 0        | 0         | 0          | 0                  | 0                     | 0                |
| 10111 | default_cluster:dw           | 1        | 61           | 61       | 610       | 1830       | 305                | 0                     | 0                |
| Total | 3                            | 2        | 62           | 62       | 620       | 1860       | 310                | 0                     | 0                |
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
4 rows in set (0.00 sec)

MySQL [(none)]> 

修改相应 be 的配置

修改前:

$ cat conf/be.conf |grep -v '#'

sys_log_level = INFO

be_port = 9060
webserver_port = 18040
heartbeat_service_port = 9050
brpc_port = 8060

priority_networks = 192.168.37.16

storage_root_path = /data1/starrocks;/data2/starrocks;/data3/starrocks;/data4/starrocks;/data5/starrocks;/data6/starrocks;/data7/starrocks;/data8/starrocks;/data9/starrocks;/data10/starrocks;/data11/starrocks;/data12/starrocks;/data13/starrocks;/data14/starrocks;/data15/starrocks;/data16/starrocks;/data17/starrocks;/data18/starrocks;/data19/starrocks

default_rowset_type = beta
$ 

剔除掉目录 /data19/starrocks 后:

$ cat conf/be.conf |grep -v '#'

sys_log_level = INFO

be_port = 9060
webserver_port = 18040
heartbeat_service_port = 9050
brpc_port = 8060

priority_networks = 192.168.37.16

storage_root_path = /data1/starrocks;/data2/starrocks;/data3/starrocks;/data4/starrocks;/data5/starrocks;/data6/starrocks;/data7/starrocks;/data8/starrocks;/data9/starrocks;/data10/starrocks;/data11/starrocks;/data12/starrocks;/data13/starrocks;/data14/starrocks;/data15/starrocks;/data16/starrocks;/data17/starrocks;/data18/starrocks

default_rowset_type = beta
$

启动修改配置后的 be

$ ./bin/start_be.sh --daemon

再次查看对应不健康的副本数

MySQL [(none)]> show PROC '/statistic';
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
| DbId  | DbName                       | TableNum | PartitionNum | IndexNum | TabletNum | ReplicaNum | UnhealthyTabletNum | InconsistentTabletNum | CloningTabletNum |
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
| 10002 | default_cluster:_statistics_ | 1        | 1            | 1        | 10        | 30         | 0                  | 0                     | 0                |
| 11001 | default_cluster:hive_test    | 0        | 0            | 0        | 0         | 0          | 0                  | 0                     | 0                |
| 10111 | default_cluster:dw           | 1        | 61           | 61       | 610       | 1930       | 0                  | 0                     | 0                |
| Total | 3                            | 2        | 62           | 62       | 620       | 1960       | 0                  | 0                     | 0                |
+-------+------------------------------+----------+--------------+----------+-----------+------------+--------------------+-----------------------+------------------+
4 rows in set (0.00 sec)

MySQL [(none)]> 

等待 starrocks 副本机制自动修复不健康的副本数,即等待 UnhealthyTabletNum 列的值降至 0。

参照

  • https://forum.starrocks.com/t/topic/2926/2

你可能感兴趣的:(如何将 starrocks 的 be 的多个存储目录剔除一个?)