我正在尝试使用Drush到Drupal 7站点进行数据库更新,只需几个节点和85个模块......由于更新几乎每次都很明显,对于带有512MB的VPS容器化服务(mysql,nginx,php-fpm等),没有足够的内存......
每当MySQL被内核杀死时,我可以从日志中理解:
内存不足:杀死进程4310(mysqld)
我的问题是,如何配置MySQL服务以避免“刺杀”? MySQL配置文件中有哪些参数可以降低mysqld进程的内存消耗?
我在DEV中,所以我不介意这个过程是否变慢。我只是想知道我需要调整哪些参数才能在不增加内存的情况下继续更新过程。
感谢您的帮助。
答案 0 :(得分:5)
只需要:
[mysqld]
performance_schema = off
答案 1 :(得分:2)
有几十个这样的参数,您可以在mysql server system variables文档中找到所有参数和详细说明。通常,查找其中包含单词size
的变量。特别是,请查看innodb_buffer_pool_size
,因为默认值为128MB,专用服务器上的建议值为物理内存的80%。
答案 2 :(得分:2)
此配置在VPS 512M上为我工作,希望这有帮助...
private void dataGridView1_CellValidating(object sender,
DataGridViewCellValidatingEventArgs e)
{
string headerText =
dataGridView1.Columns[e.ColumnIndex].HeaderText;
// Abort validation if cell is not in the target column.
// The target column is the column you want to validate
if (!headerText.Equals("TargetColumn")) return;
// Confirm that the cell is not empty.
if (string.IsNullOrEmpty(e.FormattedValue.ToString()))
{
dataGridView1.Rows[e.RowIndex].ErrorText =
"Your error message goes here.";
e.Cancel = true;
}
}
答案 3 :(得分:1)
你的VM有一个小到512MB的内存?你正在运行多个东西(Drupal,MySQL)?你很幸运能让它完全运作。这些设置可能足以缩小MySQL以便运行:
key_buffer_size = 5M
innodb_buffer_pool_size = 60M
同时,不要增加my.cnf中的任何值。如果我的建议不够;让我们看看你所有的my.cnf;可能还有其他事情可以合理地减少。
您正在运行哪个版本的MySQL?
答案 4 :(得分:1)
我在Vultr的512 Mb RAM中使用Fedora 29和MariaDB进行配置。使用大约26%的RAM。
[mysqld]
performance_schema = off
key_buffer_size = 16M
query_cache_size = 2M
query-cache-limit = 1M
tmp_table_size = 1M
innodb_buffer_pool_size = 1M
innodb_log_buffer_size = 1M
max_connections = 25
sort_buffer_size = 512M
read_buffer_size = 256K
read_rnd_buffer_size = 512K
join_buffer_size = 128K
thread_stack = 196K
在小型VPS中,请不要忘记启用交换功能。例如,在Vultr中,默认值为不交换。在数字海洋中也是如此。