MySQL������ key_buffer_size,query_cache_size,ta
ͬʱ���߷������������� ����1G�ڴ��ķ��������Ըо�����������ʱ����ÿ�춼������ ����ʱ��ʱ�ķ�������һ�� �������������������Ұ�������MySQLʹ���Ǻܾ������Ե��㷨��������ͨ�����ú��ٵ��ڴ����л���MySQL�����ı����Եõ����õ����ܡ�
8 a/ y6 g; @& D1 [+ Y9 u8 j) g) N" J) i/ n1 A0 b
��װ��mysql���������ļ�Ӧ����/usr/local/mysql/share/mysqlĿ¼�У������ļ��м�������my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf,��ͬ����������վ�Ͳ�ͬ���Ƶķ�������������Ȼ��Ҫ�в�ͬ�������ļ��ˡ� * W `% m. m- M
) U. s4 C% w, S5 B, N
һ���������£�my-medium.cnf���������ļ������������ǵĴ�����Ҫ��һ�����ǻ��������ļ�������/etc/my.cnf ֻ��Ҫ�����������ļ��Ϳ����ˣ�ʹ��mysqladmin variables extended-status �Cu root �Cp ���Կ���Ŀǰ�IJ������У������ò���������Ҫ�ģ���key_buffer_size,query_cache_size,table_cache�� �ֺ�гԵ��̳' ^) w$ V. l' W/ k( c" C, j
www.linwan.net6 Y. g6 |. ?0 P% H% l
key_buffer_sizeֻ��MyISAM�������ã�
; p3 _5 N; ?# # d. E
. B& O( j! M8 l4 W% S4 okey_buffer_sizeָ�������������Ĵ�С�������������������ٶȣ����������������ٶȡ�һ��������Ϊ16M,ʵ��������һ����վ�㡡����������ԶԶ�����ģ�ͨ������״ֵ̬Key_read_requests��Key_reads,����֪��key_buffer_size�����Ƿ�����������key_reads / key_read_requestsӦ�þ����ܵĵͣ�������1:100��1:1000���ã�����״ֵ̬����ʹ��SHOW STATUS LIKE ��key_read%�����ã��� ����������װ��phpmyadmin ����ͨ������������״̬����,�����Ƽ���phpmyadmin����mysql�����µ�״ֵ̬���DZ���ͨ��phpmyadmin���õ�ʵ������:
5 x0 ~/ w# 3 t) j9 _www.linwan.net
: k) [0 a2 Z2 X5 A! E! m% }�����������Ѿ�������20��
2 h& h: w% k* r$ n: I2 u+ K% V6 N- D���켼�������ֵ�����֮���ֺ�гԵ��̳" e% V. d( f) M, X. z; G9 W
key_buffer_size �C 128M
s7 ^2 k' ]: V6 t4 ( fwww.linwan.netkey_read_requests �C 650759289
/ B/ {# @. 5 @( H9 p���켼�������ֵ�����֮��key_reads - 79112 www.linwan.net8 Y4 v; q7 Y$ ~
���켼�������ֵ�����֮��6 O. Q; P5 O) H+ l: e8 P* ]4 a" l
�����ӽ�1:8000 ����״���dz��� ) P" h: r3 j- M& k, O ]
6 [3 Z" F* b2 z* g$ @% l$ Jwww.linwan.net����һ������key_buffer_size�İ취��������վ���ݿ���ÿ������������ռ�ռ���С�����������Դ˷�����Ϊ��:�Ƚϴ��ļ�������������������125M �������ֻ����ű������������� www.linwan.net/ n' V& i3 P, o$ T
* @" Y- b' o: c% r1 d��4.0.1��ʼ��MySQL�ṩ�˲�ѯ�������ơ�ʹ�ò�ѯ���壬MySQL��SELECT�����Ͳ�ѯ���������ڻ������У���������ͬ����SELECT���䣨���ִ�Сд������ֱ�Ӵӻ������ж�ȡ����������MySQL�û��ֲᣬʹ�ò�ѯ�����������Դﵽ238%��Ч�ʡ� �ֺ�гԵ��̳: }" M. [4 W0 X k) u( {; r
* Y- X% L9 a7 R0 }+ wͨ���������¼�����������֪��query_cache_size���õ��Ƿ�����
6 R+ h6 D- D2 A/ xwww.linwan.net
: K5 E8 h* ]" Q& ^% _www.linwan.netQcache inserts " Y' }, N& d# v2 t9 `& }0 F
Qcache hits
' ! r p8 y% S) Y; C���켼�������ֵ�����֮��Qcache lowmem prunes 7 K) ]9 S; R5 p6 M# J
Qcache free blocks
$ Q1 T. L) ]0 a/ N; y5 qwww.linwan.netQcache total blocks
- X( W& t( K4 c' _$ s4 d�ֺ�гԵ��̳# t: w' t6 l2 l8 d5 k7 E
Qcache_lowmem_prunes��ֵ�dz������������������ֻ��岻��������,ͬʱQcache_hits��ֵ�dz�������������ѯ����ʹ�÷dz�Ƶ������ʱ��Ҫ���ӻ�����СQcache_hits��ֵ���������������IJ�ѯ�ظ��ʺܵͣ�����������ʹ�ò�ѯ���巴����Ӱ��Ч�ʣ���ô���Կ��Dz��ò�ѯ���塣���⣬��SELECT�����м���SQL_NO_CACHE������ȷ��ʾ��ʹ�ò�ѯ���塣 www.linwan.net. o! ?) W3 {' j' }/ N& 2 t4 A1 |
4 |, y3 J; O! C7 TQcache_free_blocks��������ֵ�dz���������������������Ƭ�ܶ�query_cache_typeָ���Ƿ�ʹ�ò�ѯ����
3 M% F( N5 [* v$ y5 ]! |+ ?���켼�������ֵ�����֮��1 w8 L$ v: ]' M( V
������: ! y% x: l# g( `- o& ?8 Y0 m
8 }+ ]5 J. Q) P6 O% S9 uquery_cache_size = 32M www.linwan.net6 }( u; W; S( X2 m: T
query_cache_type= 1 www.linwan.net! m. m1 f# }/ y. ]
, r$ r; v0 T1 A. ~5 O0 T
�õ�����״ֵ̬: ���켼�������ֵ�����֮��% f6 ~& n, B' |/ [
+ D( O3 X2 Y# j9 Y$ {9 F
Qcache queries in cache 12737 ����Ŀǰ����������
0 g' R! Q% _( |5 x, QQcache inserts 20649006
+ ?( x" `6 H# }5 B# I/ Hwww.linwan.netQcache hits 79060095 �������ظ���ѯ�ʻ�ͦ�ߵ� $ [- Q% z7 {9 M/ f; ]5 l" m; q' [
Qcache lowmem prunes 617913������ô���γ��ֻ������͵����� : z. f+ C8 K) v; {) i2 F
Qcache not cached 189896 ���� www.linwan.net8 e ]7 m* x3 d' R+ G8 I
Qcache free memory 18573912����Ŀǰʣ����ռ� . w% a3 U% V1 a" o+ m: ^$ G
Qcache free blocks 5328 ���������ƺ��е�������Ƭ���� 1 p; u, D1 k5 e$ m
Qcache total blocks 30953 �ֺ�гԵ��̳( x1 P$ Z6 e1 S) J9 u3 e& i- K
4 g( u$ D- h; F
�����ڴ�����32MӦ��Ҫ���ϼӵ�
2 h+ e8 q7 u3 x4 }% Cwww.linwan.net
3 m# Q3 {. E* v8 btable_cacheָ�������ٻ����Ĵ�С��ÿ��MySQL����һ����ʱ�������ڱ��������л��пռ䣬�ñ��ͱ����������У��������Ը����ط��ʱ����ݡ�ͨ��������ֵʱ����״ֵ̬Open_tables��Opened_tables�����Ծ����Ƿ���Ҫ����table_cache��ֵ�������㷢��open_tables����table_cache������opened_tables�ڲ�����������ô������Ҫ����table_cache��ֵ�ˣ�����״ֵ̬����ʹ��SHOW STATUS LIKE ��Open%tables�����ã���ע�⣬����äĿ�ذ�table_cache���óɺܴ���ֵ���������õ�̫�ߣ����ܻ������ļ����������㣬�Ӷ��������ܲ��ȶ���������ʧ�ܡ� " Q H$ Y) i3 K9 U* U+ B+ a
2 x2 ?" F. O/ |& `+ p2 Mwww.linwan.net������1G�ڴ��Ļ������Ƽ�ֵ��128��256��
6 @5 S* E* R6 A0 b+ T�ֺ�гԵ��̳! N1 Q6 ^8 T: ^! z
��������table_cache = 256
' f: J- t. a- H+ h9 `
) O5 x( 4 n% K4 b+ H* e�õ�����״̬:
& V9 J; q4 $ a$ Swww.linwan.net
. P# o" g) # `$ a- `���켼�������ֵ�����֮��Open tables 256 4 ~3 A2 L- W( ?4 ?8 W1 x* A
Opened tables 9046 ���켼�������ֵ�����֮��1 {6 ~+ M. G1 ~ X3 y- u
2 l& f# f; ]( A) ~9 V- F4 F. |www.linwan.net��Ȼopen_tables�Ѿ�����table_cache�����������ڷ���������ʱ����˵,�Ѿ�������20�죬opened_tables��ֵҲ�dz��͡����ˣ�����table_cache��ֵӦ���ô�����������������6��Сʱ�ͳ�������ֵ �Ǿ�Ҫ��������table_cache��
% u( P8 s# E( a) N- x
2 Y. d% O- H+ |�����㲻��Ҫ��¼2����log �Ͱ��������ܹص���ע���ص��Ժ��Ͳ��ָܻ�������ǰ�������ˣ���Ҫ���ֶ����ݣ���������־�������и������ݵ����䣬��Ŀ�����ڻָ����ݿ�ʱ�����������ݾ����ָܻ���������״̬�����⣬������ͬ������( Replication )�Ļ���Ҳ��Ҫʹ�ö�������־������������
& R {1 c- a4 ~% X�ֺ�гԵ��̳���켼�������ֵ�����֮��1 ]1 }' ~* L7 h
log_binָ����־�ļ����������ṩ�ļ�����MySQL���Լ�����ȱʡ�ļ�����MySQL�����ļ��������Զ�������������ÿ����������ʱ��������������һ���µĶ������ļ������⣬ʹ��log-bin-index����ָ�������ļ���ʹ��binlog-do-db����ָ����¼�����ݿ⣻ʹ��binlog-ignore-db����ָ������¼�����ݿ⡣ע�����ǣ�binlog-do-db��binlog-ignore-dbһ��ָֻ��һ�����ݿ⣬ָ���������ݿ���Ҫ�������䡣���ң�MySQL�Ὣ���е����ݿ����Ƹij�Сд����ָ�����ݿ�ʱ����ȫ��ʹ��Сд���֣����������á�
8 e# l% e, m# C& f0 x0 q7 H0 A9 A# G/ ]/ }+ q
�ص���������ֻ��Ҫ����ǰ������#�� �ֺ�гԵ��̳7 e* J5 N( O) C: I/ j7 i
8 ~* v* ~! G# _�ֺ�гԵ��̳#log-bin / R( Y8 ~# |9 j
% F2 N. n; a, q9 i; t& c5 Y
��������ѯ��־( slow query log ) ����ѯ��־���ڸ����������IJ�ѯ�dz����á�����¼���в���long_query_time�IJ�ѯ��������Ҫ�������Լ�¼��ʹ�������ļ�¼��������һ������ѯ��־�����ӣ� ; H; {; A! x+ W5 u, e, t* e
+ D$ I/ A/ K/ n# P B8 Y9 vwww.linwan.net��������ѯ��־����Ҫ���ò���log_slow_queries��long_query_times��log-queries-not-using-indexes�� www.linwan.net' Z. C: F5 k7 P" m! Q7 R
( L. f6 G3 X% b5 qlog_slow_queriesָ����־�ļ����������ṩ�ļ�����MySQL���Լ�����ȱʡ�ļ�����long_query_timesָ������ѯ����ֵ��ȱʡ��10�롣log-queries-not-using-indexes��4.1.0�Ժ������IJ�������ָʾ��¼��ʹ�������IJ�ѯ����������long_query_time=10 www.linwan.net& `, J, @" ]4 I& @3 I2 m, l& G
���켼�������ֵ�����֮��) Y$ N: n. u1 x5 K4 & L! {$ ?+ s
��������:
1 e* U5 ?0 ?, V% U4 `3 }8 S3 B�ֺ�гԵ��̳' X" K2 f! e) Z# P
sort_buffer_size = 1M $ a( K3 A1 @' g+ k0 g
max_connections=120 �ֺ�гԵ��̳* T" [! e P. H* g4 h3 o' _
wait_timeout =120
* a; U7 l$ o f" c$ a$ f% Q% tback_log=100
8 ` F0 [" P+ R0 Q' J/ N���켼�������ֵ�����֮��read_buffer_size = 1M
6 d* T0 H+ R$ q8 O; Zthread_cache=32
. a, J6 q$ H% X- O, j" z" |���켼�������ֵ�����֮��interactive_timeout=120 ( m" @& X3 Z* L! R7 J0 C
thread_concurrency = 4
) m& L: N. {# |6 f4 B+ X! R�ֺ�гԵ��̳�ֺ�гԵ��̳/ {; y* n) A, t+ Y
����˵��: ���켼�������ֵ�����֮��$ `6 |% L2 [7 V: J- W( H
' K2 H* A; T: `3 @( ?' |�ֺ�гԵ��̳back_log , v/ f, t. n$ K' c: o
; K+ G C- B% f7 G1 _( L
Ҫ��MySQL���е���������������ҪMySQL�߳���һ���ܶ�ʱ���ڵõ��dz������������������������ã�Ȼ�����̻߳�Щʱ��(���ܺܶ�)�������Ӳ�������һ�����̡߳�back_logֵָ����MySQL��ʱֹͣ�ش�������֮ǰ�Ķ�ʱ���ڶ��ٸ��������Ա����ڶ�ջ�С�ֻ������������һ����ʱ�����кܶ����ӣ�����Ҫ�����������仰˵����ֵ�Ե�����TCP/IP���ӵ��������еĴ�С�����IJ���ϵͳ���������д�С�������Լ������ơ� Unix listen(2)ϵͳ���õ��ֲ�ҳӦ���и�����ϸ�ڡ���������OS�ĵ��ҳ���������������ֵ����ͼ�趨back_log�������IJ���ϵͳ�����ƽ�����Ч�ġ�
3 z$ }2 ^' ?5 T6 w: Kwww.linwan.net; a3 ^* D0 U4 q5 F" R& _
max_connections
5 g& ?& [. a$ a6 @: C1 , ^8 ] R8 z! E���켼�������ֵ�����֮��www.linwan.net. A5 {5 z1 g* ~" ?0 L
����������Ŀ������120 ��������ֵ�ͻ��Զ��ָ��������������Զ����� , g$ Z/ U7 h% A) Q3 S& G
2 i3 @- I2 u3 @ j, y8 H2 P
thread_cache �ֺ�гԵ��̳) s) S( ?4 `* D3 K; # F
, K/ t7 Q( S0 M* G+ f0 ?+ L Q�ֺ�гԵ��̳û�ҵ�����˵������������Ϊ32�� 20���Ŵ�����400�����߳� ����ǰһ���ʹ�������ǧ���߳� ���Ի������õ�
" F% x4 K+ P; g+ `4 t4 }. q: c
3 D! m- ~% H: o$ ~: c9 j; dthread_concurrency
: U( s% Z! b x! x0 b# q$ {+ d
+ m# P; T6 h3 r% J9 B! bwww.linwan.net#����Ϊ����cpu��Ŀx2,���磬ֻ��һ��cpu,��ôthread_concurrency=2 . U5 W7 m6 f3 R) U: e+ U
#��2��cpu,��ôthread_concurrency=4 www.linwan.net1 E* u/ R1 ?0 G3 N5 n/ {
skip-innodb
% p2 w/ f! I1 b5 {www.linwan.net#ȥ��innodb֧��
6 z4 U5 ' L6 Y( m6 p3 X3 @www.linwan.net' @0 }# q' d" v, @: B
����:
' D6 P2 l5 y8 A1 o4 w {0 @( V& q0 L0 E9 _) u% c7 I
# Example MySQL config file for medium systems.
% @5 [7 m& g. a# l) {: t3 b& h5 E3 N! x
# This is for a system with little memory (32M - 64M) where MySQL plays
1 Y4 s# p9 e, W3 S& ]# an important part, or systems up to 128M where MySQL is used together with
" b( 4 O0 g% @. x" L7 Uwww.linwan.net# other programs (such as a web server) ���켼�������ֵ�����֮��* D& `0 ^, X3 I
# �ֺ�гԵ��̳- V8 P+ p6 H' n- _& K. s$ n; }8 p
# You can copy this file to
9 ^" ]; r2 ? H4 T& O6 jwww.linwan.net# /etc/my.cnf to set global options,
2 V6 c4 n9 |- c! r% t, Q" N. g6 Z�ֺ�гԵ��̳# mysql-data-dir/my.cnf to set server-specific options (in this www.linwan.net6 O& a$ @4 n$ t+ {! S# h
# installation this directory is /var/lib/mysql) or www.linwan.net, {4 i3 t4 g. O# @. H8 ~( I
# ~/.my.cnf to set user-specific options. " w. W& e8 ?9 F" q9 m
#
3 z3 P# U! }1 L2 r0 g0 Bwww.linwan.net# In this file, you can use all long options that a program supports.
3 c( K9 ~9 @4 S, |1 T* K; s" p�ֺ�гԵ��̳# If you want to know which options a program supports, run the program
, [2 U2 S8 B3 I5 [" B4 Q) G. N# with the "--help" option.
9 F0 U: H8 T3 M' b1 ]' G' y���켼�������ֵ�����֮���ֺ�гԵ��̳" ~/ H1 v* b7 T; P
# The following options will be passed to all MySQL clients ���켼�������ֵ�����֮��$ I5 u% f8 ^5 z E1 _; P0 ]
[client]
2 W" k8 Z; N8 [1 i" B#password = your_password
6 ~3 I$ k' e" b- s3 V1 s���켼�������ֵ�����֮��port = 3306
8 X( P- o9 J( |) H# w4 p6 hwww.linwan.netsocket = /tmp/mysql.sock
) n+ W' z9 t% D" G#socket = /var/lib/mysql/mysql.sock
) Z& C7 ` S9 M4 f6 F! J6 u���켼�������ֵ�����֮��# Here follows entries for some specific programs
; L, {8 f% S }6 l7 e# ~+ w/ x3 ^���켼�������ֵ�����֮��www.linwan.net$ e) F9 s; U+ m
# The MySQL server
3 w% A. y" H6 }- ^- ?[mysqld] ���켼�������ֵ�����֮��% H; n: O" |% T' }* R1 G ]
port = 3306 ���켼�������ֵ�����֮��5 Z7 {4 S7 @) B) r& H7 R
socket = /tmp/mysql.sock
* E4 L& L! W5 i- Q: @0 Vwww.linwan.net#socket = /var/lib/mysql/mysql.sock
2 G5 I+ w' X/ Y% x% O* Fskip-locking
6 v7 C4 e3 f( ~) p* Pkey_buffer = 128M
- Q' z* $ G6 X/ K0 ?7 H�ֺ�гԵ��̳max_allowed_packet = 1M �ֺ�гԵ��̳& x6 h, c3 f3 M$ C
table_cache = 256
. c3 g$ b( S' G! y, ~6 g9 U5 u$ L6 Bsort_buffer_size = 1M . Q3 L! u& c" s! p0 Y2 p, H
net_buffer_length = 16K
; P( b3 {$ J9 I% Emyisam_sort_buffer_size = 1M
; v C, p; w7 [* g/ Jmax_connections=120
. ~/ s* T9 Q0 H7 U6 www.linwan.net#addnew config www.linwan.net! b+ k7 [: r/ k
wait_timeout =120
; t u) L; Y& X1 lback_log=100
, S( T: t+ D6 w# Ywww.linwan.netread_buffer_size = 1M �ֺ�гԵ��̳! F5 U5 t$ f8 t+ p, @ Y& i
thread_cache=32 : l1 M( g1 k/ s; e# G( O2 T/ H2 s
skip-innodb
+ c8 R/ i; }1 i. Q8 _skip-bdb
8 w* S) ^, L5 V0 U4 V5 ]www.linwan.netskip-name-resolve �ֺ�гԵ��̳1 V" B3 K7 V+ B7 m
join_buffer_size=512k & K7 W9 W5 K5 x
query_cache_size = 32M / y/ ?0 X. S: C. B# N1 [
interactive_timeout=120
* T# x# F' J$ O+ mlong_query_time=10
5 p8 |- f j% N* [log_slow_queries= /usr/local/mysql4/logs/slow_query.log
& M; U( L- }4 F( g( H& f9 `���켼�������ֵ�����֮��query_cache_type= 1 �ֺ�гԵ��̳5 k! I0 W' `( 5 r1 d. u2 k4 N6 J
# Try number of CPU's*2 for thread_concurrency 6 U6 V1 f9 Q9 R; F7 q
thread_concurrency = 4
/ X; a( X! G8 t7 ~; R$ _' I���켼�������ֵ�����֮��& i0 [0 D2 V* ?! f+ n; T+ k
#end new config 0 ~! Q" U1 T3 I, R! A/ u2 v; l$ O
# Don't listen on a TCP/IP port at all. This can be a security enhancement, www.linwan.net- l1 T1 r& g, b( V U1 x8 M: v; E
# if all processes that need to connect to mysqld run on the same host. �ֺ�гԵ��̳( u& @; c$ }1 d( i8 e
# All interaction with mysqld must be made via Unix sockets or named pipes.
. l7 e3 {- Y9 J2 I���켼�������ֵ�����֮��# Note that using this option without enabling named pipes on Windows www.linwan.net% z, W7 x2 t# y$ e2 B
# (via the "enable-named-pipe" option) will render mysqld useless! * S! @' z% w% ]' Q% R$ g0 {& v9 Y9 [
# �ֺ�гԵ��̳" K* ~2 }5 P' e2 f2 r
#skip-networking ���켼�������ֵ�����֮��6 2 X# M0 [( q& w0 G( m+ A5 T. ]
6 p7 }/ W9 c3 d9 M3 _�ֺ�гԵ��̳# Replication Master Server (default)
$ J+ f T% Z( S# i$ Y# binary logging is required for replication
1 X! e$ y7 X& O�ֺ�гԵ��̳#log-bin
& n* C2 |* k" F7 u7 U% M( v
# c' x* y6 A u4 d�ֺ�гԵ��̳# required unique id between 1 and 2^32 - 1
+ O, _/ B0 W6 L3 n9 S" K. M���켼�������ֵ�����֮��# defaults to 1 if master-host is not set
`- ! S( T. s1 j# but will not function as a master if omitted
. [( q: H1 s0 B8 N. N���켼�������ֵ�����֮��server-id = 1
7 k/ s8 `& J7 S3 J�ֺ�гԵ��̳���켼�������ֵ�����֮��" s L4 e* x$ D6 A2 Q
# Replication Slave (comment out master section to use this) ���켼�������ֵ�����֮��1 U* {2 ]4 y7 ]" ]2 U D" v
# . g$ V8 ]. [/ y+ T) v$ o8 x4 U# w
# To configure this host as a replication slave, you can choose between
, F; k; y! P7 V! J8 n���켼�������ֵ�����֮��# two methods : �ֺ�гԵ��̳0 l% I$ D3 |$ b
# www.linwan.net' p0 P! y0 e* 6 j' t
# 1) Use the CHANGE MASTER TO command (fully described in our manual) - & |! G# V( e+ }9 t; Z
# the syntax is:
" ^( R5 p8 j1 bwww.linwan.net#
9 z6 u7 T$ P2 [3 f& o# CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=, �ֺ�гԵ��̳' O) R; Z% Z9 l* v/ b9 k( }/ ?
# MASTER_USER=, MASTER_PASSWORD= ; �ֺ�гԵ��̳* J& s$ g" v- u# s5 z
# ���켼�������ֵ�����֮��; q! e) ?) n: t" [4 M
# where you replace , , by quoted strings and ; W; z( $ }, P; t4 x. f6 ]: @
# by the master's port number (3306 by default). 0 g6 q' t0 z& O& F% Q# ?; i
# * D) z1 y( M' ?
# Example: ���켼�������ֵ�����֮��/ C$ K6 ^; c7 t6 L; h) G
# ���켼�������ֵ�����֮��' - ~- f/ [) 8 [* A
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306, 3 [) a n3 X% B5 n# O$ s/ A: b
# MASTER_USER='joe', MASTER_PASSWORD='secret';
0 @* C$ b7 l ^4 ewww.linwan.net#
8 E& i# {9 M0 e$ `���켼�������ֵ�����֮��# OR # r- n2 b9 @7 l/ q
#
5 d" y; T% @' Y6 X' J# 2) Set the variables below. However, in case you choose this method, then
; }0 k& n5 Y" }# h2 i6 |www.linwan.net# start replication for the first time (even unsuccessfully, for example
4 o% _$ g& E2 R( n; J# if you mistyped the password in master-password and the slave fails to 3 C8 O+ H. _; t# u: e& L
# connect), the slave will create a master.info file, and any later
/ f3 h n' U2 k W+ Cwww.linwan.net# change in this file to the variables' values below will be ignored and �ֺ�гԵ��̳9 e5 [) G# e. H7 e
# overridden by the content of the master.info file, unless you shutdown �ֺ�гԵ��̳* m0 o& u8 z% s. J+ r
# the slave server, delete master.info and restart the slaver server.
$ x% d2 p6 Y+ l0 i% T% kwww.linwan.net# For that reason, you may want to leave the lines below untouched
7 O; e! _) K6 `$ j) M# (commented) and instead use CHANGE MASTER TO (see above) www.linwan.net3 x3 S; - e$ V4 j& O6 s
# �ֺ�гԵ��̳# l G* @# c" @6 O
# required unique id between 2 and 2^32 - 1
- c* _# J* V * H; M# (and different from the master) �ֺ�гԵ��̳7 R- }' . x5 w( @% {. O, B" Q; a# N o
# defaults to 2 if master-host is set
' l7 P% O |5 Q7 x�ֺ�гԵ��̳# but will not function as a slave if omitted www.linwan.net" {! a6 q8 l' c/ H; X5 l* K
#server-id = 2 ���켼�������ֵ�����֮��) f1 c. H* b9 d% z' v$ {
# ���켼�������ֵ�����֮��* B5 A/ b2 X0 K1 I" B; T. j- E3 u$ N
# The replication master for this slave - required
/ ^$ v! q2 b) w0 E3 V- v& mwww.linwan.net#master-host =
a+ b9 O# J* q i2 j$ t���켼�������ֵ�����֮��# www.linwan.net8 G# d8 H. H/ r+ I, d: |/ T4 G
# The username the slave will use for authentication when connecting
% [3 }. [$ A4 z: l# to the master - required
# N' r6 i" K7 ^' a- X#master-user = www.linwan.net/ q8 `9 v& L$ n& ~. [4 |/ z
#
8 J- {7 n; y: h9 M/ P8 |7 _- d���켼�������ֵ�����֮��# The password the slave will authenticate with when connecting to 6 N8 Q/ Y% h$ v- O6 {
# the master - required ���켼�������ֵ�����֮��/ G2 I% X N( ~
#master-password =
' f4 b6 V* X; Q M' A) c! xwww.linwan.net# 6 C0 X% H1 Z S* b
# The port the master is listening on.
7 e1 F) G6 M5 s! G! V9 Bwww.linwan.net# optional - defaults to 3306 8 Q' C* g" J+ w$ ~7 {1 X, K0 x" v
#master-port =
4 T- h) A9 b# M" p. z- J+ Cwww.linwan.net# ���켼�������ֵ�����֮��, i/ X. |( Q+ N% L7 f! F
# binary logging - not required for slaves, but recommended ���켼�������ֵ�����֮��1 Y1 A4 k. j& D/ O
#log-bin
) H$ f% }3 b# {3 k* K
8 ?8 $ }" y( d# Point the following paths to different dedicated disks
) [! F! k/ v$ I* q* W4 Q#tmpdir = /tmp/ �ֺ�гԵ��̳3 L) g+ m- X, y4 K {! n9 a
#log-update = /path-to-dedicated-directory/hostname �ֺ�гԵ��̳5 }5 A D5 9 y# W0 j! z6 S% y& |
% ?' }9 g" U! A: g5 }# Uncomment the following if you are using BDB tables ) [$ v0 f5 v+ t( s
#bdb_cache_size = 4M ���켼�������ֵ�����֮��& }& R* O7 ~5 B3 F$ M& C
#bdb_max_lock = 10000
1 R1 t# P4 h& [. O4 @ q ^���켼�������ֵ�����֮��3 a7 G5 _" E( {4 i) m' a
# Uncomment the following if you are using InnoDB tables 0 w6 a1 P2 i- ^# [
#innodb_data_home_dir = /var/lib/mysql/
1 q- j; q8 k0 X3 L/ a6 n* #innodb_data_file_path = ibdata1:10M:autoextend " E1 }7 b: M X8 d6 y2 a3 M
#innodb_log_group_home_dir = /var/lib/mysql/
: O0 I$ H& A) ]# P. A/ b8 T#innodb_log_arch_dir = /var/lib/mysql/ www.linwan.net9 y0 E6 T2 O) `' ?( O4 D1 n
# You can set .._buffer_pool_size up to 50 - 80 %
8 q. O* H: D6 f6 G: B+ [���켼�������ֵ�����֮��# of RAM but beware of setting memory usage too high 6 3 b& h" }" t7 U+ @
#innodb_buffer_pool_size = 16M ( Z4 b* S0 U, n! O! D6 C+ r, b
#innodb_additional_mem_pool_size = 2M ���켼�������ֵ�����֮��. U. b5 r; s2 c! m8 @$ i1 ]
# Set .._log_file_size to 25 % of buffer pool size ���켼�������ֵ�����֮��- U* V; V& c0 W
#innodb_log_file_size = 5M �ֺ�гԵ��̳5 X3 G, v/ B! D# D, G' x
#innodb_log_buffer_size = 8M www.linwan.net" N- v* O8 h9 P# H2 Q
#innodb_flush_log_at_trx_commit = 1 8 D: s& }5 b+ D( E; K
#innodb_lock_wait_timeout = 50
* S* ?# O- |5 O1 t! _8 ]
) @8 R* O& p: c9 |1 h. f" o���켼�������ֵ�����֮��[mysqldump]
( H# X+ R4 W- z' |. N& W�ֺ�гԵ��̳quick
3 H8 z+ F& A- ]& `: R7 cmax_allowed_packet = 16M $ m2 E ^) [( L, a" U T
+ @/ D/ l: u, l( }2 C) t- p���켼�������ֵ�����֮��[mysql] 4 ]: a `! M6 i
no-auto-rehash ) ?8 A( l( ], ?6 v5 t& Y
# Remove the next comment character if you are not familiar with SQL www.linwan.net6 I4 t& I f" E! |$ o
#safe-updates
& ~. J+ [& D: U6 o: x% @�ֺ�гԵ��̳( _: F) a1 N5 p( Y5 d. p
[isamchk] www.linwan.net3 t& D' T- ?+ Z% X3 U; w! v* P
key_buffer = 20M
6 i5 Y1 f5 }; V9 v9 {3 @* H7 ~sort_buffer_size = 20M
$ C: y" I5 J: o% h; x2 l9 G���켼�������ֵ�����֮��read_buffer = 2M
8 R- O! c6 O4 |3 u- Xwrite_buffer = 2M ���켼�������ֵ�����֮��5 v$ J, r4 k7 z) ^2 {0 A
, z. Y5 f3 x- |& a[myisamchk]
' j0 h3 X3 {0 z2 u���켼�������ֵ�����֮��key_buffer = 20M
5 Y) W7 K1 j1 Y# jsort_buffer_size = 20M
) W) X0 m* z) {7 l$ ?read_buffer = 2M
( b+ z% E$ Z* y- d- iwrite_buffer = 2M �ֺ�гԵ��̳, c$ }6 y0 |- u6 r* C2 l" t: a
% [; V' G2 _; n8 v
[mysqlhotcopy]
' @- d0 r; B5 Z& e. W7 ?www.linwan.netinteractive-timeout���켼�������ֵ�����֮��3 n9 h1 D& |8 V0 R/ @8 O/ n
�ֺ�гԵ��̳! S! P$ T* n9 s
���� www.linwan.net8 X! J7 H& e f
% z" G( {5 v) G6 ]; H$ b/ wwww.linwan.net�Ż�table_cachetable_cacheָ�������ٻ����Ĵ�С��ÿ��MySQL����һ����ʱ�������ڱ��������л��пռ䣬�ñ��ͱ����������У��������Ը����ط��ʱ����ݡ�ͨ��������ֵʱ����״ֵ̬Open_tables��Opened_tables�����Ծ����Ƿ���Ҫ����table_cache��ֵ�������㷢��open_tables����table_cache������opened_tables�ڲ�����������ô������Ҫ����table_cache��ֵ�ˣ�����״ֵ̬����ʹ��SHOW STATUS LIKE ��Open%tables�����ã���ע�⣬����äĿ�ذ�table_cache���óɺܴ���ֵ���������õ�̫�ߣ����ܻ������ļ����������㣬�Ӷ��������ܲ��ȶ���������ʧ�ܡ�������1G�ڴ��Ļ������Ƽ�ֵ��128��256��
2 f5 |0 O4 G6 G$ ~; ~1 J: P$ ~; D# D# `6 V, h0 W* u( _ & f
����1���ð�������һ�������ر���æ�ķ�����table_cache �C 512open_tables �C 103opened_tables �C 1273uptime �C 4021421 (measured in seconds)�ð�����table_cache�ƺ����õ�̫���ˡ��ڷ�ֵʱ�䣬������Ŀ��table_cacheҪ�ٵöࡣ www.linwan.net8 $ O) X- S1 j+ - Q( C
���켼�������ֵ�����֮��, N( m9 S- n. Z) f9 u
����2���ð�������һ̨������������table_cache �C 64open_tables �C 64opened-tables �C 431uptime �C 1662790 (measured in seconds)��Ȼopen_tables�Ѿ�����table_cache�����������ڷ���������ʱ����˵��opened_tables��ֵҲ�dz��͡����ˣ�����table_cache��ֵӦ���ô�������3���ð�������һ��upderperforming�ķ�����table_cache �C 64open_tables �C 64opened_tables �C 22423uptime �C 19538�ð�����table_cache���õ�̫���ˡ���Ȼ����ʱ�䲻��6Сʱ��open_tables�ﵽ������ֵ��opened_tables��ֵҲ�dz��ߡ���������Ҫ����table_cache��ֵ���Ż�key_buffer_sizekey_buffer_sizeָ�������������Ĵ�С�������������������ٶȣ����������������ٶȡ�ͨ������״ֵ̬Key_read_requests��Key_reads������֪��key_buffer_size�����Ƿ�����������key_reads / key_read_requestsӦ�þ����ܵĵͣ�������1:100��1:1000���ã�����״ֵ̬����ʹ��SHOW STATUS LIKE ��key_read%�����ã���key_buffer_sizeֻ��MyISAM�������á���ʹ�㲻ʹ��MyISAM���������ڲ�����ʱ���̱���MyISAM����ҲҪʹ�ø�ֵ������ʹ�ü���״ֵ̬created_tmp_disk_tables��֪���顣����1G�ڴ��Ļ�����������ʹ��MyISAM�����Ƽ�ֵ��16M��8-64M���� ( P: g: _& M0 p; S, D6 f8 H% ~# Y
- ^' F) 6 r: O; A/ F6 g; E
����1������״��key_buffer_size �C 402649088 (384M)key_read_requests �C 597579931key_reads - 56188����2������״̬key_buffer_size �C 16777216 (16M)key_read_requests �C 597579931key_reads - 53832731����1�б�������1:10000���ǽ���������������2�б����ﵽ1:11�������Ѿ����졣
ԭ�ģ�http://www.myispace.cn/posts/b3d46ecebf95473c9e20902176881d2b.htm
- ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
- �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����
- �������е���ɫ
- �������ж�IP��ַ��A��B���C��
- ������ϵ��Ц�� (ʷ����ȫ��
- ��Google���������ŵ���ͨv4.0
- ���ٶ�ͳ��URL��hm������utm�����Ķ�Ӧ��ϵ
- ��ƻ������MACbook Air���ݼ���ȫ
- ��Linux��ʹ��host��dig��nslookup��ѯDNS
- �����Լ���VPS�Google��������
- ���������ԡ���װ Windows XP ����ϵͳ��ͼ��ȫ����
- ��С�ڴ�VPS֮Nginx+PHP-fpm�߸����Ż���ѹ�����Է���