Linux te mysql optimizasyonu icin gerekenler

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
1. Serverinizda root ile ssh ekranina geciniz.
2. vi yada pico ile yeni mysql_raporu.sh dosyasini aciniz.
3. Asagidaki satirlarin tumunu bu dosya icine kaydederek saklayiniz.

echo "Top"
echo "-------------------------------------------------------------------------"
date; top -c -n1
#
echo "my.cnf"
echo "-------------------------------------------------------------------------"
date; cat /etc/my.cnf
#
echo "show status"
echo "-------------------------------------------------------------------------"
date; echo "show status" | mysql -u kullanici_adi -p sifre
4. mysql kullanici_adi ve sifrenizi yukaridaki satira giriniz.
5. chmod 755 mysql_raporu.sh komutu ile dosyayi calisir moda geciriniz.
6. ./mysql_raporu.sh > mysql_raporu.txt komutunu calistiriniz.
7. mysql_raporu.txt dosyasini foruma ekleyerek mesajinizi yaziniz.
 

Mywedding

1
İyinet Üyesi
Katılım
26 Eylül 2006
Mesajlar
5,893
Reaction score
96
Konum
www.odatv.com
rapor :


Top
---------------------------------------------------
Sat Mar 31 01:17:49 EEST 2007
(Btop - 01:17:50 up 3 days, 5:32, 1 user, load average: 1.72, 1.13, 1.91(B
Tasks:(B(B 95 (Btotal,(B(B 1 (Brunning,(B(B 94 (Bsleeping,(B(B 0 (Bstopped,(B(B 0 (Bzombie(B
Cpu(s):(B(B 54.3% (Bus,(B(B 8.0% (Bsy,(B(B 0.0% (Bni,(B(B 37.4% (Bid,(B(B 0.2% (Bwa,(B(B 0.0% (Bhi,(B(B 0.0% (Bsi(B
Mem: (B(B 483476k (Btotal,(B(B 456728k (Bused,(B(B 26748k (Bfree,(B(B 28860k (Bbuffers(B
Swap:(B(B 1052248k (Btotal,(B(B 60872k (Bused,(B(B 991376k (Bfree,(B(B 194872k (Bcached(B

 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND (B
(B11410 apache 15 0 34684 16m 4644 S 3.1 3.4 1:55.02 /usr/sbin/httpd (B
(B21908 mysql 16 0 149m 38m 4048 S 1.6 8.2 44:44.70 /usr/libexec/mysqld(B
(B16790 apache 15 0 34668 15m 4376 S 1.6 3.4 1:03.63 /usr/sbin/httpd (B
(B19030 apache 15 0 34648 15m 4380 S 1.6 3.4 0:44.69 /usr/sbin/httpd (B
(B20152 apache 15 0 34668 15m 4376 S 1.6 3.4 0:36.56 /usr/sbin/httpd (B
(B21302 apache 15 0 34380 15m 4360 S 1.6 3.3 0:31.88 /usr/sbin/httpd (B
(B(B23936 root 16 0 2360 880 692 R 1.6 0.2 0:00.02 top -c -n1 (B
(B 1 root 16 0 2292 456 428 S 0.0 0.1 0:00.87 init [3] (B
(B 2 root 34 19 0 0 0 S 0.0 0.0 0:00.04 [ksoftirqd/0] (B
(B 3 root 5 -10 0 0 0 S 0.0 0.0 0:00.06 [events/0] (B
(B 4 root 6 -10 0 0 0 S 0.0 0.0 0:00.01 [khelper] (B
(B 5 root 15 -10 0 0 0 S 0.0 0.0 0:00.00 [kacpid] (B
(B 19 root 5 -10 0 0 0 S 0.0 0.0 0:00.00 [kblockd/0] (B
(B 38 root 15 0 0 0 0 S 0.0 0.0 0:02.28 [pdflush] (B
(B 40 root 12 -10 0 0 0 S 0.0 0.0 0:00.00 [aio/0] (B
(B 20 root 15 0 0 0 0 S 0.0 0.0 0:00.00 [khubd] (B
(B 39 root 15 0 0 0 0 S 0.0 0.0 0:26.98 [kswapd0] (B[?12l[?25h
my.cnf
---------------------------------------------------
Sat Mar 31 01:17:50 EEST 2007
[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
show status
---------------------------------------------------
Sat Mar 31 01:17:50 EEST 2007
 

yshner

0
İyinet Üyesi
Katılım
23 Şubat 2011
Mesajlar
28
Reaction score
0
Şöyle 2 raporum var.
ilgilenen olursa yazayım:

[root@localhost ~]# ./tuning-primer.sh

-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.0.77 i686

Uptime = 9 days 3 hrs 22 min 35 sec
Avg. qps = 117
Total Questions = 92831398
Threads Connected = 2

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 908 out of 92831426 that take longer than 10 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 4
Current threads_cached = 3
Current threads_per_sec = 2
Historic threads_per_sec = 1
Threads created per/sec are overrunning threads cached
You should raise thread_cache_size

MAX CONNECTIONS
Current max_connections = 170
Current threads_connected = 3
Historic max_used_connections = 162
The number of used connections is 95% of the configured maximum.
You should raise max_connections

INNODB STATUS
Current InnoDB index space = 1 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 40 %
Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 462 M
Configured Max Per-thread Buffers : 456 M
Configured Max Global Buffers : 26 M
Configured Max Memory Limit : 483 M
Physical Memory : 3.46 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 827 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 181
Key buffer free ratio = 36 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 9 M
Current query_cache_used = 6 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 73.98 %
Current query_cache_min_res_unit = 4 K
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 5729 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 1604 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 712 tables
You have a total of 1188 tables
You have 712 open tables.
Current table_cache hit rate is 1%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 2296731 temp tables, 11% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 160 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 236
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

[root@localhost ~]#
[root@localhost ~]# perl mysqltuner.pl

>> MySQLTuner 1.2.0 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.77
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive +BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 2G (Tables: 1032)
[--] Data in InnoDB tables: 2M (Tables: 133)
[--] Data in MEMORY tables: 378K (Tables: 6)
[!!] BDB is enabled but isn't being used
[!!] Total fragmented tables: 86

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 9d 3h 23m 51s (92M q [117.550 qps], 8M conn, TX: 2B, RX: 1B)
[--] Reads / Writes: 75% / 25%
[--] Total buffers: 43.0M global + 2.7M per thread (170 max threads)
[OK] Maximum possible memory usage: 499.9M (14% of installed RAM)
[OK] Slow queries: 0% (908/92M)
[!!] Highest connection usage: 95% (162/170)
[OK] Key buffer size / total MyISAM indexes: 8.0M/827.0M
[OK] Key buffer hit rate: 99.4% (13B cached / 72M reads)
[OK] Query cache efficiency: 52.0% (27M cached / 52M selects)
[!!] Query cache prunes per day: 876567
[OK] Sorts requiring temporary tables: 0% (844 temp sorts / 10M sorts)
[!!] Joins performed without indexes: 5729
[OK] Temporary tables created on disk: 11% (293K on disk / 2M total)
[OK] Thread cache hit rate: 89% (863K created / 8M connections)
[!!] Table cache hit rate: 1% (712 open / 69K opened)
[OK] Open file limit used: 70% (1K/1K)
[OK] Table locks acquired immediately: 99% (66M immediate / 67M locks)
[OK] InnoDB data size / buffer pool: 2.2M/8.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Add skip-bdb to MySQL configuration to disable BDB
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
Reduce or eliminate persistent connections to reduce connection usage
Adjust your join queries to always utilize indexes
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
max_connections (> 170)
wait_timeout (< 14400)
interactive_timeout (< 14400)
query_cache_size (> 9M)
join_buffer_size (> 128.0K, or always use indexes with joins)
table_cache (> 712)

[root@localhost ~]#
ram-> 4gb cpu-> 6
my.cnf dosyam:


[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
max_allowed_packet=32M
max_connections=170
wait_timeout = 14400
interactive_timeout = 14400
query_cache_size = 9M
thread_cache_size = 4
table_cache = 712
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


my.cnf dosyamı nasıl değiştirirsem bir kat daha olumlu sonuç elde edebilirim?
 

Türkiye’nin ilk webmaster forum sitesi iyinet.com'da forum üyeleri tarafından yapılan tüm paylaşımlardan; Türk Ceza Kanunu’nun 20. Maddesinin, 5651 Sayılı Kanununun 4. maddesinin 2. fıkrasına göre, paylaşım yapan üyeler sorumludur.

Backlink ve Tanıtım Yazısı için iletişime geçmek için Skype Adresimiz: .cid.1580508955483fe5

Elektronik Sigara Cicisex Porno
Üst