mysql export导致swap报警

最近有一台服务器每到凌晨就报swap < 60%



定位一下代码中每天到这个时间会执行一下这个操作,导出一些数据库数据到文件,大小约1G左右

String exportCmd = "/usr/bin/mysql --safe-update=false -h"
                + dbHost
                + " -P"
                + dbPort
                + " -u"
                + dbUserName
                + " -p"
                + dbPassword
                + " --default-character-set=utf8 "
                + database
                + " -e \""
                + export_sql
                + "\" >"
                + Configuration.getIOSFilePath();

每次导出导致内存使用量上升且一段时间不能释放,加上 --quick参数,好了

If you have problems due to insufficient memory for large result sets, use the --quick option. This forces mysql to retrieve results from the server a
       row at a time rather than retrieving the entire result set and buffering it in memory before displaying it. This is done by returning the result set
       using the mysql_use_result() C API function in the client/server library rather than mysql_store_result().



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值