全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 4163|回复: 11

[nginx] 谁给个优化好的512以上的my.cnf啊

[复制链接]
发表于 2010-3-19 03:27:51 | 显示全部楼层 |阅读模式
天啊所有的一键包都是针对128优化的。。。。限制的死死的对于菜鸟的我来说太难了。。。谁给个配置好的512-1g的配置文件啊

评分

参与人数 2威望 +18 收起 理由
半岛传媒 + 3
咯拉无米 + 15 我很赞同

查看全部评分

发表于 2010-3-19 06:02:56 | 显示全部楼层
同求
发表于 2010-3-19 08:21:11 | 显示全部楼层
一起支持同求
发表于 2010-3-19 08:42:00 | 显示全部楼层
发表于 2010-3-19 09:39:02 | 显示全部楼层

回复 1# 的帖子

新版本已经添加简易的增加多站点脚本了,命令是: ./host.sh
你去看看吧

mysql优化还是靠自己的,128的优化只是优化内存小点,而不是优化性能的
发表于 2010-3-19 09:39:49 | 显示全部楼层

这个是mysql默认的512配置文件

  1. # Example MySQL config file for large systems.
  2. #
  3. # This is for a large system with memory = 512M where the system runs mainly
  4. # MySQL.
  5. #
  6. # You can copy this file to
  7. # /etc/my.cnf to set global options,
  8. # mysql-data-dir/my.cnf to set server-specific options (in this
  9. # installation this directory is /usr/local/mysql/var) or
  10. # ~/.my.cnf to set user-specific options.
  11. #
  12. # In this file, you can use all long options that a program supports.
  13. # If you want to know which options a program supports, run the program
  14. # with the "--help" option.

  15. # The following options will be passed to all MySQL clients
  16. [client]
  17. #password        = your_password
  18. port                = 3306
  19. socket                = /tmp/mysql.sock

  20. # Here follows entries for some specific programs

  21. # The MySQL server
  22. [mysqld]
  23. port                = 3306
  24. socket                = /tmp/mysql.sock
  25. skip-locking
  26. key_buffer_size = 256M
  27. max_allowed_packet = 1M
  28. table_open_cache = 256
  29. sort_buffer_size = 1M
  30. read_buffer_size = 1M
  31. read_rnd_buffer_size = 4M
  32. myisam_sort_buffer_size = 64M
  33. thread_cache_size = 8
  34. query_cache_size= 16M
  35. # Try number of CPU's*2 for thread_concurrency
  36. thread_concurrency = 8

  37. # Don't listen on a TCP/IP port at all. This can be a security enhancement,
  38. # if all processes that need to connect to mysqld run on the same host.
  39. # All interaction with mysqld must be made via Unix sockets or named pipes.
  40. # Note that using this option without enabling named pipes on Windows
  41. # (via the "enable-named-pipe" option) will render mysqld useless!
  42. #
  43. #skip-networking

  44. # Replication Master Server (default)
  45. # binary logging is required for replication
  46. log-bin=mysql-bin

  47. # binary logging format - mixed recommended
  48. binlog_format=mixed

  49. # required unique id between 1 and 2^32 - 1
  50. # defaults to 1 if master-host is not set
  51. # but will not function as a master if omitted
  52. server-id        = 1

  53. # Replication Slave (comment out master section to use this)
  54. #
  55. # To configure this host as a replication slave, you can choose between
  56. # two methods :
  57. #
  58. # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
  59. #    the syntax is:
  60. #
  61. #    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
  62. #    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
  63. #
  64. #    where you replace <host>, <user>, <password> by quoted strings and
  65. #    <port> by the master's port number (3306 by default).
  66. #
  67. #    Example:
  68. #
  69. #    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
  70. #    MASTER_USER='joe', MASTER_PASSWORD='secret';
  71. #
  72. # OR
  73. #
  74. # 2) Set the variables below. However, in case you choose this method, then
  75. #    start replication for the first time (even unsuccessfully, for example
  76. #    if you mistyped the password in master-password and the slave fails to
  77. #    connect), the slave will create a master.info file, and any later
  78. #    change in this file to the variables' values below will be ignored and
  79. #    overridden by the content of the master.info file, unless you shutdown
  80. #    the slave server, delete master.info and restart the slaver server.
  81. #    For that reason, you may want to leave the lines below untouched
  82. #    (commented) and instead use CHANGE MASTER TO (see above)
  83. #
  84. # required unique id between 2 and 2^32 - 1
  85. # (and different from the master)
  86. # defaults to 2 if master-host is set
  87. # but will not function as a slave if omitted
  88. #server-id       = 2
  89. #
  90. # The replication master for this slave - required
  91. #master-host     =   <hostname>
  92. #
  93. # The username the slave will use for authentication when connecting
  94. # to the master - required
  95. #master-user     =   <username>
  96. #
  97. # The password the slave will authenticate with when connecting to
  98. # the master - required
  99. #master-password =   <password>
  100. #
  101. # The port the master is listening on.
  102. # optional - defaults to 3306
  103. #master-port     =  <port>
  104. #
  105. # binary logging - not required for slaves, but recommended
  106. #log-bin=mysql-bin

  107. # Point the following paths to different dedicated disks
  108. #tmpdir                = /tmp/               
  109. #log-update         = /path-to-dedicated-directory/hostname

  110. # Uncomment the following if you are using InnoDB tables
  111. #innodb_data_home_dir = /usr/local/mysql/var/
  112. #innodb_data_file_path = ibdata1:10M:autoextend
  113. #innodb_log_group_home_dir = /usr/local/mysql/var/
  114. # You can set .._buffer_pool_size up to 50 - 80 %
  115. # of RAM but beware of setting memory usage too high
  116. #innodb_buffer_pool_size = 256M
  117. #innodb_additional_mem_pool_size = 20M
  118. # Set .._log_file_size to 25 % of buffer pool size
  119. #innodb_log_file_size = 64M
  120. #innodb_log_buffer_size = 8M
  121. #innodb_flush_log_at_trx_commit = 1
  122. #innodb_lock_wait_timeout = 50

  123. [mysqldump]
  124. quick
  125. max_allowed_packet = 16M

  126. [mysql]
  127. no-auto-rehash
  128. # Remove the next comment character if you are not familiar with SQL
  129. #safe-updates

  130. [myisamchk]
  131. key_buffer_size = 128M
  132. sort_buffer_size = 128M
  133. read_buffer = 2M
  134. write_buffer = 2M

  135. [mysqlhotcopy]
  136. interactive-timeout
复制代码
发表于 2010-3-19 11:43:22 | 显示全部楼层
楼主 修改这2个位置,就好明显了:

# The MySQL server
[mysqld]
skip-locking
key_buffer_size = 256M
table_open_cache = 256

我256M的,keyburffersize我设置是4M (小内存好多设置成16k,差别太大)
table这个,我设置成64,应该来说64足够了

这样弄下来,内存占用还不错,而且性能也OK,楼主可以细细调节以上2个参数,慢慢看看对网站影响大不大
发表于 2010-3-19 12:39:26 | 显示全部楼层
直接用默认的 share/mysql/my-medium.cnf

覆盖到 /etc/my.cnf 下

应该行..
发表于 2010-3-19 13:36:13 | 显示全部楼层
  1. [client]
  2. character-set-server = utf8
  3. port    = 3306
  4. socket  = /tmp/mysql.sock

  5. [mysqld]
  6. character-set-server = utf8
  7. replicate-ignore-db = mysql
  8. replicate-ignore-db = test
  9. replicate-ignore-db = information_schema
  10. user    = mysql
  11. port    = 3306
  12. socket  = /tmp/mysql.sock
  13. basedir = /usr/local/webserver/mysql
  14. datadir = /data0/mysql/3306/data
  15. log-error = /data0/mysql/3306/mysql_error.log
  16. pid-file = /data0/mysql/3306/mysql.pid
  17. open_files_limit    = 10240
  18. back_log = 600
  19. max_connections = 5000
  20. max_connect_errors = 6000
  21. table_cache = 614
  22. external-locking = FALSE
  23. max_allowed_packet = 32M
  24. sort_buffer_size = 1M
  25. join_buffer_size = 1M
  26. thread_cache_size = 300
  27. thread_concurrency = 8
  28. query_cache_size = 512M
  29. query_cache_limit = 2M
  30. query_cache_min_res_unit = 2k
  31. default-storage-engine = MyISAM
  32. thread_stack = 192K
  33. transaction_isolation = READ-COMMITTED
  34. tmp_table_size = 246M
  35. max_heap_table_size = 246M
  36. long_query_time = 3
  37. log-slave-updates
  38. log-bin = /data0/mysql/3306/binlog/binlog
  39. binlog_cache_size = 4M
  40. binlog_format = MIXED
  41. max_binlog_cache_size = 8M
  42. max_binlog_size = 1G
  43. relay-log-index = /data0/mysql/3306/relaylog/relaylog
  44. relay-log-info-file = /data0/mysql/3306/relaylog/relaylog
  45. relay-log = /data0/mysql/3306/relaylog/relaylog
  46. expire_logs_days = 30
  47. key_buffer_size = 256M
  48. read_buffer_size = 1M
  49. read_rnd_buffer_size = 16M
  50. bulk_insert_buffer_size = 64M
  51. myisam_sort_buffer_size = 128M
  52. myisam_max_sort_file_size = 10G
  53. myisam_repair_threads = 1
  54. myisam_recover

  55. interactive_timeout = 120
  56. wait_timeout = 120

  57. skip-name-resolve
  58. master-connect-retry = 10
  59. slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

  60. #master-host     =   192.168.1.2
  61. #master-user     =   username
  62. #master-password =   password
  63. #master-port     =  3306

  64. server-id = 1

  65. innodb_additional_mem_pool_size = 16M
  66. innodb_buffer_pool_size = 512M
  67. innodb_data_file_path = ibdata1:256M:autoextend
  68. innodb_file_io_threads = 4
  69. innodb_thread_concurrency = 8
  70. innodb_flush_log_at_trx_commit = 2
  71. innodb_log_buffer_size = 16M
  72. innodb_log_file_size = 128M
  73. innodb_log_files_in_group = 3
  74. innodb_max_dirty_pages_pct = 90
  75. innodb_lock_wait_timeout = 120
  76. innodb_file_per_table = 0

  77. #log-slow-queries = /data0/mysql/3306/slow.log
  78. #long_query_time = 10

  79. [mysqldump]
  80. quick
  81. max_allowed_packet = 32M
复制代码
张宴的.
有些需要自己修改.
发表于 2010-3-19 13:45:40 | 显示全部楼层
这玩意太复杂,等你们搞定先。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-6 18:55 , Processed in 0.066670 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表