[Blog recommendations] MariaDB10.0 instance deployment and multi-source replication configuration (1)

Source: Internet
Author: User
Tags percona

[Blog recommendations] MariaDB10.0 instance deployment and multi-source replication configuration (1)

This blog post is from the Bkjia blog Master Wang Weibo. If you have any questions, please go to the blog homepage for an interactive discussion!

Blog: http://wangtianfa.blog.51cto.com/5281093/1621797

1. Deploy MariaDB10.0.17

1. Download and briefly describe MariaDB

Currently, MariaDB supports multi-source replication of version 10.0. The latest stable version is 10.0.17. The download link is http://mirrors.opencas.cn/mariadb/mariadb-10.0.17/source/mariadb-10.0.17.tar.gz. MariaDB and PerconaDB introduce the thread pool and disable NUMA concept in the new version of 5.5, which improves database performance a lot, while MySQL version 5.5.23 (seems to be) this concept is also available in the above versions, but it is a feature of the Enterprise Edition. This feature is not available in the open-source version. In MariaDB10, a new feature is multi-source replication, it is useful for some special scenarios, such as sharding tables for data summarization.

Note: There are a lot of attractive points in the new version, but the pitfalls have not been fully mined. If there are problems, it is difficult to find materials and solve the problems, therefore, we do not recommend that you use the latest version in the production environment. Currently, MySQL, PerconaDB, and MariaDB mainstream versions are 5.5. If you do not have special requirements, 5.5 is sufficient. Aside from the thread pool, 5.6 may not be better than 5.5 in terms of overall performance.

2. installation and deployment of MariaDB

MariaDB is basically the same as MySQL and Percona. Versions later than 5.5 are compiled and installed using cmake:

 
 
  1. #tar –zxfmariadb-10.0.17.tar.gz 
  2.  
  3. #cdmariadb-10.0.17 
  4.  
  5. #cmake .-DCMAKE_INSTALL_PREFIX=/data/percona/ -DMYSQL_DATADIR=/data/percona/data-DSYSCONFDIR=/data/percona/etc -DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DMYSQL_UNIX_ADDR=/data/percona/tmp/mysql.sock -DENABLED_LOCAL_INFILE=ON-DENABLED_PROFILING=ON -DWITH_DEBUG=0 -DMYSQL_TCP_PORT=3306 
  6.  
  7. #make&& make install 

3. configuration file of MariaDB

This configuration file applies to PerconaDB, removing the thread pool and NAMA parameters, and also applies to MySQL:

 
 
  1. [Client]
  2.  
  3. Port = 3306
  4.  
  5. Socket =/data/mariadb/tmp/mysql. sock
  6.  
  7. Default-character-set = utf8
  8.  
  9. [Mysqld]
  10.  
  11. Port = 3306
  12.  
  13. Bind-address = 0.0.0.0
  14.  
  15. Lower_case_table_names = 1
  16.  
  17. Basedir =/data/mariadb
  18.  
  19. Datadir =/data/mariadb/data
  20.  
  21. Tmpdir =/data/mariadb/tmp
  22.  
  23. Socket =/data/mariadb/tmp/mysql. sock
  24.  
  25. #######################################
  26.  
  27. Log-output = FILE
  28.  
  29. Log-error =/data/mariadb/log/error. log
  30.  
  31. # General_log
  32.  
  33. General_log_file =/data/mariadb/log/mysql. log
  34.  
  35. Pid-file =/data/mariadb/data/mysql. pid
  36.  
  37. Slow-query-log
  38.  
  39. Slow_query_log_file =/data/mariadb/log/slow. log
  40.  
  41. Tmpdir =/data/mariadb/tmp/
  42.  
  43. Long_query_time = 0.1.
  44.  
  45. # Max_statement_time = 1000 # It automatically kills slow SQL statements that exceed 1 s. PerconaDB5.6 is supported and is not recommended. If you use it to communicate with the business side, it is recommended to use it dynamically in special circumstances, the default value is 0.
  46.  
  47. Sync_binlog = 1
  48.  
  49. Skip-external-locking
  50.  
  51. Skip-name-resolve
  52.  
  53. Default-storage-engine = INNODB
  54.  
  55. Character-set-server = utf8
  56.  
  57. Wait_timeout = 28400
  58.  
  59. Back_log = 1024
  60.  
  61. #########################
  62.  
  63. Thread_concurrency = 16
  64.  
  65. Thread _ cache_size = 512
  66.  
  67. Table_open_cache = 16384
  68.  
  69. Table_definition_cached = 16384
  70.  
  71. Sort_buffer_size = 2 M
  72.  
  73. Join_buffer_size = 2 M
  74.  
  75. Read_buffer_size = 4 M
  76.  
  77. Read_rnd_buffer_size = 4 M
  78.  
  79. Key_buffer_size = 64 M
  80.  
  81. Myisam_sort_buffer_size = 64 M
  82.  
  83. Tmp_table_size = 256 M
  84.  
  85. Max_heap_table_size = 256 M
  86.  
  87. Open_files_limit = 65535
  88.  
  89. ##### Network ######################
  90.  
  91. Max_allowed_packet = 16 M
  92.  
  93. Interactive_timeout = 28400
  94.  
  95. Wait_timeout = 28400
  96.  
  97. Max-connections = 1000
  98.  
  99. Max_user_connections = 0
  100.  
  101. Max_connect_errorrs = 100
  102.  
  103. ###### Repl #####################
  104.  
  105. Server-id = 1
  106.  
  107. Report-host = 172.16.183.56
  108.  
  109. Log-bin = mysql-bin
  110.  
  111. Binlog_format = mixed
  112.  
  113. Expire_logs_days = 7
  114.  
  115. Relay-log = relay-log
  116.  
  117. # Replicate-wild-do-table = zabbix. %
  118.  
  119. # Replicate-wild-do-table = zabbix_server. %
  120.  
  121. Replicate_wild_ignore_table = mysql. %
  122.  
  123. Replicate_wild_ignore_table = test. %
  124.  
  125. Log_slave_updates
  126.  
  127. Skip-slave-start
  128.  
  129. # Slave-net-timeout = 10
  130.  
  131. # Rpl_semi_sync_master_enabled = 1
  132.  
  133. # Rpl_semi_sync_master_wait_no_slave = 1
  134.  
  135. # Rpl_semi_sync_master_timeout = 1000
  136.  
  137. # Rpl_semi_sync_slave_enabled = 1
  138.  
  139. Relay_log_recovery = 1
  140.  
  141. ##### Innodb ###########
  142.  
  143. Innodb_data_home_dir =/data/mariadb/data
  144.  
  145. Innodb_data_file_path = ibdata1: 2G; ibdata2: 2G: autoextend
  146.  
  147. Innodb_autoextend_increment = 500
  148.  
  149. Innodb_log_group_home_dir =/data/mariadb/data
  150.  
  151. Innodb_buffer_pool_size = 8G
  152.  
  153. Innodb_buffer_pool_dump_at_shutdown = 1
  154.  
  155. Innodb_buffer_pool_load_at_startup = 1
  156.  
  157. Innodb_buffer_pool_instances = 8
  158.  
  159. Innodb_additional_mem_pool_size = 128 M
  160.  
  161. Innodb_log_files_in_group = 3
  162.  
  163. Innodb_log_file_size = 512 M
  164.  
  165. Innodb_log_buffer_size = 8 M
  166.  
  167. Innodb_flush_log_at_trx_commit = 1
  168.  
  169. Innodb_lock_wait_timeout = 120
  170.  
  171. Innodb_flush_method = O_DIRECT
  172.  
  173. Innodb_max_dirty_pages_pct = 75
  174.  
  175. Innodb_io_capacity = 1000
  176.  
  177. Innodb_thread_concurrency = 0
  178.  
  179. Innodb_thread_sleep_delay= 500
  180.  
  181. Innodb_concurrency_tickets = 1000
  182.  
  183. Innodb_open_files = 65535
  184.  
  185. Innodb_file_per_table = 1
  186.  
  187. ######### Thread pool, which demonstrates outstanding database performance under high concurrency and high load ##
  188.  
  189. Thread_handling = pool-of-threads
  190.  
  191. ###### NUMA #########################
  192.  
  193. Innodb_buffer_pool_populate = 1
  194.  
  195. ##################################
  196.  
  197. [Mysqldump]
  198.  
  199. Quick
  200.  
  201. Max_allowed_packet = 16 M
  202.  
  203. [Mysql]
  204.  
  205. No-auto-rehash
  206.  
  207. Default-character-set = utf8
  208.  
  209. [Myisamchk]
  210.  
  211. Key_buffer_size = 256 M
  212.  
  213. Sort_buffer_size = 256 M
  214.  
  215. Read_buffer = 2 M
  216.  
  217. Write_buffer = 2 M
  218.  
  219. [Mysqld_safe]
  220.  
  221. ###### Closed numa ###########
  222.  
  223. Flush_caches
  224.  
  225. Numa_interleave
  226.  
  227. [Mysqlhotcopy]
  228.  
  229. Interactive_timeout = 28400

4. Database initialization and startup

The database initialization and startup scripts are as follows:

 
 
  1. #/Data/mariadb/scripts/mysql_install_db -- basedir =/data/mariadb -- datadir =/data/mariadb/data -- defaults-file =/data/mariadb/etc/my. cnf -- user = mysql
  2.  
  3. #/Data/mariadb/bin/mysqld_safe -- defaults-file =/data/mariadb/etc/my. cnf -- user = mysql &
  4.  
  5. # Echo "/data/mariadb/bin/mysqld_safe -- defaults-file =/data/mariadb/etc/my. cnf -- user = mysql & ">/etc/rc. local # Add to system startup Item


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.