监控现有进程的神配置文件? [英] God configuration file to monitor existing processes?
本文介绍了监控现有进程的神配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 God(一个 Ruby gem)监控我的 redis 服务器.但是,我现有的服务器可能已经有一个 redis 实例.我如何确保它监控已启动的现有 Redis 服务器进程?
I am monitoring my redis server using God (a Ruby gem). However, my existing server may already has an instance of redis up. How can I be sure it monitors the existing Redis server process that is already up?
这是我的redis神文件:
This is my God file for redis:
rails_root = ENV['RAILS_ROOT']
redis_root = "/usr/local/bin"
# Redis
%w{6379}.each do |port|
God.watch do |w|
w.name = "redis"
w.interval = 30.seconds
w.start = "#{redis_root}/redis-server /etc/redis/redis.conf"
w.stop = "#{redis_root}/redis-cli shutdown"
w.restart = "#{w.stop} && #{w.start}"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.log = File.join(rails_root, 'log', 'redis.log')
w.keepalive(:memory_max => 5000.megabytes)
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
end
end
推荐答案
回答这个问题:
我放了一个w.pid_file = "SOMETHING" 在我的上帝文件中,并确保这个 PID 文件也在 Redis 的配置文件中设置.
I put a w.pid_file = "SOMETHING" in my God file, and made sure this PID file was also set in the configuration file for Redis.
这篇关于监控现有进程的神配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文