您的位置:首页 > 运维架构 > Linux

清除Linux OS 缓存

2015-12-23 17:27 726 查看
1.查看内存使用情况

[root@ip-172-31-25-243 tpch_2_17_0]# free -m
total       used       free     shared    buffers     cached
Mem:         34304      34142        162          0         39      20890
-/+ buffers/cache:      13211      21092
Swap:            0          0          0


m代表以MB为单位,显示OS缓存为20890MB

2.释放前最好sync一下,防止丢数据

[root@ip-172-31-25-243 tpch_2_17_0]# sync


3.清除缓存

[root@ip-172-31-25-243 tpch_2_17_0]# echo 1 > /proc/sys/vm/drop_caches


4.查看效果

[root@ip-172-31-25-243 tpch_2_17_0]# free -m
total       used       free     shared    buffers     cached
Mem:         34304      13168      21135          0          1        541
-/+ buffers/cache:      12626      21678
Swap:            0          0          0


可以看到此时缓存大小减少为541MB
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: