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