mysql_slave.cnf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # For advice on how to change settings please see
  2. # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
  3. [mysql]
  4. # CLIENT #
  5. port = 3306
  6. socket =/var/lib/mysql/mysql.sock
  7. default-character-set = utf8mb4
  8. [mysqld]
  9. #
  10. # Remove leading # and set to the amount of RAM for the most important data
  11. # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
  12. # innodb_buffer_pool_size = 128M
  13. #
  14. # Remove leading # to turn on a very important data integrity option: logging
  15. # changes to the binary log between backups.
  16. log_bin=binlog
  17. binlog-do-db = test
  18. binlog-do-db = buyao
  19. binlog-ignore-db = mysql
  20. binlog-ignore-db = information_schema
  21. binlog-ignore-db = performance_schema
  22. binlog-ignore-db = sys
  23. binlog_format=ROW
  24. max_binlog_size=100M
  25. binlog_cache_size=16M
  26. max_binlog_cache_size=256M
  27. relay_log_recovery=1
  28. sync_binlog=1
  29. server-id=2
  30. read_only=1
  31. replicate-do-db = buyao
  32. replicate-do-db = test
  33. replicate-ignore-db = mysql
  34. replicate-ignore-db = information_schema
  35. replicate-ignore-db = performance_schema
  36. replicate-ignore-db = sys
  37. #
  38. # Remove leading # to set options mainly useful for reporting servers.
  39. # The server defaults are faster for transactions and fast SELECTs.
  40. # Adjust sizes as needed, experiment to find the optimal values.
  41. # join_buffer_size = 128M
  42. # sort_buffer_size = 2M
  43. # read_rnd_buffer_size = 2M
  44. datadir=/var/lib/mysql
  45. socket=/var/lib/mysql/mysql.sock
  46. # Disabling symbolic-links is recommended to prevent assorted security risks
  47. symbolic-links=0
  48. log-error=/var/log/mysqld.log
  49. pid-file=/var/run/mysqld/mysqld.pid
  50. # time zone
  51. log_timestamps=SYSTEM
  52. # PASSWORD POLICY
  53. character-set-server = utf8mb4
  54. collation-server = utf8mb4_unicode_ci
  55. init_connect='SET NAMES utf8mb4'
  56. table_open_cache = 256
  57. query_cache_size = 2M
  58. tmp_table_size = 32M
  59. thread_cache_size = 8
  60. max_connections=1000
  61. sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
  62. # INNODB #
  63. innodb-flush-method = O_DIRECT
  64. innodb-log-files-in-group = 2
  65. innodb-log-file-size = 128M
  66. innodb-flush-log-at-trx-commit = 2
  67. innodb-file-per-table = 1
  68. innodb-buffer-pool-size = 4G
  69. # SLOW-LOG #
  70. slow_query_log=ON
  71. slow_query_log_file=/srv/mysql/mysql-slow.log
  72. long_query_time=2
  73. log_queries_not_using_indexes=0
  74. [client]
  75. port=3306
  76. default-character-set=utf8mb4