# apt-get install avahi-daemon
2015年1月26日 星期一
GDBus.Errorrg.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Avahi was not provided by any .service files
2015年1月25日 星期日
Instal Python Eggs
easy_install somepackage.eggeasy_install http://somehost.somedomain.com/somepackage.eggReferences :A small introduction to Python Eggs2015年1月24日 星期六
ImportError: cannot import name IncompleteRead
# apt-get install python-requests python-pip
References :
python - How do I fix 'ImportError: cannot import name IncompleteRead'? - Stack Overflow
2015年1月23日 星期五
MySQL show all grouped results
select t.Letter, t.Value from MyTable t inner join ( select Letter, sum(Value) as ValueSum from MyTable group by Letter ) ts on t.Letter = ts.Letter order by ts.ValueSum desc, t.Letter, t.Value desc
References :
sorting - MySQL show all grouped results and sort - Stack Overflow
Python read file don't include '\n'
with open(fname) as f: content = f.read().splitlines()
References :
string - Python: read file line by line into array - Stack Overflow
MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes
因 MySQL 有單筆 SQL Query 長度的限制,在匯入檔案時,一次 INSERT 資料很大會錯誤,需調整單筆 SQL Query 長度
查詢目前 max_allowed_packet 設定值
mysql> show variables like 'max_allowed_packet';
更改爲 256MB (Client 需重新連結才會生效)
mysql> set global max_allowed_packet = 1024 * 1024 * 256;
References :
MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes - Stack Overflow
2015年1月22日 星期四
MySQL 開啓檔案數
系統允許最大開啓檔案數
$ sysctl -a | grep fs.file-max目前系統所有程式已開啓的檔案數
fs.file-max = 146925
$ cat /proc/sys/fs/file-max
146925
$ lsof | wc -l每個 shell 允許開啓檔案數
18120
$ ulimit -nMySQL 最大允許開啓檔案數 (與 open_files_limit 變數設定 (default: 0) 或 ulimit 有關)
1024
mysql> show variables like 'open_files_limit';MySQL 開啓的檔案數
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| open_files_limit | 1024 |
+------------------+-------+
$ pgrep mysqldMySQL 目前開啓的檔案數
1661
1988
$ ls /proc/1988/fdinfo/ | wc -l
248
$ lsof -a -d 1-999 -p 1988
mysql> show status like '%Open_files%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Open_files | 221 |
+---------------+-------+
訂閱:
文章 (Atom)