Archive for the 'Linux' Category

二月 01 2010

MySQL效能調整程式

Published by C.K. under Linux 49 Views

此小工具能將MySQL調整為最佳化

下面為原作者說明

MySQL Performance Tuning Primer Script

This script takes information from "SHOW STATUS LIKE…" and "SHOW VARIABLES LIKE…"
to produce sane recomendations for tuning server variables.
It is compatable with all versions of MySQL 3.23 and higher (including 5.1).

Currently it handles recomendations for the following:

  • Slow Query Log
  • Max Connections
  • Worker Threads
  • Key Buffer
  • Query Cache
  • Sort Buffer
  • Joins
  • Temp Tables
  • Table (Open & Definition) Cache
  • Table Locking
  • Table Scans (read_buffer)
  • Innodb Status

Recent Changes

  • Correct awk display error which formats integers > 4294967296 in scientific notation.
  • - Was manfest in MEMORY USAGE section where total system RAM > 4GB.
  • Fixed rounding error where mysql will lose 4K from the join_buffer_size value.
  • - Other values may have the same issue but are not yet reported
  • Added support for FreeBSD and MacOS (thanks Sam and Geert)
  • Added support for Solaris
  • Changed how system memory is derived on Linux.
  • - Use /proc/meminfo vs free -b and avoid inclusion of swap space.
  • Include note warning of instability when key_buffer_size > 4GB in versions 5.0.51 and lower

下載:http://www.day32.com/MySQL/tuning-primer.sh

原始網站:http://www.day32.com/MySQL/

Bookmark and Share

No responses yet

五月 18 2009

Linux服務一覽表

Published by C.K. under Linux 506 Views

預設開啟的服務 建議 說明
acpid 停用 Advanced Configuration and Power Interface 電源進階設定,常用在 Laptop 上
apmd 停用 Adventage Power Management daemon 偵測系統的電池電量,常用在 Laptop 上
atd 停用 /etc/at.allow,/etc/at.deny 我大概都使用 crond 來達成
autofs 停用 自動掛載檔案系統與週邊裝置 (如光碟、USB),常用在 Laptop 上
avahi-daemon 停用 當區網沒有 DNS 服務時會試著尋找提供 zeroconf 協定的主機
bluetooth 停用 Bluetooth 藍芽,常用在 Laptop 上
cpuspeed 停用 控制 CPU 速度主要用來省電,常用在 Laptop 上
cups 停用 Common UNIX Printing System 使系統支援印表機
firstboot 停用 安裝完成後第一次啟動時的服務,設定 auth、firewall、keyboard…
gpm 停用 記錄週邊裝置的檔案資料,例如文字模式下可使用滑鼠
haldaemon 停用 使系統支援 plug and play 裝置
hidd 停用 使系統支援藍芽裝置,例如滑鼠,鍵盤
hplip 停用 使系統支援 HP 相關型號印表機
ip6tables 停用 使系統支援 IPTables Filrewall IPv6
isdn 停用 使系統支援 Integrated Services Digital Network (ISDN) 環境
lm_sensors 停用 使系統支援偵測主機版或硬體,常用在 Laptop 上
messagebus 停用 使系統支援 plug and play 裝置
nfslock 停用 使系統支援 NFS Server 資料一致性功能
pcscd 停用 使系統支援 Smart Card
portmap 停用 使系統支援 NFS Service
rpcgssd 停用 使系統支援 NFSv4 Service
rpcidmapd 停用 使系統支援 NFSv4 Service
yum-updatesd 停用 使系統支援 YUM 自動更新服務 (上線機器還是先確認好再更新)
anacron 視個人需求 執行在 crontab 設定的時間沒有執行到的工作
auditd 視個人需求 稽核系統 /var/log/audit/audit.log,若 auditd 未執行中則稽核訊息會寫入 /var/log/messages (配合 SELinux)
iptables 視個人需求 使系統支援 IPTables Filrewall
irqbalance 視個人需求 使系統支援多個 CPU 環境當系統中斷請求時進行負載平衡的程序,所以單 CPU 的機器就不需要
lvm2-monitor 視個人需求 使系統支援 Logical Volume Manager 邏輯磁區
mcstrans 視個人需求 主要用於配合 SELinux 服務
mdmonitor 視個人需求 使系統支援 RAID 相關程序
microcode_ctl 視個人需求 使系統支援 Intel IA32 CPU 特色,所以 AMD CPU 不需要
netfs 視個人需求 Network File System Mounter 網路掛載系統 (如 NFS、Samba、NCP)
restorecond 視個人需求 使系統支援 SELinux 監控檔案狀態
smartd 視個人需求 使系統支援檢查硬碟狀態 (Hardware RAID 要改設定檔)
sendmail 視個人需求 使系統支援 Sendmail
xfs 視個人需求 使系統支援 X Window 字型
crond 啟動 /etc/cron.* 排程服務
kudzu 啟動 使系統每次開機會都自動執行硬體偵測
network 啟動 使系統支援網卡
readahead_early 啟動 使系統再啟動時預先將相關檔案讀到記憶體內來加快啟動速度
sshd 啟動 使系統支援 SSH Service
syslog 啟動 使系統支援 System Log Service
Bookmark and Share

No responses yet

一月 20 2009

Apache 防止圖片盜連

Published by C.K. under Linux 895 Views

請先確定您Apache的Rewrite模組有啟用了

將下面存成.htaccess,放於網站根目錄

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://youdomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://youdomain.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

語法小說明:

RewriteCond:設定哪些是允許存取的連線。

上方程式碼,你可以把http://youdomain.com/改成你網站網址,這樣就會允許你網站可以讀取檔案。如果你想要允許多個網站,就按照上面的RewriteCond寫法,看要讓幾個網站可以連,就加幾串語法就可以了!

»RewriteRule:指定哪些檔案不可盜連,盜連後的錯誤訊息顯示設定。

»[F]:顯示錯誤訊息為文字,403 Forbidden是禁止讀取。

範例:

RewriteRule \.(jpg|jpeg|gif|png|bmp|rar|zip|exe)$ – [F]

»[R,NC]:顯示錯誤訊息為圖片

範例:

RewriteRule .*\.(jpg|gif|png|bmp|rar|zip|exe)$ /content/no_hotlink.jpeg [R,NC]

»何檔案或圖片都被盜連:

請把

RewriteRule \.(jpg|jpeg|gif|png|bmp|rar|zip|exe)$ – [F]

改成

RewriteRule .*$ – [F]

這樣所有檔案都會自動被限制住,只有上面RewriteCond有設定的網址才可以讀取,而若遇到盜連者,他那邊圖片或檔案將不會顯示出來。

Bookmark and Share

No responses yet

四月 06 2006

GeeXboX Open Media Center

Published by C.K. under Linux 5,754 Views

什麼是 GeeXboX?

操作備忘:

  • 自製中文化 GeeXboX
  • 常用按鍵備忘
  • 把 GeeXboX 放進 USB 隨身碟

Continue Reading »

Bookmark and Share

No responses yet

三月 01 2006

Postfix+Openwebmail + cyrus-sals+Vm-pop3d

Published by C.K. under Linux 3,868 Views

安裝 Openwebmail

http://turtle.ee.ncku.edu.tw/~tung/openwebmail/

設定 Virtual User :
參考網站: http://www.bluelavalamp.net/owmvirtual/

Continue Reading »

Bookmark and Share

No responses yet