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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
云数据库 RDS MySQL Serverless,价值2615元额度,1个月
简介:
1.数据库配置
  [mysqld]
key_buffer = 512M
max_allowed_packet = 64M
table_cache = 512
sort_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 2M
myisam_sort_buffer_size = 64M
tmp_table_size = 128M
query_cache_size = 96M
query_cache_type = 1
thread_cache_size = 8
max_connections = 400
wait_timeout = 300
   2.innodb
#innodb_data_home_dir = C:\mysql\data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:\mysql\data/
#innodb_log_arch_dir = C:\mysql\data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
   example1:
innodb_additional_mem_pool_size = 16M
innodb_log_buffer_size = 8M
innodb_log_file_size = 512M
innodb_log_files_in_group = 2
innodb_buffer_pool_size = 3G
innodb_data_file_path = ibdata1:3G;ibdata2:1G:autoextend
innodb_autoextend_increment=512


  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.分离读写数据库,然后主从同步,是一个很好的选择。


最新内容请见作者的GitHub页:http://qaseven.github.io/

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
1天前
|
负载均衡 关系型数据库 MySQL
MySQL读写分离技术深度解析
在高并发、大数据量的互联网应用环境中,数据库作为数据存储的核心组件,其性能直接影响着整个系统的运行效率。MySQL作为最常用的开源关系型数据库之一,虽然功能强大,但在处理大量并发读写请求时,单点服务器的性能瓶颈逐渐显现。为了解决这一问题,MySQL读写分离技术应运而生,成为提升数据库性能、实现负载均衡的有效手段。
|
1天前
|
关系型数据库 MySQL 数据库
docker MySQL删除数据库时的错误(errno: 39)
docker MySQL删除数据库时的错误(errno: 39)
|
1天前
|
关系型数据库 MySQL 数据库连接
用Navicat备份Mysql演示系统数据库的时候出:Too Many Connections
用Navicat备份Mysql演示系统数据库的时候出:Too Many Connections
|
2天前
|
负载均衡 关系型数据库 MySQL
关系型数据库的安装和配置数据库节点
关系型数据库的安装和配置数据库节点
12 3
|
3天前
|
存储 Oracle 关系型数据库
oracle 数据库 迁移 mysql数据库
将 Oracle 数据库迁移到 MySQL 是一项复杂的任务,因为这两种数据库管理系统具有不同的架构、语法和功能。
15 0
|
5天前
|
SQL 存储 负载均衡
关系型数据库读写分离与主从复制
关系型数据库读写分离与主从复制
20 5
|
10天前
|
关系型数据库 MySQL Linux
【MySQL-10】数据库函数-案例演示【字符串/数值/日期/流程控制函数】(代码演示&可cv代码)
【MySQL-10】数据库函数-案例演示【字符串/数值/日期/流程控制函数】(代码演示&可cv代码)
【MySQL-10】数据库函数-案例演示【字符串/数值/日期/流程控制函数】(代码演示&可cv代码)
|
10天前
|
SQL 关系型数据库 MySQL
【MySQL-5】DDL的数据库操作:查询&创建&删除&使用(可cv代码+演示图)
【MySQL-5】DDL的数据库操作:查询&创建&删除&使用(可cv代码+演示图)
|
10天前
|
SQL 关系型数据库 MySQL
【MySQL-1】理解关系型数据库&数据的数据模型
【MySQL-1】理解关系型数据库&数据的数据模型
|
11天前
|
关系型数据库 MySQL 数据库
Docker数据库Mysql
Docker数据库Mysql