Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng

Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng (http://quantrinet.com/forum/index.php)
-   Mysql Server (http://quantrinet.com/forum/forumdisplay.php?f=153)
-   -   Tối ưu MySQL - MySQL Tweaking (http://quantrinet.com/forum/showthread.php?t=8039)

hoctinhoc 07-09-2011 03:59 PM

Tối ưu MySQL - MySQL Tweaking
 
MySQL Tweaking – Tối ưu MySQL



Với cPanel or Plesk hay cài đặt MySQL bình thường bao giờ sau khi cài xong MySQL cũng chạy với những config mặc định. Nó không tối ưu và tốt cho server. Đặc biệt là với hosting provider.
Đây là cấu hình tốt cho MySQL.

Sửa file /etc/my.cnf Xóa hết nội dung đã có, thay thành:
Mã:


[mysqld]
max_connections=900
max_user_connections=50
skip-locking
skip-innodb
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
interactive_timeout=50
wait_timeout=50
connect_timeout=10
thread_cache_size=128
key_buffer=256M
max_allowed_packet=16M
table_cache=1024
join_buffer=1M
sort_buffer_size=1M
read_buffer_size=1M
max_connect_errors=10
thread_concurrency=4
myisam_sort_buffer_size=64M
log-bin
server-id=1

[safe_mysqld]
open_files_limit=8192
 [mysqldump]
quick
max_allowed_packet=16M
 [mysql]
no-auto-rehash
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
 [myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
 
[mysqlhotcopy]
interactive-timeout


Chuc cac ban thanh cong!



:battay:


hoctinhoc 10-10-2014 02:14 PM

Mysql chạy tốn nhiều cpu, ram và cách kiểm tra
 
Mysql chạy tốn nhiều cpu, ram và cách kiểm tra



Đôi khi mysql chạy chiếm nhiều cpu, ram để kiểm tra process nào chạy nhiều bạn theo các bước sau


1. Truy cập mysql


#mysql -u root -p


2. Xem có bao nhiêu connections trong mysql


mysql> show status like '%onn%';

3. Xem có nhau nhiều process mysql đang xử lýmysql> show processlist;


4. Xem trang thái mysql

mysql> SHOW STATUS;

5. Xem và kill process mysqlmysql> SHOW PROCESSLIST;

mysql> KILL 27;


Bây giờ là 03:10 PM. Giờ GMT +7

Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.