mysql 主从/优化
时间:2010-05-19 来源:liukaiyi
编译优化 :
CFLAGS="-O3 -mpentiumpro -mstack-align-double"
CXX=gcc
CXXFLAGS="-O3 -mpentiumpro -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti"
编译:
./configure --prefix=/usr/local/mysql --enable-assembler\
--with-innodb \
--with-charset=utf8 \
--enable-thread-safe-client \
--with-collation=utf8_general_ci \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--with-collation=utf8_general_ci \
--with-extra-charsets=all \
make && make install
170 mysql 主从
my.cnf 配置 master
[mysqld]
server-id=1
binlog-do-db=同步到slave的数据库
log-bin=mysql-bin
GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.*
TO backup@'%'
IDENTIFIED BY 'pu.backup';
my.cnf 配置 slave
[mysqld]
server-id=2
master-host=10.26.5.170
master-user=backup
master-password=pu.backup
master-connect-retry=60
replicate-do-db=poweruser
系统 32G 4核 linux 5
[mysqld]
port= 3333
socket=/tmp/mysql.sock.lky
datadir=/data/db_data/mysql_data/data
basedir=/usr/local/mysql5/
log-slow-queries=/data/mysql5/var/slow.log.lky
skip-locking
key_buffer_size=1024M
max_allowed_packet=1M
table_open_cache=512
sort_buffer_size=4096M
read_buffer_size=1024M
read_rnd_buffer_size=1024M
myisam_sort_buffer_size=4096M
thread_cache_size=8
query_cache_size=1024M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=8
default-character-set=utf8
init_connect='SET NAMES utf8'
open_files_limit=4096
。。。。。
#文件 mysql
#!/bin/sh
/usr/local/mysql5/bin/mysql --defaults-file=/data/db_data/mysql_data/conf/my.cnf $1 $2 $3 $4 $5 $6 $7 $8 $9
#文件 mysql-start
#!/bin/sh
/usr/local/mysql5/bin/mysqld_safe --defaults-file=/data/db_data/mysql_data/conf/my.cnf
#文件 mysql-stop
#!/bin/sh
/usr/local/mysql5/bin/mysqladmin --defaults-file=/data/db_data/mysql_data/conf/my.cnf -uroot -pmysql shutdown
相关阅读 更多 +