歡迎您光臨本站 註冊首頁

線上 mysql 主庫配置文檔

←手機掃碼閱讀     火星人 @ 2014-03-08 , reply:0

伺服器配置如下:

Dell R410 XEON 5506 *2 (8核)/ 16GB memory /300G*4 raid 10

注意:需要根據伺服器實際配置情況更改相關參數.

線上 mysql 主庫配置文檔

  1. $ cat /etc/my.cnf
  2. [mysqld]
  3. port = 3306
  4. user = mysql
  5. skip-locking
  6. skip-innodb
  7. skip-name-resolve
  8. key_buffer = 1024M
  9. max_allowed_packet = 16M
  10. max_heap_table_size = 1024M
  11. max_connect_errors = 100
  12. table_cache = 4096
  13. sort_buffer_size = 128M
  14. record_buffer = 4M
  15. read_buffer_size = 8M
  16. read_rnd_buffer_size = 8M
  17. myisam_sort_buffer_size = 16M
  18. thread_cache_size = 2048
  19. query_cache_type = 1
  20. query_cache_size = 1024M
  21. query_cache_limit = 2M
  22. flush_time = 384
  23. back_log = 2048
  24. tmp_table_size = 2048M
  25. character_set_server=utf8
  26. max_connections = 1000
  27. max_user_connections = 1000
  28. interactive_timeout =20000
  29. wait_timeout=20000
  30. thread_concurrency = 8
  31. server-id = 1001
  32. tmpdir = /tmp/

參數說明,來自互聯網!

  1. 有關請求連接的變數: 有關緩衝區變數: 連接緩衝;
  2. 有關請求連接的變數:
  3. max_connections MySql的最大連接數,如果伺服器的併發連接請求量比較大,建議調高此值,以增加并行連接數量
  4. show variables like '%max_con%';
  5. -------------------- -------
  6. | Variable_name | Value |
  7. -------------------- -------
  8. | max_connect_errors | 10 |
  9. | max_connections | 151 |
  10. -------------------- -------
  11. 可以通過'conn%'通配符查看當前狀態的連接數量,以定奪該值的大小!
  12. show status like 'conn%';
  13. --------------- -------
  14. | Variable_name | Value |
  15. --------------- -------
  16. | Connections | 109 |
  17. --------------- -------
  18. back_log 是要求MySQL能有的連接數量.也就是說,如果MySql的連接數據達到max_connections時,新來的請求將會被存在堆棧中,以等待某一連接釋放資源,該堆棧的數量即back_log,如果等待連接的數量超過back_log,將不被授予連接資源
  19. show variables like '

[火星人 ] 線上 mysql 主庫配置文檔已經有375次圍觀

http://coctec.com/docs/linux/show-post-45975.html