Advertisement
Guest User

Untitled

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