Linux认证辅导:RH436(3)

九、gfs参数调优
1、查看gfs参数
[root@node1 ~]# gfs_tool gettune /var/www/html
ilimit1 = 100
ilimit1_tries = 3
ilimit1_min = 1
ilimit2 = 500
ilimit2_tries = 10
ilimit2_min = 3
demote_secs = 300
incore_log_blocks = 1024
jindex_refresh_secs = 60
depend_secs = 60
scand_secs = 5
recoverd_secs = 60
logd_secs = 1
quotad_secs = 5
inoded_secs = 15
glock_purge = 0
quota_simul_sync = 64
quota_warn_period = 10
atime_quantum = 3600
quota_quantum = 60
quota_scale = 1.0000   (1, 1)
quota_enforce = 1
quota_account = 1
new_files_jdata = 0
new_files_directio = 0
max_atomic_write = 4194304
max_readahead = 262144
lockdump_size = 131072
stall_secs = 600
complain_secs = 10
reclaim_limit = 5000
entries_per_readdir = 32
prefetch_secs = 10
statfs_slots = 64
max_mhc = 10000
greedy_default = 100
greedy_quantum = 25
greedy_max = 250
rgrp_try_threshold = 100
statfs_fast = 0
 
2、参数调整
[root@node1 ~]# gfs_tool settune /var/www/html atime_quantum 86400
#调整文件atime(访问时间)更新频率,默认gfs每小时更新一次,ext3文件系统是每访问一次atime时间更新一次
#重启生效要求:参数调整需写入到自启动脚本/etc/rc.d/rc.local中
 
[root@node1 ~]# gfs_tool settune /var/www/html statfs_fast 1
#开启文件系统状态快速查询功能,要消耗系统资源。
#开启自启动,须写入到/etc/init.d/gfs脚本中,写入到/etc/rc.d/rc.local中不生效。
 
十、GFS Quotas(磁盘配额)
1、开启quotas支持
[root@node1 ~]# gfs_tool settune /var/www/html quota_enforce = 1 
 
[root@node1 ~]# gfs_tool settune /var/www/html quota_account = 1
 
#开启配额,系统挂载前开启,自启动须写入到/etc/fstab中
 
2、配置GFS磁盘配额信息更新频率
[root@node1 ~]# gfs_tool settune /var/www/html quota_quantum 60
#Quotas并不会每次写入磁盘都更新,默认每60s检查一次Quota信息
 
[root@node1 ~]# gfs_tool settune /var/www/html quota_scale 1
#计数器,默认为1
 
3、配置quota限制
限制级别:
limit:硬限制,数量量不可超过limit限制。
warn:软限制,数量量可超过warm限制,给出警告信息。
 
[root@node1 ~]# gfs_quota limit -l 80m -u netsword -f /var/www/html
#硬限制80M
 
[root@node1 ~]# gfs_quota warn -l 50m -u netsword -f /var/www/html  
 #软限制50M
[root@node1 ~]# gfs_quota get -u netsword -f /var/www/html
user    netsword:  limit: 80.0       warn: 50.0       value: 0.0 
#查看限制信息
 
[root@node1 ~]# chmod -R 777 /var/www/html
[root@node1 ~]# su - netsword
[netsword@node1 ~]$ cd /var/www/html
 
[netsword@node1 html]$ dd if=/dev/zero of=test bs=1M count=40
40+0 records in
40+0 records out
41943040 bytes (42 MB) copied, 0.0895091 seconds, 469 MB/s
#未超过任何限制
 
[netsword@node1 html]$ dd if=/dev/zero of=test1 bs=1M count=20
GFS: fsid=cluster8:gfslv01.2: quota warning for user 500
20+0 records in
20+0 records out
20971520 bytes (21 MB) copied, 0.0525222 seconds, 399 MB/s
#超过warn限制,给出警告信息
 
[netsword@node1 html]$ dd if=/dev/zero of=test2 bs=1M count=30
GFS: fsid=cluster8:gfslv01.2: quota warning for user 500
GFS: fsid=cluster8:gfslv01.2: quota exceeded for user 500
dd: 写入 “test2”: 超出磁盘限额
21+0 records in
20+0 records out
20971520 bytes (21 MB) copied, 0.128903 seconds, 163 MB/s
#超过limit限制,给出警告信息,并限制所有数据量不超过limit
 
十一、GFS直接IO配置( GFS Direct I/O)
1、GFS Direct I/O:它是一个文件系统的属性,直接哪个应用存贮设备进行读和写,所谓直接就是绕过操作系统去读写cache的内容,提高磁盘性能,更费资源
 
2、Direct I/O应用于一个文 件或目录上的三种方式
   应用程序直接支持:O_DIRECT
   GFS文件属性
   GFS目录属性
 
3、对文件的direct io设置(意义不大)
[root@node1 html]# touch file1
 
[root@node1 html]# gfs_tool setflag directio /var/www/html/file1
#对文件开启directio
 
[root@node1 html]# gfs_tool clearflag directio /var/www/html/file1
#清除directio
 
4、对目录的direct io设置
[root@node1 html]# gfs_tool setflag inherit_directio /var/www/html
#开启目录directo io,须用inherit_directio
 
[root@node1 html]# gfs_tool stat /var/www/html | grep directio
  inherit_directio
#查看状态
 
[root@node1 html]# gfs_tool clearflag inherit_directio /var/www/html
 
十二、Data Journaling数据日志
1、数据日志
    gfs通常是先把元数据写到日志里,文件内容是由内核周期性的刷新文件系统的buffers后再写到磁盘的,内核是通过调用fsync()来完成把文件写到disk的,Data journaling能减少fsync()调用的时间,所以比直接把文件写到一个主文件系统里快,Data journaling能自动为一个gfs文件系统的目录和文件设置jdata attribute属性,即使是零长度的文件,当然也可以清处
 
2、对文件设置数据日志
[root@node1 html]# gfs_tool setflag jdata file
 
[root@node1 html]# gfs_tool clearflag jdata file
 
3、对目录设置数据日志
[root@node1 html]# gfs_tool setflag inherit_jdata /var/www/html
 
[root@node1 html]# gfs_tool stat /var/www/html | grep jdata
  jdata
  inherit_jdata
 
[root@node1 html]# gfs_tool clearflag inherit_jdata /var/www/html

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/22717.html