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