mysql 主从配置

近期部分机器要求做主从,之前都是每天定时全备份,但是影响到线上服务。所以对部分活跃的服务器做了主从,解决mysql备份的时候导致玩家卡壳问题。

slave 物理机,多实例,一台物理机基本开到6个实例。

master配置文件  my.cnf

[client]

port = 3306

socket = /log/mysql/mysql.sock

[mysqld]

skip-name-resolve = ON

port = 3306

#bind-address    = 127.0.0.1

log-error        = /log/mysql/mysqld.log

pid-file         = /log/mysql/mysqld.pid

socket           = /log/mysql/mysql.sock

datadir          = /data/mysql

slow-query_log   = ON

slow_query_log_file   = /log/mysql/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 1

log-bin         = /data/bin_log/3306/mysql-bin-3306

max_binlog_size = 256M

log-slave-updates = 0

expire_logs     = 7

binlog_format   = "MIXED"

innodb_buffer_pool_size = 8G

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql

innodb_log_group_home_dir = /data/mysql

innodb_open_files = 65535

[mysqldump]

quick

max_allowed_packet = 64M

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

[mysqld_safe]

open-files-limit = 65535

pid-file         = /log/mysqlmysqld.pid

slave配置文件  my.cnf

[client]

port = 3306

#socket = /log/mysql/mysql.sock

[mysqld_multi]

mysqld = /app/mysql/bin/mysqld_safe

mysqladmin = /app/mysql/bin/mysqladmin

log = /log/mysql/mysqld_multi.log

user = admin

password = admin

[mysqld3306]

skip-name-resolve = ON

port = 3306

#bind-address    = 127.0.0.1

basedir          = /app/mysql

log-error        = /log/mysql/3306/mysqld.log

pid-file         = /log/mysql/3306/mysqld.pid

socket           = /log/mysql/3306/mysql.sock

datadir          = /data/mysql/3306

slow-query_log   = ON

slow_query_log_file   = /log/mysql/3306/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 2

replicate-wild-ignore-table=mysql.%

#log-bin         = /data/mysql/3306/bin-log/mysql-bin-3306

#max_binlog_size = 256M

#binlog_cache_size       = 128k

#binlog-ignore           = mysql

#log-slave-updates = 0

#expire_logs     = 7

#binlog_format   = "MIXED"

innodb_buffer_pool_size = 2048M

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql/3306

innodb_log_group_home_dir = /data/mysql/3306

innodb_open_files = 65535

innodb_file_per_table = 1

[mysqld3307]

skip-name-resolve = ON

port = 3307

#bind-address    = 127.0.0.1

basedir          = /app/mysql

log-error        = /log/mysql/3307/mysqld.log

pid-file         = /log/mysql/3307/mysqld.pid

socket           = /log/mysql/3307/mysql.sock

datadir          = /data/mysql/3307

slow-query_log   = ON

slow_query_log_file   = /log/mysql/3307/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 2

replicate-wild-ignore-table=mysql.%

#log-bin         = /data/mysql/3307/bin-log/mysql-bin-3307

#max_binlog_size = 256M

#binlog_cache_size       = 128k

#binlog-ignore           = mysql

#log-slave-updates = 0

#expire_logs     = 7

#binlog_format   = "MIXED"

innodb_buffer_pool_size = 2048M

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql/3307

innodb_log_group_home_dir = /data/mysql/3307

innodb_open_files = 65535

innodb_file_per_table = 1

[mysqld3308]

skip-name-resolve = ON

port = 3308

#bind-address    = 127.0.0.1

basedir          = /app/mysql

log-error        = /log/mysql/3308/mysqld.log

pid-file         = /log/mysql/3308/mysqld.pid

socket           = /log/mysql/3308/mysql.sock

datadir          = /data/mysql/3308

slow-query_log   = ON

slow_query_log_file   = /log/mysql/3308/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 2

replicate-wild-ignore-table=mysql.%

#log-bin         = /data/mysql/3306/bin-log/mysql-bin-3306

#max_binlog_size = 256M

#binlog_cache_size       = 128k

#binlog-ignore           = mysql

#log-slave-updates = 0

#expire_logs     = 7

#binlog_format   = "MIXED"

innodb_buffer_pool_size = 2048M

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql/3308

innodb_log_group_home_dir = /data/mysql/3308

innodb_open_files = 65535

innodb_file_per_table = 1

[mysqld3309]

skip-name-resolve = ON

port = 3309

#bind-address    = 127.0.0.1

basedir          = /app/mysql

log-error        = /log/mysql/3309/mysqld.log

pid-file         = /log/mysql/3309/mysqld.pid

socket           = /log/mysql/3309/mysql.sock

datadir          = /data/mysql/3309

slow-query_log   = ON

slow_query_log_file   = /log/mysql/3309/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 2

replicate-wild-ignore-table=mysql.%

#log-bin         = /data/mysql/3309/bin-log/mysql-bin-3309

#max_binlog_size = 256M

#binlog_cache_size       = 128k

#binlog-ignore           = mysql

#log-slave-updates = 0

#expire_logs     = 7

#binlog_format   = "MIXED"

innodb_buffer_pool_size = 2048M

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql/3309

innodb_log_group_home_dir = /data/mysql/3309

innodb_open_files = 65535

innodb_file_per_table = 1

[mysqld3310]

skip-name-resolve = ON

port = 3310

#bind-address    = 127.0.0.1

basedir          = /app/mysql

log-error        = /log/mysql/3310/mysqld.log

pid-file         = /log/mysql/3310/mysqld.pid

socket           = /log/mysql/3310/mysql.sock

datadir          = /data/mysql/3310

slow-query_log   = ON

slow_query_log_file   = /log/mysql/3310/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 2

replicate-wild-ignore-table=mysql.%

#log-bin         = /data/mysql/3310/bin-log/mysql-bin-3310

#max_binlog_size = 256M

#binlog_cache_size       = 128k

#binlog-ignore           = mysql

#log-slave-updates = 0

#expire_logs     = 7

#binlog_format   = "MIXED"

innodb_buffer_pool_size = 2048M

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql/3310

innodb_log_group_home_dir = /data/mysql/3310

innodb_open_files = 65535

innodb_file_per_table = 1

[mysqld3311]

skip-name-resolve = ON

port = 3311

#bind-address    = 127.0.0.1

basedir          = /app/mysql

log-error        = /log/mysql/3311/mysqld.log

pid-file         = /log/mysql/3311/mysqld.pid

socket           = /log/mysql/3311/mysql.sock

datadir          = /data/mysql/3311

slow-query_log   = ON

slow_query_log_file   = /log/mysql/3311/slow.log

long_query_time = 1

back_log = 512

max_connections = 16384

max_connect_errors = 100

interactive_timeout = 86400

wait_timeout = 86400

table_cache = 65535

max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 5461

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4

memlock

thread_stack = 192K

tmp_table_size = 64M

skip-external-locking

key_buffer_size = 32M

max_allowed_packet = 16M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU‘s*2 for thread_concurrency

thread_concurrency = 8

#skip-networking

server-id       = 2

replicate-wild-ignore-table=mysql.%

#log-bin         = /data/mysql/3311/bin-log/mysql-bin-3311

#max_binlog_size = 256M

#binlog_cache_size       = 128k

#binlog-ignore           = mysql

#log-slave-updates = 0

#expire_logs     = 7

#binlog_format   = "MIXED"

innodb_buffer_pool_size = 2048M

innodb_additional_mem_pool_size = 20M

innodb_data_file_path = ibdata1:1G:autoextend

innodb_autoextend_increment = 500M

innodb_file_io_threads = 4

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_thread_concurrency = 16

innodb_data_home_dir  = /data/mysql/3311

innodb_log_group_home_dir = /data/mysql/3311

innodb_open_files = 65535

innodb_file_per_table = 1

[mysqldump]

quick

max_allowed_packet = 64M

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

[mysqld_safe]

open-files-limit = 65535

pid-file         = /log/mysqlmysqld.pid

从多实例我使用了 mysqld_multi

多实例启动脚本

#!/bin/sh

#

# A simple startup script for mysqld_multi by Tim Smith and Jani Tolonen.

# This script assumes that my.cnf file exists either in /etc/my.cnf or

# /root/.my.cnf and has groups [mysqld_multi] and [mysqldN]. See the

# mysqld_multi documentation for detailed instructions.

#

# This script can be used as /etc/init.d/mysql.server

#

# Comments to support chkconfig on RedHat Linux

# chkconfig: 2345 64 36

# description: A very fast and reliable SQL database engine.

#

# Version 1.0

#

basedir=/app/mysql

bindir=/app/mysql/bin

conf=/app/conf/mysql/my.cnf

export PATH=$PATH:$bindir

if test -x $bindir/mysqld_multi

then

mysqld_multi="$bindir/mysqld_multi";

else

echo "Can‘t execute $bindir/mysqld_multi from dir $basedir";

exit;

fi

case "$1" in

‘start‘ )

"$mysqld_multi" --defaults-extra-file=$conf start $2

;;

‘stop‘ )

"$mysqld_multi" --defaults-extra-file=$conf stop $2

;;

‘report‘ )

"$mysqld_multi" --defaults-extra-file=$conf report $2

;;

‘restart‘ )

"$mysqld_multi" --defaults-extra-file=$conf stop $2

"$mysqld_multi" --defaults-extra-file=$conf start $2

;;

*)

echo "Usage: $0 {start|stop|report|restart}" >&2

;;

esac

mysql初始化

/app/mysql/scripts/mysql_install_db --basedir=/app/mysql --datadir=/data/mysql/3311 --user=mysql

master同步用户权限设置

GRANT SUPER, REPLICATION SLAVE ON *.* TO ‘sync‘@‘%‘ IDENTIFIED BY ‘sync‘;

flush privileges;

多实例数据库关闭

grant shutdown on *.* to ‘admin‘@‘localhost‘ identified by ‘admin‘;

flush privileges;

根据master bin-log 点进行同步

CHANGE MASTER TO master_host=‘192.168.1.2‘,master_user=‘sync‘,master_password=‘sync‘,master_port=3306,master_log_file=‘mysql-bin-3306.000001‘,master_log_pos=2946738;

时间: 2024-10-18 06:39:11

mysql 主从配置的相关文章

Mysql主从配置,实现读写分离

大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库连接操作,数据库必然会崩溃,数据丢失的话,后果更是 不堪设想.这时候,我们会考虑如何减少数据库的联接,一方面采用优秀的代码框架,进行代码的优化,采用优秀的数据缓存技术如:memcached,如果资金丰厚的话,必然会想到假设服务器群,来分担主数据库的压力.Ok切入今天微博主题,利用MySQL主从配置,实现读写分离,减轻数据库压力.这种

笔记13(FTP配置、tomcat配置、resin配置、MySQL主从配置)

FTP服务搭建与配置 FTP介绍 FTP是File Transfer Protocol(文件传输协议,简称文传协议)的英文简称,用于在Internet上控制文件的双向传输. FTP的主要作用就是让用户连接一个远程计算机(这些计算机上运行着FTP服务器程序),并查看远程计算机中的文件,然后把文件从远程计算机复制到本地计算机,或把本地计算机的文件传送到远程计算机. 小公司用的多,大企业不用FTP,因为不安全. 使用vsftpd搭建ftp服务 centos上自带vsftpd 安装:yum instal

centos MySQL主从配置 第二十八节课

centos  MySQL主从配置   第二十八节课 上半节课 下半节课 f

mysql主从配置&&基于keepalived的主备切换

mysql互为主从设置 && 主备切换配置 需求说明: 1.公司架构一直是一台单独的mysql在线上跑,虽然一直没有出现什么宕机事件,但是出于一个高可用的考虑,提出主从备份.主备切换的需求: 2.实现这个需求的前一段时间只是在做数据库备份的时候实现了主从热备,为了实现主备切换功能,继续操作上述需求: 实验环境: master1:10.1.156.3:3306 master2:10.1.156.5:3306 my.cnf配置文件关于主从这块的修改: master1: server-id =

解读mysql主从配置及其原理分析(Master-Slave)

在windows下配置的,后面会在Linux下配置进行测试,需要配置mysql数据库同步的朋友可以参考下. 1.在主数据库服务器为从服务器添加一个拥有权限访问主库的用户:GRANT REPLICATION SLAVE ON *.* TO ' test'@'%' IDENTIFIED BY 'test'; (%表示允许所有IP,可设置指定从服务器IP)添加用户后:可在从服务器上用mysql -h127.0.0.1 -utest -ptest; 来测试是否有权限访问主数据库 2.在主据库配置文件加上

mysql主从配置思路

记录一下 原文:http://www.rjfw.com.cn/qamain/prevView.action?id=40482017200000031 mysql主从配置(清晰的思路) mysql主从配置.鄙人是在如下环境测试的: 主数据库所在的操作系统:win7 主数据库的版本:5.0 主数据库的ip地址:192.168.1.111 从数据库所在的操作系统:linux 从数据的版本:5.0 从数据库的ip地址:192.168.1.112 介绍完了环境,就聊聊配置步骤: 1.确保主数据库与从数据库

Mysql主从配置+读写分离

Mysql主从配置+读写分离     MySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. 注:安装前须查看是否已经安装了如下依赖包,如果没有请安装. apt-get -y install gcc g++ libncurses5-dev ncurses-devel openssl   一.主库安装及配置 1.源码安装cmake # tar xf cmake-3.0.0.tar.gz #

Linux下mysql主从配置

mysql服务器的主从配置,这样可以实现读写分离,也可以在主库挂掉后从备用库中恢复需要两台机器,安装mysql,两台机器要在相通的局域网内主机A: 192.168.1.100从机B:192.168.1.101可以有多台从机1.先登录主机 Amysql>GRANT REPLICATION SLAVE ON *.* TO ‘backup’@’192.168.1.101‘ IDENTIFIED BY ‘123456’;赋予从机权限,有多台丛机,就执行多次2. 打开主机A的my.cnf,输入server

mysql主从配置(清晰的思路)

mysql主从配置.鄙人是在如下环境测试的: 主数据库所在的操作系统:win7 主数据库的版本:5.0 主数据库的ip地址:192.168.1.111 从数据库所在的操作系统:linux 主数据的版本:5.0 主数据库的ip地址:192.168.1.112 介绍完了环境,就聊聊配置步骤: 1.确保主数据库与从数据库一模一样. 例如:主数据库里的a的数据库里有b,c,d表,那从数据库里的就应该有一个模子刻出来的a的数据库和b,c,d表 2.在主数据库上创建同步账号. GRANT REPLICATI

mysql主从配置,读写分离

Mysql主从配置,实现读写分离 大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库连接操作,数据库必然会崩溃,数据丢失的话,后果更是 不堪设想.这时候,我们会考虑如何减少数据库的联接,一方面采用优秀的代码框架,进行代码的优化,采用优秀的数据缓存技术如:memcached,如果资金丰厚的话,必然会想到假设服务器群,来分担主数据库的压力.Ok切入今天微博主题,利用MySQL主从配置,