在ubuntu服务器上使用ruby设置Redis,但无法弄清楚如何访问其日志文件.教程说它应该在这里:
/var/log/redis_6379.log
Run Code Online (Sandbox Code Playgroud)
但是甚至找不到/ var /文件夹
Chr*_*fer 53
找到它:
sudo tail /var/log/redis/redis-server.log -n 100
Run Code Online (Sandbox Code Playgroud)
因此,如果设置更标准应该是:
sudo tail /var/log/redis_6379.log -n 100
Run Code Online (Sandbox Code Playgroud)
这将输出文件的最后100行.
您的日志文件所在的位置在您可以访问的配置中:
redis-cli CONFIG GET *
Run Code Online (Sandbox Code Playgroud)
使用上述内容可能无法始终显示日志文件.在那种情况下使用
tail -f `less /etc/redis/redis.conf | grep logfile|cut -d\ -f2`
Run Code Online (Sandbox Code Playgroud)
Kan*_*mar 12
vi /usr/local/etc/redis.conf
Run Code Online (Sandbox Code Playgroud)
查找目录,日志文件
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /usr/local/var/db/redis/
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile "redis_log"
Run Code Online (Sandbox Code Playgroud)
所以日志文件是/usr/local/var/db/redis/redis_log用名字创建的redis_log
您还可以尝试MONITOR命令 fromredis-cli查看执行的命令数。
日志文件将是配置文件(通常/etc/redis/redis.conf)所说的位置:)
默认情况下,logfile stdout这可能不是您要找的.如果redis正在运行daemonized,则该日志配置意味着将发送日志/dev/null,即丢弃.
摘要:logfile /path/to/my/log/file.log在您的配置中设置,redis日志将写入该文件.
我推荐你使用redis-cli监控工具。简单输入以下命令:
redis-cli monitor
Run Code Online (Sandbox Code Playgroud)
它为您提供实时访问日志,帮助您解决问题并...
| 归档时间: |
|
| 查看次数: |
96868 次 |
| 最近记录: |