当前位置:首页 > MySQL

MY SQL configuration

canca14年前 (2013-06-10)MySQL740

ASK:

We have a database Server Configuration:
4GB RAM
600GB Hard Disk
Xeon Processor 1.3 Ghz.

We are barely able to have 100 concurrent users!!! What are we doing wrong.

I know I need to configure mysql_query cache, mysql_limit_size and table_cache. But what should be the formula, and how do we go about checking the same.

Below is the details of our my.ini file.

[mysqld]
datadir=/database/data
socket=/var/lib/mysql/mysql.sock
set-variable=max_connections=2000
set-variable = max_allowed_packet=64M
default-storage-engine = innodb
log-bin=/database/data/mysql-bin

old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Answer:

Try this configuration and read my comments inside it

#you really don't need more than 200 connections
max_connections = 200  

#this can be safely reduced to 32 or even 16M if you have few (0-20) or small (<1gb total) databases
key_buffer = 128M 

myisam_sort_buffer_size = 32M
join_buffer_size = 2M
read_buffer_size = 1M
sort_buffer_size = 8M

#use total number of database tables +20%  (ALL databases) - if you just have a single drupal database 100-150 will be enough
table_cache = 2000 

thread_cache_size = 32
wait_timeout = 3600
connect_timeout = 4
tmp_table_size = 64M
max_heap_table_size = 64M
max_allowed_packet = 64M
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M

#if you get a long query selecting a lot of data you might want to increase this
query_cache_limit = 32M

#play with this until you get 80% cache filled after mysql server has been running for 24h+, if this is a dedicated database server you can go nuts with this up to 70% of RAM, but it there is no queries to be cached this will be pretty useless. Better stay under 512M and use rest for memcached
query_cache_size = 96M

query_cache_type = 1
query_prealloc_size = 65536
query_alloc_block_size = 131072
open_files_limit = 8196

key_buffer_size         = 64M
thread_stack            = 128K

add the rest of the config (user, pid, passwords, etc) from you current configuration

If you can't handle it on your own, or need someone to fine tune the settings let me know - I'll have a look.


Refer:https://groups.drupal.org/node/13844

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/140.html

标签: MySQL
分享给朋友:

“MY SQL configuration” 的相关文章

MySql导入SQL文件

MySql导入SQL文件: mysql -u root -p <c:\sampledb.sql…

MySQl字段类型

MySQL支持大量的列类型,它可以被分为3类:数字类型、日期和时间类型以及字符串(字符)类型。本节首先给出可用类型的一个概述,并且总结每个列类型的存储需求,然后提供每个类中的类型性质的更详细的描述。概述有意简化,…

MySQL建立远程登陆用户

如果你想连接你的mysql的时候发生这个错误: ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server 解决方法: 1. 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要…

MySQL数据库备份与还原

MySQL数据库备份与还原

       平时工作中常常会遇到数据库备份、还原等场景,但有些服务器上不允许装前台工具,只好用命令行来操作。并且更重要的一点是:如果数据量比较大的话,借助工具来操作会非常卡,而使用命令行则无压力...…

mysql的binlog太大太多占用大量磁盘的解决

现象:网站访问越来越慢,最后无法访问了,经过检查发现磁盘满了。仔细查询下来确认是由于mysql的binlog太多太大占用了空间。 分析过程及解决方案:通常出现这种问题都应该登录服务器检查磁盘、内存和进程使用的情况,…

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。