【问题标题】:Mysql Stopping on My VpsMysql 在我的 Vps 上停止
【发布时间】:2014-08-17 16:36:00
【问题描述】:

您好,我遇到了 mysql 问题。我已移至具有相同配置的新 droplet。但今天我在第一个站点遇到了这个问题:

http://i.imgur.com/YJ87wSV.png

在我的第二个站点中,有时它会将我重定向到 wp-admin/install 并在该页面上给出错误太多的指示。另一个问题 mysql 停止没有任何错误。在我重新启动 mysql 后,这些问题修复为 while ,但在那之后仍然发生。我不知道是什么原因造成的。我需要重新启动 mysql 来解决这些问题,但这不是解决方案。大约 1 2 小时后仍然出现同样的问题。

我在数字海洋的 vps 5$ plan.1 cpu , 512 mb ram , centos 6.5 , apache , mysql , nginx, cpanel.Just 2 wordpress sites in it. 请帮我永久解决这个问题。

etc/my.conf

[mysqld]
default-storage-engine=MyISAM
innodb_file_per_table=1
innodb_buffer_pool_size=60817408
max_allowed_packet=268435456

我的 htop ss:http://i.imgur.com/tyzzbFn.png

MySQL Version 5.5.37-cll x86_64

Uptime = 0 days 0 hrs 0 min 6 sec
Avg. qps = 2
Total Questions = 15
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 36 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 1
Historic threads_per_sec = 3
Threads created per/sec are overrunning threads cached
You should raise thread_cache_size

MAX CONNECTIONS
Current max_connections = 300
Current threads_connected = 1
Historic max_used_connections = 1
The number of used connections is 0% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 4 M
Current InnoDB data space = 3 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 16 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 42 M
Configured Max Per-thread Buffers : 825 M
Configured Max Global Buffers : 40 M
Configured Max Memory Limit : 865 M
Physical Memory : 490 M

Max memory limit exceeds 90% of physical memory

KEY BUFFER
No key reads?!
Seriously look into using some indexes
Current MyISAM index space = 393 K
Current key_buffer_size = 8 M
Key cache miss rate is 1 : 0
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is supported but not enabled
Perhaps you should set the query_cache_size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
No sort operations have been performed
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 4096 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 400 tables
Current table_definition_cache = 400 tables
You have a total of 234 tables
You have 234 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 279 temp tables, 11% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 10 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 294
Your table locking seems to be fine

【问题讨论】:

  • 除了 php 错误日志之外,您是否有要检查的 mysql 错误日志?似乎有些东西正在停用 innodb 存储引擎,但 wordpress 并不真的需要 innodb,所以我最好的猜测是 Sabai 框架正在超载您的 mysql 服务。你确定你有 innodb 引擎在运行吗?您可以在 phpmyadmin 或控制台中使用 show engines 命令验证这一点。
  • 我不久前禁用并删除了该插件。但仍然出现错误。MySQL 出现故障。
  • 好的,show engine 命令怎么样?你能监控mysql中打开了多少个连接吗?
  • 这里是mysql显示引擎输出prntscr.com/4dqo1x
  • 好吧,你没有运行 innodb,所以你可能想从你的 my.conf 中注释 innodb 参数。您确定 sambai 插件已正确禁用和删除吗?你能确认它没有留下自定义表格吗?

标签: mysql wordpress vps


【解决方案1】:

具有半 GB RAM 的微型虚拟机根本不足以同时处理 MySQL 守护程序和 Web 服务器。您需要在 VM 中获得更多 RAM 或拆分 Web 服务器和 MySQL 服务器。

许多每月 5 美元的共享主机计划提供单独的共享 MySQL 服务器,并且运行良好。

【讨论】:

  • 所以你是说我的内存导致了这些问题?
  • 我不同意。在扩展到生产服务器之前,您应该在小型服务器中进行设计。此外,通过高估您的基础架构需求来解决软件瓶颈是一个坏主意。
【解决方案2】:

有一个插件需要 INNODB。启用它。这个链接可以帮助How to enable INNODB in mysql

【讨论】:

  • 但是重启mysql后,我的网站就正常了?
  • 这取决于那个插件,可能你需要重新安装它。它应该有点像 sabaiframework!
  • 是的。但是我的其他网站 - 没有安装任何 sabai 插件 - 也出现错误。我在上面写过..
  • 我认为启用 INNODB 是值得的。因为它,你有一个例外,如果没有它,可能会出现问题。在尝试复杂的解决方案之前,我宁愿尝试修复可见的异常。
【解决方案3】:

如果您查看服务器日志,您可能会看到 MySQL 被 OOM(内存不足)管理器杀死。这很可能发生,因为在任何类型的负载下,Apache 都会启动子进程。您最好的短期解决方案可能是限制 Apache 工作人员的数量。您最好的长期解决方案是在具有足够 RAM 的服务器上运行,供两个系统处理您遇到的负载。

【讨论】:

  • 我是 linux 新手。你能告诉我更具体的细节,我在哪里可以找到这些日志以及导致这些问题的原因?
  • @mrblithe /var/log/messages 可能。谷歌“调整 Apache”和“调整 MySQL”作为起点。
  • 我添加了 mysql tunner 报告。你能检查一下吗?
猜你喜欢
  • 2018-10-05
  • 2012-11-16
  • 2010-12-07
  • 2018-12-02
  • 2019-10-09
  • 2020-09-21
  • 2015-06-05
  • 2015-09-08
  • 1970-01-01
相关资源
最近更新 更多