V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
roustar31
V2EX  ›  MySQL

MySQL 占用大量资源,导致负载高达 65

  •  
  •   roustar31 · 2015-08-29 21:04:50 +08:00 · 475 次点击
    这是一个创建于 3163 天前的主题,其中的信息可能已经有所发展或是发生改变。
    双核 2G 内存, MySQL 经常占用 180%以上的 CPU 资源,导致系统负载奔 70 。站点直接 502 。
    http://www.repaik.com/mysql.jpg
    (imgur 上传老是出错,翻墙都不行)
    以下是我的 My.conf 配置,求大神分析:

    [client]
    port = 3306
    socket = /tmp/mysql.sock
    [mysqld]
    port = 3306
    socket = /tmp/mysql.sock
    skip-external-locking
    skip-networking
    loose-skip-innodb
    key_buffer_size = 256M
    max_allowed_packet = 1M
    table_open_cache = 256
    sort_buffer_size = 1M
    read_buffer_size = 1M
    read_rnd_buffer_size = 4M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size= 16M
    thread_concurrency = 8
    max_connections = 400
    wait_timeout = 30
    interactive_timeout = 30
    max_connect_errors = 9
    long_query_time = 1
    tmp_table_size = 16M
    #log-bin=mysql-bin
    #binlog_format=mixed
    #server-id = 1
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [mysql]
    no-auto-rehash
    [myisamchk]
    key_buffer_size = 128M
    sort_buffer_size = 128M
    read_buffer = 2M
    write_buffer = 2M
    [mysqlhotcopy]
    interactive-timeout
    第 1 条附言  ·  2015-09-15 10:54:00 +08:00
    感谢大家的建议,已经解决问题,主要是 discuz 市场上的某个应用存在漏洞,被人利用进行 MySQL 攻击,导致的,停用卸载后,已经解决。
    6 条回复    2015-09-09 11:36:32 +08:00
    jhdxr
        1
    jhdxr  
       2015-08-29 22:38:12 +08:00   ❤️ 1
    卡的时候 show full processlist 看看,顺便开个慢日志。我估计你是有的表索引没做好
    dreamtrail
        2
    dreamtrail  
       2015-08-29 23:09:00 +08:00   ❤️ 1
    虽然配置有点低,但一般都是表结构没设计好
    roustar31
        3
    roustar31  
    OP
       2015-08-30 06:32:20 +08:00
    @jhdxr 昨晚我把配置升级为 4 核 4G 后,貌似好了,但那是 22 点以后,估计访问量降低了的缘故也不一定。
    今天晚上高峰期再看看
    roustar31
        4
    roustar31  
    OP
       2015-08-30 06:33:40 +08:00
    @dreamtrail discuz X3.2 的论坛,数据库大约为 1.3GB ,需要做什么优化措施吗?
    leakeung
        5
    leakeung  
       2015-09-03 12:04:17 +08:00
    @roustar31 看了你论坛 最近变动的一些说明
    个人建议可以尝试 Tengine 引擎+ SSD
    如果是长期发展,需要对 discuz X3.2 进行升级改造处理....
    realpg
        6
    realpg  
       2015-09-09 11:36:32 +08:00
    1.3GB 的 DB 我怎么觉得已经不适合原装 discuz 了……
    而且还是个这么低配置的 VPS 跑

    把旧数据拆出去放一个独立站跑吧……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   970 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 22:16 · PVG 06:16 · LAX 15:16 · JFK 18:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.