关闭

Magento数据库配置选项,以及mysql 读写分离

发表于:2013-12-31 10:15

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:terry_water    来源:51Testing软件测试网采编

  example2:
# Run a 64-bit operating system. Do not exceed 2GB memory for the following
# combination on 32-bit systems:
# innodb_buffer_pool_size + key_buffer_size + max_connections*(sort_buffer_size +
# read_buffer_size + binlog_cache_size) + max_connections*2MB
# On dedicated db server assign up to 80% of free memory to innodb buffer
# On combined web/db server take into account apache instances and php
innodb_buffer_pool_size         = 768M  #Data Page Memory Buffer
# Table metadata requires 2-16M, Magento only has abt 330 tables
innodb_additional_mem_pool_size = 2M    #Data Dictionary < 16M
# SHOW GLOBAL STATUS Innodb_log_waits should be 0 or the next setting
# innodb_log_file_size is too small. Holds changed data for lazy write to
# innodb database. To change size, database must be flushed to disk, database
# backed up, mysqld server must be downed, log files renamed, change
# my.cnf and mysqld brought back up. Log files will be recreated in
# proper number and size
innodb_log_file_size            = 100M  #Transaction Log up to 1/4 Buffer Pool
#innodb_log_files_in_group      = 2     #Default is 2
# Buffer for transactions to be written to log file
innodb_log_buffer_size          = 2M    #Transaction Memory Buffer 1-8M
#Recommended (2xcores)+disks, KEEP LOW < 16 More is not better tune for
#best performance
innodb_thread_concurrency       = 3
#Set this up before you install Magento. Create primary innodb table at 2GB
#and secondary autoextend table for growth
#Changing this after you've gone live requires eliminating the ibdata files and log files
innodb_data_file_path = ibdata1:2048M;ibdata2:50M:autoextend
#Amount to add on autoextend. Keep this large to keep blocks in file contiguous
innodb_autoextend_increment = 512M
  3.mysql读写分离配置
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[]]></password>
<dbname><![CDATA[mg_wailian]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
<default_read>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[]]></password>
<dbname><![CDATA[mg_wailian]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_read>
</resources>
  3.分离读写数据库,然后主从同步,是一个很好的选择。
22/2<12
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号