前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >聊聊Lustre Quota

聊聊Lustre Quota

作者头像
用户4700054
发布2023-02-26 14:48:27
9250
发布2023-02-26 14:48:27
举报

Quota设计思路

  • lustre整体分为masterslave,其中master是负责全局的quota分配和追踪运行在MDT上;slave负责后端mdtost后端文件系统的hard quota的统计和上报,运行在MDT和所有的OST上。

Quota设置核心链路

  • Quota Master
代码语言:javascript
复制
// 这个qmt_hdls定义了quota的请求处理函数
struct qmt_handlers qmt_hdls = {
    /* quota request handlers */
    .qmth_quotactl      = qmt_quotactl,
    .qmth_dqacq     = qmt_dqacq,
	/******忽略******/
};
  • Quota Slave
代码语言:javascript
复制
// quota slave端的核心数据结构
struct qsd_instance;

// slave端的核心函数
struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *,struct proc_dir_entry *, bool is_md, bool excl);
int qsd_prepare(const struct lu_env *, struct qsd_instance *);
int qsd_start(const struct lu_env *, struct qsd_instance *);
void qsd_fini(const struct lu_env *, struct qsd_instance *);
int qsd_op_begin(const struct lu_env *, struct qsd_instance *,
		 struct lquota_trans *, struct lquota_id_info *,
		 enum osd_quota_local_flags *);
void qsd_op_end(const struct lu_env *, struct qsd_instance *,
		struct lquota_trans *);
void qsd_op_adjust(const struct lu_env *, struct qsd_instance *,
		   union lquota_id *, int);
int qsd_transfer(const struct lu_env *env, struct qsd_instance *qsd,
		 struct lquota_trans *trans, unsigned int qtype,
		 u64 orig_id, u64 new_id, u64 bspace,
		 struct lquota_id_info *qi);

Lustre quota设置

quota启用

  • quota取值范围
代码语言:javascript
复制
// osd-ldiskfs.{fsname}-OST{index}.quota_slave.enabled取值范围
// 参数必须在mgs端进行设置

* u - 仅对⽤户启⽤强制配额 
* g - 仅对组启⽤强制配额 
* p - 仅对项⽬启⽤强制配额 
* ugp - 启⽤所有⽤户、组和项⽬的强制配额 
* none - 禁⽤所有⽤户、组和项⽬的强制配额。
  • MDT端启用inode限制
代码语言:javascript
复制
// 查看quota参数
[root@CentOS-Lustre-MDS ~]$ lctl list_param *.*.*.* |grep quota|grep -v dt|grep -v md|grep enable
osd-ldiskfs.bigfs-MDT0000.quota_slave.enabled

// 查看默认的mdt上的quota限制
[root@CentOS-Lustre-MDS ~]$ lctl get_param osd-ldiskfs.bigfs-MDT0000.quota_slave.enabled
osd-ldiskfs.bigfs-MDT0000.quota_slave.enabled=none

// 查看启用后的参数值
[root@CentOS-Lustre-MDS ~]$ lctl conf_param bigfs.quota.mdt=ugp
[root@CentOS-Lustre-MDS ~]$ sync
[root@CentOS-Lustre-MDS ~]$ lctl get_param osd-ldiskfs.bigfs-MDT0000.quota_slave.enabled
osd-ldiskfs.bigfs-MDT0000.quota_slave.enabled=ugp
  • OST
代码语言:javascript
复制
// 查看ost端的quota
[root@CentOS-Lustre-OSS ~]$ lctl get_param osd-ldiskfs.bigfs-OST*.quota_slave.enabled
osd-ldiskfs.bigfs-OST0001.quota_slave.enabled=none
osd-ldiskfs.bigfs-OST0002.quota_slave.enabled=none


// 在mgs端启用quota
[root@CentOS-Lustre-MDS ~]$ lctl conf_param bigfs.quota.ost=ugp
[root@CentOS-Lustre-MDS ~]$ sync

// 查看启用后的参数值
[root@CentOS-Lustre-OSS ~]$ lctl get_param osd-ldiskfs.bigfs-OST*.quota_slave.enabled
osd-ldiskfs.bigfs-OST0001.quota_slave.enabled=ugp
osd-ldiskfs.bigfs-OST0002.quota_slave.enabled=ugp

Quota设置

  • 设置quota
代码语言:javascript
复制
// 设置语法
// lfs setquota {-u|--user|-g|--group|-p|--project} username|groupname [-b block-softlimit]  [-B block_hardlimit] [-i inode_softlimit]  5 [-I inode_hardlimit] /mount_point

// 设置示例
// 说明: perrynzhou在整个/bigfs空间内,用户在MDT端inode的软限制(-i 10000)是10000,硬限制(-I 11000)是11000;在OST上限制的Block软限制是307200个,硬限制是309200个
[root@centos-lustre-client ~]$ lfs setquota -u perrynzhou -b 307200 -B 309200 -i 10000 -I 11000 /bigfs

// 单个目录设置quota
lfs project -s -p 1 -r /bigfs/quota_dir2
lfs setquota -p 1 -b 42800 -B 42800 -i 409600 -I 409600 /bigfs
  • 清除quota
代码语言:javascript
复制
// 语法规则:lctl conf_param fsname.quota.ost|mdt=u|g|p|ugp|none


// mdt管理的是inode配额
// ost管理的是块配额
$ lctl conf_param bigfs.quota.ost=ugp
$ lctl conf_param bigfs.quota.mdt=ugp


// 这里会清除整个文件系统的quota信息
[root@CentOS-Lustre-MDS ~]$ lctl conf_param bigfs.quota.ost=none
[root@CentOS-Lustre-MDS ~]$ lctl conf_param bigfs.quota.mdt=none

Quota查看

代码语言:javascript
复制
[root@CentOS-Lustre-MDS ~]$ lctl get_param osd-*.*.quota_slave.limit*
osd-ldiskfs.bigfs-MDT0000.quota_slave.limit_group=
global_index_copy:
- id:      0
  limits:  { hard:                    0, soft:                    0, granted:                    0, time:               604800 }
osd-ldiskfs.bigfs-MDT0000.quota_slave.limit_project=
global_index_copy:
- id:      0
  limits:  { hard:                    0, soft:                    0, granted:                    0, time:               604800 }
- id:      1
  limits:  { hard:               409600, soft:               409600, granted:                    0, time:                    0 }
osd-ldiskfs.bigfs-MDT0000.quota_slave.limit_user=
global_index_copy:
- id:      0
  limits:  { hard:                    0, soft:                    0, granted:                    0, time:               604800 }
- id:      1000
  limits:  { hard:                22000, soft:                20000, granted:                    0, time:                    0 }
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023-02-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 存储内核技术交流 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Quota设计思路
  • Quota设置核心链路
  • Lustre quota设置
    • quota启用
      • Quota设置
        • Quota查看
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档