1.
mongodb從配置文件啟動
創建配置文件:/usr/local/mongodb/etc/mongodb.conf
配置文件的內容為:
#Directory and relavent set dbpath = /var/mongodb/data logpath = /var/mongodb/logs/log.log profile=2 slowms=100 #repairpath = /var/mongodb/repair pidfilepath = /usr/local/mongodb/mongodb.pid #directoryperdb = true #sysinfo = true #verbose = true #logappend = true #cpu = true #Network and security set noauth = true #port = 8888 #maxConns = 1024 fork = true #Management #nohttpinterface = true #rest = true #quota = true #quotaFiles = 1024 #nssize = 16 #syncdelay = 5
profile=2代表打印所有
slowms代表超過幾秒的操作。
結果輸出到logpath中
noauth代表啟動賬戶驗證
2.
通過配置文件啟動
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/etc/mongodb.conf
about to fork child process, waiting until server is ready for connections. forked process: 389 child process started successfully, parent exiting
3.mysql5.6開啟慢查詢
vim my.cnf
代表超過一秒的查詢為慢查詢,慢查詢寫入文件mysql-slow.log文件中
log-error=/var/log/mysql-error.log slow_query_log=1 slow_query_log_file=/www/web_logs/mysql/mysql-slow.log