› 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 · Aug 29, 2015 · 1318 views
    This topic created in 4068 days ago, the information mentioned may be changed or developed.
    双核 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
    Supplement 1  ·  Sep 15, 2015
    感谢大家的建议,已经解决问题,主要是 discuz 市场上的某个应用存在漏洞,被人利用进行 MySQL 攻击,导致的,停用卸载后,已经解决。
    6 replies  •  2015-09-09 11:36:32 +08:00
    jhdxr
        1
    jhdxr  
       Aug 29, 2015   ❤️ 1
    卡的时候 show full processlist 看看,顺便开个慢日志。我估计你是有的表索引没做好
    dreamtrail
        2
    dreamtrail  
       Aug 29, 2015   ❤️ 1
    虽然配置有点低,但一般都是表结构没设计好
    roustar31
        3
    roustar31  
    OP
       Aug 30, 2015
    @jhdxr 昨晚我把配置升级为 4 核 4G 后,貌似好了,但那是 22 点以后,估计访问量降低了的缘故也不一定。
    今天晚上高峰期再看看
    roustar31
        4
    roustar31  
    OP
       Aug 30, 2015
    @dreamtrail discuz X3.2 的论坛,数据库大约为 1.3GB ,需要做什么优化措施吗?
    leakeung
        5
    leakeung  
       Sep 3, 2015
    @roustar31 看了你论坛 最近变动的一些说明
    个人建议可以尝试 Tengine 引擎+ SSD
    如果是长期发展,需要对 discuz X3.2 进行升级改造处理....
    realpg
        6
    realpg  
       Sep 9, 2015
    1.3GB 的 DB 我怎么觉得已经不适合原装 discuz 了……
    而且还是个这么低配置的 VPS 跑

    把旧数据拆出去放一个独立站跑吧……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5620 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 08:22 · PVG 16:22 · LAX 01:22 · JFK 04:22
    ♥ Do have faith in what you're doing.