Guest User

Untitled

a guest
Mar 11th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.44 KB | None | 0 0
  1. #BEGIN CONFIG INFO
  2. #DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
  3. #TYPE: SYSTEM
  4. #END CONFIG INFO
  5.  
  6. #
  7. # This is a MySQL example config file for systems with 4GB of memory
  8. # running mostly MySQL using InnoDB only tables and performing complex
  9. # queries with few connections.
  10. #
  11. # You can copy this file to /etc/my.cnf to set global options,
  12. # mysql-data-dir/my.cnf to set server-specific options
  13. # (/usr/local/mysql/data for this installation) or to
  14. # ~/.my.cnf to set user-specific options.
  15. #
  16. # In this file, you can use all long options that a program supports.
  17. # If you want to know which options a program supports, run the program
  18. # with the "--help" option.
  19. #
  20. # More detailed information about the individual options can also be
  21. # found in the manual.
  22. #
  23.  
  24. #
  25. # The following options will be read by MySQL client applications.
  26. # Note that only client applications shipped by MySQL are guaranteed
  27. # to read this section. If you want your own MySQL client program to
  28. # honor these values, you need to specify it as an option during the
  29. # MySQL client library initialization.
  30. #
  31. [client]
  32. #password = [your_password]
  33. port = 3306
  34. socket = /tmp/mysql.sock
  35.  
  36. # *** Application-specific options follow here ***
  37.  
  38. #
  39. # The MySQL server
  40. #
  41. [mysqld]
  42.  
  43. # generic configuration options
  44. port = 3306
  45. socket = /tmp/mysql.sock
  46.  
  47. # back_log is the number of connections the operating system can keep in
  48. # the listen queue, before the MySQL connection manager thread has
  49. # processed them. If you have a very high connection rate and experience
  50. # "connection refused" errors, you might need to increase this value.
  51. # Check your OS documentation for the maximum value of this parameter.
  52. # Attempting to set back_log higher than your operating system limit
  53. # will have no effect.
  54. back_log = 50
  55.  
  56. # Don't listen on a TCP/IP port at all. This can be a security
  57. # enhancement, if all processes that need to connect to mysqld run
  58. # on the same host. All interaction with mysqld must be made via Unix
  59. # sockets or named pipes.
  60. # Note that using this option without enabling named pipes on Windows
  61. # (via the "enable-named-pipe" option) will render mysqld useless!
  62. #skip-networking
  63.  
  64. bind-address = 0.0.0.0
  65.  
  66. # The maximum amount of concurrent sessions the MySQL server will
  67. # allow. One of these connections will be reserved for a user with
  68. # SUPER privileges to allow the administrator to login even if the
  69. # connection limit has been reached.
  70. max_connections = 100
  71.  
  72. # Maximum amount of errors allowed per host. If this limit is reached,
  73. # the host will be blocked from connecting to the MySQL server until
  74. # "FLUSH HOSTS" has been run or the server was restarted. Invalid
  75. # passwords and other errors during the connect phase result in
  76. # increasing this value. See the "Aborted_connects" status variable for
  77. # global counter.
  78. max_connect_errors = 10
  79.  
  80. # The number of open tables for all threads. Increasing this value
  81. # increases the number of file descriptors that mysqld requires.
  82. # Therefore you have to make sure to set the amount of open files
  83. # allowed to at least 4096 in the variable "open-files-limit" in
  84. # section [mysqld_safe]
  85. table_cache = 2048
  86.  
  87. # Enable external file level locking. Enabled file locking will have a
  88. # negative impact on performance, so only use it in case you have
  89. # multiple database instances running on the same files (note some
  90. # restrictions still apply!) or if you use other software relying on
  91. # locking MyISAM tables on file level.
  92. #external-locking
  93.  
  94. # The maximum size of a query packet the server can handle as well as
  95. # maximum query size server can process (Important when working with
  96. # large BLOBs). enlarged dynamically, for each connection.
  97. max_allowed_packet = 16M
  98.  
  99. # The size of the cache to hold the SQL statements for the binary log
  100. # during a transaction. If you often use big, multi-statement
  101. # transactions you can increase this value to get more performance. All
  102. # statements from transactions are buffered in the binary log cache and
  103. # are being written to the binary log at once after the COMMIT. If the
  104. # transaction is larger than this value, temporary file on disk is used
  105. # instead. This buffer is allocated per connection on first update
  106. # statement in transaction
  107. binlog_cache_size = 1M
  108.  
  109. # Maximum allowed size for a single HEAP (in memory) table. This option
  110. # is a protection against the accidential creation of a very large HEAP
  111. # table which could otherwise use up all memory resources.
  112. max_heap_table_size = 64M
  113.  
  114. # Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
  115. # queries. If sorted data does not fit into the sort buffer, a disk
  116. # based merge sort is used instead - See the "Sort_merge_passes"
  117. # status variable. Allocated per thread if sort is needed.
  118. sort_buffer_size = 8M
  119.  
  120. # This buffer is used for the optimization of full JOINs (JOINs without
  121. # indexes). Such JOINs are very bad for performance in most cases
  122. # anyway, but setting this variable to a large value reduces the
  123. # performance impact. See the "Select_full_join" status variable for a
  124. # count of full JOINs. Allocated per thread if full join is found
  125. join_buffer_size = 8M
  126.  
  127. # How many threads we should keep in a cache for reuse. When a client
  128. # disconnects, the client's threads are put in the cache if there aren't
  129. # more than thread_cache_size threads from before. This greatly reduces
  130. # the amount of thread creations needed if you have a lot of new
  131. # connections. (Normally this doesn't give a notable performance
  132. # improvement if you have a good thread implementation.)
  133. thread_cache_size = 8
  134.  
  135. # This permits the application to give the threads system a hint for the
  136. # desired number of threads that should be run at the same time. This
  137. # value only makes sense on systems that support the thread_concurrency()
  138. # function call (Sun Solaris, for example).
  139. # You should try [number of CPUs]*(2..4) for thread_concurrency
  140. thread_concurrency = 8
  141.  
  142. # Query cache is used to cache SELECT results and later return them
  143. # without actual executing the same query once again. Having the query
  144. # cache enabled may result in significant speed improvements, if your
  145. # have a lot of identical queries and rarely changing tables. See the
  146. # "Qcache_lowmem_prunes" status variable to check if the current value
  147. # is high enough for your load.
  148. # Note: In case your tables change very often or if your queries are
  149. # textually different every time, the query cache may result in a
  150. # slowdown instead of a performance improvement.
  151. query_cache_size = 64M
  152.  
  153. # Only cache result sets that are smaller than this limit. This is to
  154. # protect the query cache of a very large result set overwriting all
  155. # other query results.
  156. query_cache_limit = 2M
  157.  
  158. # Minimum word length to be indexed by the full text search index.
  159. # You might wish to decrease it if you need to search for shorter words.
  160. # Note that you need to rebuild your FULLTEXT index, after you have
  161. # modified this value.
  162. ft_min_word_len = 4
  163.  
  164. # If your system supports the memlock() function call, you might want to
  165. # enable this option while running MySQL to keep it locked in memory and
  166. # to avoid potential swapping out in case of high memory pressure. Good
  167. # for performance.
  168. #memlock
  169.  
  170. # Table type which is used by default when creating new tables, if not
  171. # specified differently during the CREATE TABLE statement.
  172. default_table_type = MYISAM
  173.  
  174. # Thread stack size to use. This amount of memory is always reserved at
  175. # connection time. MySQL itself usually needs no more than 64K of
  176. # memory, while if you use your own stack hungry UDF functions or your
  177. # OS requires more stack for some operations, you might need to set this
  178. # to a higher value.
  179. thread_stack = 192K
  180.  
  181. # Set the default transaction isolation level. Levels available are:
  182. # READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
  183. transaction_isolation = REPEATABLE-READ
  184.  
  185. # Maximum size for internal (in-memory) temporary tables. If a table
  186. # grows larger than this value, it is automatically converted to disk
  187. # based table This limitation is for a single table. There can be many
  188. # of them.
  189. tmp_table_size = 64M
  190.  
  191. # Enable binary logging. This is required for acting as a MASTER in a
  192. # replication configuration. You also need the binary log if you need
  193. # the ability to do point in time recovery from your latest backup.
  194. log-bin=mysql-bin
  195.  
  196. # If you're using replication with chained slaves (A->B->C), you need to
  197. # enable this option on server B. It enables logging of updates done by
  198. # the slave thread into the slave's binary log.
  199. #log_slave_updates
  200.  
  201. # Enable the full query log. Every query (even ones with incorrect
  202. # syntax) that the server receives will be logged. This is useful for
  203. # debugging, it is usually disabled in production use.
  204. #log
  205.  
  206. # Print warnings to the error log file. If you have any problem with
  207. # MySQL you should enable logging of warnings and examine the error log
  208. # for possible explanations.
  209. #log_warnings
  210.  
  211. # Log slow queries. Slow queries are queries which take more than the
  212. # amount of time defined in "long_query_time" or which do not use
  213. # indexes well, if log_long_format is enabled. It is normally good idea
  214. # to have this turned on if you frequently add new queries to the
  215. # system.
  216. log_slow_queries
  217.  
  218. # All queries taking more than this amount of time (in seconds) will be
  219. # trated as slow. Do not use "1" as a value here, as this will result in
  220. # even very fast queries being logged from time to time (as MySQL
  221. # currently measures time with second accuracy only).
  222. long_query_time = 2
  223.  
  224. # Log more information in the slow query log. Normally it is good to
  225. # have this turned on. This will enable logging of queries that are not
  226. # using indexes in addition to long running queries.
  227. log_long_format
  228.  
  229. # The directory used by MySQL for storing temporary files. For example,
  230. # it is used to perform disk based large sorts, as well as for internal
  231. # and explicit temporary tables. It might be good to put it on a
  232. # swapfs/tmpfs filesystem, if you do not create very large temporary
  233. # files. Alternatively you can put it on dedicated disk. You can
  234. # specify multiple paths here by separating them by ";" - they will then
  235. # be used in a round-robin fashion.
  236. #tmpdir = /tmp
  237.  
  238.  
  239. # *** Replication related settings
  240.  
  241.  
  242. # Unique server identification number between 1 and 2^32-1. This value
  243. # is required for both master and slave hosts. It defaults to 1 if
  244. # "master-host" is not set, but will MySQL will not function as a master
  245. # if it is omitted.
  246. server-id = 1
  247.  
  248. # Replication Slave (comment out master section to use this)
  249. #
  250. # To configure this host as a replication slave, you can choose between
  251. # two methods :
  252. #
  253. # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
  254. # the syntax is:
  255. #
  256. # CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
  257. # MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
  258. #
  259. # where you replace <host>, <user>, <password> by quoted strings and
  260. # <port> by the master's port number (3306 by default).
  261. #
  262. # Example:
  263. #
  264. # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
  265. # MASTER_USER='joe', MASTER_PASSWORD='secret';
  266. #
  267. # OR
  268. #
  269. # 2) Set the variables below. However, in case you choose this method, then
  270. # start replication for the first time (even unsuccessfully, for example
  271. # if you mistyped the password in master-password and the slave fails to
  272. # connect), the slave will create a master.info file, and any later
  273. # changes in this file to the variable values below will be ignored and
  274. # overridden by the content of the master.info file, unless you shutdown
  275. # the slave server, delete master.info and restart the slaver server.
  276. # For that reason, you may want to leave the lines below untouched
  277. # (commented) and instead use CHANGE MASTER TO (see above)
  278. #
  279. # required unique id between 2 and 2^32 - 1
  280. # (and different from the master)
  281. # defaults to 2 if master-host is set
  282. # but will not function as a slave if omitted
  283. #server-id = 2
  284. #
  285. # The replication master for this slave - required
  286. #master-host = <hostname>
  287. #
  288. # The username the slave will use for authentication when connecting
  289. # to the master - required
  290. #master-user = <username>
  291. #
  292. # The password the slave will authenticate with when connecting to
  293. # the master - required
  294. #master-password = <password>
  295. #
  296. # The port the master is listening on.
  297. # optional - defaults to 3306
  298. #master-port = <port>
  299.  
  300. # Make the slave read-only. Only users with the SUPER privilege and the
  301. # replication slave thread will be able to modify data on it. You can
  302. # use this to ensure that no applications will accidently modify data on
  303. # the slave instead of the master
  304. #read_only
  305.  
  306.  
  307. #*** MyISAM Specific options
  308.  
  309.  
  310. # Size of the Key Buffer, used to cache index blocks for MyISAM tables.
  311. # Do not set it larger than 30% of your available memory, as some memory
  312. # is also required by the OS to cache rows. Even if you're not using
  313. # MyISAM tables, you should still set it to 8-64M as it will also be
  314. # used for internal temporary disk tables.
  315. key_buffer_size = 32M
  316.  
  317. # Size of the buffer used for doing full table scans of MyISAM tables.
  318. # Allocated per thread, if a full scan is needed.
  319. read_buffer_size = 2M
  320.  
  321. # When reading rows in sorted order after a sort, the rows are read
  322. # through this buffer to avoid disk seeks. You can improve ORDER BY
  323. # performance a lot, if set this to a high value.
  324. # Allocated per thread, when needed.
  325. read_rnd_buffer_size = 16M
  326.  
  327. # MyISAM uses special tree-like cache to make bulk inserts (that is,
  328. # INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
  329. # INFILE) faster. This variable limits the size of the cache tree in
  330. # bytes per thread. Setting it to 0 will disable this optimisation. Do
  331. # not set it larger than "key_buffer_size" for optimal performance.
  332. # This buffer is allocated when a bulk insert is detected.
  333. bulk_insert_buffer_size = 64M
  334.  
  335. # This buffer is allocated when MySQL needs to rebuild the index in
  336. # REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
  337. # into an empty table. It is allocated per thread so be careful with
  338. # large settings.
  339. myisam_sort_buffer_size = 128M
  340.  
  341. # The maximum size of the temporary file MySQL is allowed to use while
  342. # recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
  343. # If the file-size would be bigger than this, the index will be created
  344. # through the key cache (which is slower).
  345. myisam_max_sort_file_size = 10G
  346.  
  347. # If the temporary file used for fast index creation would be bigger
  348. # than using the key cache by the amount specified here, then prefer the
  349. # key cache method. This is mainly used to force long character keys in
  350. # large tables to use the slower key cache method to create the index.
  351. myisam_max_extra_sort_file_size = 10G
  352.  
  353. # If a table has more than one index, MyISAM can use more than one
  354. # thread to repair them by sorting in parallel. This makes sense if you
  355. # have multiple CPUs and plenty of memory.
  356. myisam_repair_threads = 1
  357.  
  358. # Automatically check and repair not properly closed MyISAM tables.
  359. myisam_recover
  360.  
  361.  
  362. # *** BDB Specific options ***
  363.  
  364. # Use this option if you run a MySQL server with BDB support enabled but
  365. # you do not plan to use it. This will save memory and may speed up some
  366. # things.
  367. skip-bdb
  368.  
  369.  
  370. # *** INNODB Specific options ***
  371.  
  372. # Use this option if you have a MySQL server with InnoDB support enabled
  373. # but you do not plan to use it. This will save memory and disk space
  374. # and speed up some things.
  375. #skip-innodb
  376.  
  377. # Additional memory pool that is used by InnoDB to store metadata
  378. # information. If InnoDB requires more memory for this purpose it will
  379. # start to allocate it from the OS. As this is fast enough on most
  380. # recent operating systems, you normally do not need to change this
  381. # value. SHOW INNODB STATUS will display the current amount used.
  382. innodb_additional_mem_pool_size = 16M
  383.  
  384. # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
  385. # row data. The bigger you set this the less disk I/O is needed to
  386. # access data in tables. On a dedicated database server you may set this
  387. # parameter up to 80% of the machine physical memory size. Do not set it
  388. # too large, though, because competition of the physical memory may
  389. # cause paging in the operating system. Note that on 32bit systems you
  390. # might be limited to 2-3.5G of user level memory per process, so do not
  391. # set it too high.
  392. innodb_buffer_pool_size = 512M
  393.  
  394. # InnoDB stores data in one or more data files forming the tablespace.
  395. # If you have a single logical drive for your data, a single
  396. # autoextending file would be good enough. In other cases, a single file
  397. # per device is often a good choice. You can configure InnoDB to use raw
  398. # disk partitions as well - please refer to the manual for more info
  399. # about this.
  400. innodb_data_file_path = ibdata1:10M:autoextend
  401.  
  402. # Set this option if you would like the InnoDB tablespace files to be
  403. # stored in another location. By default this is the MySQL datadir.
  404. #innodb_data_home_dir = <directory>
  405.  
  406. # Number of IO threads to use for async IO operations. This value is
  407. # hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
  408. # larger number.
  409. innodb_file_io_threads = 4
  410.  
  411. # If you run into InnoDB tablespace corruption, setting this to a nonzero
  412. # value will likely help you to dump your tables. Start from value 1 and
  413. # increase it until you're able to dump the table successfully.
  414. #innodb_force_recovery=1
  415.  
  416. # Number of threads allowed inside the InnoDB kernel. The optimal value
  417. # depends highly on the application, hardware as well as the OS
  418. # scheduler properties. A too high value may lead to thread thrashing.
  419. innodb_thread_concurrency = 16
  420.  
  421. # If set to 1, InnoDB will flush (fsync) the transaction logs to the
  422. # disk at each commit, which offers full ACID behavior. If you are
  423. # willing to compromise this safety, and you are running small
  424. # transactions, you may set this to 0 or 2 to reduce disk I/O to the
  425. # logs. Value 0 means that the log is only written to the log file and
  426. # the log file flushed to disk approximately once per second. Value 2
  427. # means the log is written to the log file at each commit, but the log
  428. # file is only flushed to disk approximately once per second.
  429. innodb_flush_log_at_trx_commit = 1
  430.  
  431. # Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
  432. # and insert buffer merge on shutdown. It may increase shutdown time a
  433. # lot, but InnoDB will have to do it on the next startup instead.
  434. #innodb_fast_shutdown
  435.  
  436. # The size of the buffer InnoDB uses for buffering log data. As soon as
  437. # it is full, InnoDB will have to flush it to disk. As it is flushed
  438. # once per second anyway, it does not make sense to have it very large
  439. # (even with long transactions).
  440. innodb_log_buffer_size = 8M
  441.  
  442. # Size of each log file in a log group. You should set the combined size
  443. # of log files to about 25%-100% of your buffer pool size to avoid
  444. # unneeded buffer pool flush activity on log file overwrite. However,
  445. # note that a larger logfile size will increase the time needed for the
  446. # recovery process.
  447. innodb_log_file_size = 256M
  448.  
  449. # Total number of files in the log group. A value of 2-3 is usually good
  450. # enough.
  451. innodb_log_files_in_group = 3
  452.  
  453. # Location of the InnoDB log files. Default is the MySQL datadir. You
  454. # may wish to point it to a dedicated hard drive or a RAID1 volume for
  455. # improved performance
  456. #innodb_log_group_home_dir
  457.  
  458. # Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
  459. # If it is reached, InnoDB will start flushing them out agressively to
  460. # not run out of clean pages at all. This is a soft limit, not
  461. # guaranteed to be held.
  462. innodb_max_dirty_pages_pct = 90
  463.  
  464. # The flush method InnoDB will use for Log. The tablespace always uses
  465. # doublewrite flush logic. The default value is "fdatasync", another
  466. # option is "O_DSYNC".
  467. #innodb_flush_method=O_DSYNC
  468.  
  469. # How long an InnoDB transaction should wait for a lock to be granted
  470. # before being rolled back. InnoDB automatically detects transaction
  471. # deadlocks in its own lock table and rolls back the transaction. If you
  472. # use the LOCK TABLES command, or other transaction-safe storage engines
  473. # than InnoDB in the same transaction, then a deadlock may arise which
  474. # InnoDB cannot notice. In cases like this the timeout is useful to
  475. # resolve the situation.
  476. innodb_lock_wait_timeout = 120
  477.  
  478.  
  479. [mysqldump]
  480. # Do not buffer the whole result set in memory before writing it to
  481. # file. Required for dumping very large tables
  482. quick
  483.  
  484. max_allowed_packet = 16M
  485.  
  486. [mysql]
  487. no-auto-rehash
  488.  
  489. # Only allow UPDATEs and DELETEs that use keys.
  490. #safe-updates
  491.  
  492. [isamchk]
  493. key_buffer = 512M
  494. sort_buffer_size = 512M
  495. read_buffer = 8M
  496. write_buffer = 8M
  497.  
  498. [myisamchk]
  499. key_buffer = 512M
  500. sort_buffer_size = 512M
  501. read_buffer = 8M
  502. write_buffer = 8M
  503.  
  504. [mysqlhotcopy]
  505. interactive-timeout
  506.  
  507. [mysqld_safe]
  508. # Increase the amount of open files allowed per process. Warning: Make
  509. # sure you have set the global system limit high enough! The high value
  510. # is required for a large number of opened tables
  511. open-files-limit = 8192
Add Comment
Please, Sign In to add comment