操作3 mongodb和mysql 開啟慢查詢日誌 ,以及mongodb從設定檔啟動,mongodbmysql

來源:互聯網
上載者:User

操作3 mongodb和mysql 開啟慢查詢日誌 ,以及mongodb從設定檔啟動,mongodbmysql

1.

mongodb從設定檔啟動

建立設定檔:/usr/local/mongodb/etc/mongodb.conf

設定檔的內容為:

#Directory and relavent setdbpath = /var/mongodb/datalogpath = /var/mongodb/logs/log.logprofile=2slowms=100#repairpath = /var/mongodb/repairpidfilepath = /usr/local/mongodb/mongodb.pid#directoryperdb = true#sysinfo = true#verbose = true#logappend = true#cpu = true#Network and security setnoauth = true#port = 8888#maxConns = 1024fork = 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: 389child process started successfully, parent exiting


3.mysql5.6開啟慢查詢  

vim my.cnf

代表超過一秒的查詢為慢查詢,慢查詢寫入檔案mysql-slow.log檔案中

log-error=/var/log/mysql-error.logslow_query_log=1slow_query_log_file=/www/web_logs/mysql/mysql-slow.log


著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.