簡體   English   中英

Chef-solo掛在最后,安裝redis

[英]chef-solo hangs at the end installing redis

當安裝redis時,chef-solo掛在末尾,好像廚師正在等待某個事件發生。 這是我必須使用ctrl + c殺死它時的輸出。

[2013-05-14T15:55:27 + 00:00]錯誤:正在運行異常處理程序
[2013-05-14T15:55:27 + 00:00]錯誤:異常處理程序完成Chef Client失敗。 更新了8種資源
[2013-05-14T15:55:27 + 00:00]致命:Stacktrace轉儲到/home/ubuntu/cache/chef-stacktrace.out [2013-05-14T15:55:27 + 00:00]致命:廚師:: Exceptions :: MultipleFailures:發生了多個故障:
*在廚師運行中發生SystemExit:service [redis](redis ::默認行107)有一個錯誤:SystemExit:退出
* Chef :: Exceptions :: Exec發生在延遲通知中:service [redis](redis :: default第83行)發生錯誤:Chef :: Exceptions :: Exec:/ sbin / start重傳了1,預期為0

我是廚師新手,無法弄清楚為什么會這樣。 有沒有人注意到這種行為?

這是我的配方文件

package "build-essential" do
  action :install
end

user node[:redis][:user] do
  action :create
  system true
  shell "/bin/false"
end

directory node[:redis][:dir] do
  owner node[:redis][:user]
  group node[:redis][:user]
  mode "0755"
  action :create
end

directory node[:redis][:data_dir] do
  owner node[:redis][:user]
  group node[:redis][:user]
  mode "0755"
  action :create
end

directory node[:redis][:log_dir] do
  owner node[:redis][:user]
  group node[:redis][:user]
  mode "0755"
  action :create
end

remote_file "#{Chef::Config[:file_cache_path]}/redis-2.6.10.tar.gz" do
  source "http://redis.googlecode.com/files/redis-2.6.10.tar.gz"
  action :create_if_missing
end

# Adding 'make test' causes the install to freeze for some reason.
bash "compile_redis_source" do
  cwd Chef::Config[:file_cache_path]
  code <<-EOH
    tar zxf redis-2.6.10.tar.gz
    cd redis-2.6.10
    make && sudo make install
    # to give permissions to the executables that it copied to.
    chown -R redis:redis /usr/local/bin
  EOH
  creates "/usr/local/bin/redis-server"
end

service "redis" do
  provider Chef::Provider::Service::Upstart
  subscribes :restart, resources(:bash => "compile_redis_source")
  supports :restart => true, :start => true, :stop => true
end

template "redis.conf" do
  path "#{node[:redis][:dir]}/redis.conf"
  source "redis.conf.erb"
  owner node[:redis][:user]
  group node[:redis][:user]
  mode "0644"
  notifies :restart, resources(:service => "redis")
end

template "redis.upstart.conf" do
  path "/etc/init/redis.conf"
  source "redis.upstart.conf.erb"
  owner node[:redis][:user]
  group node[:redis][:user]
  mode "0644"
  notifies :restart, resources(:service => "redis")
end

service "redis" do
  action [:enable, :start]
end

有2個服務“ redis”資源語句,是否有問題? 或者在這種情況下如何進行廚師鍛煉,跑步時是否將其合並為一個資源?

我正在使用upstart,這是redis.upstart.conf.erb文件。 不知道這是否有問題。 語句的順序在此文件中是否重要?

#!upstart
description "Redis Server"
emits redis-server

# run when the local FS becomes available
start on local-filesystems
stop on shutdown

setuid redis
setgid redis
expect fork

# Respawn unless redis dies 10 times in 5 seconds
#respawn
#respawn limit 10 5

# start a default instance
instance $NAME
env NAME=redis
#instance $NAME

# run redis as the correct user
#setuid redis
#setgid redis

# run redis with the correct config file for this instance
exec /usr/local/bin/redis-server /etc/redis/redis.conf

respawn
#respawn limit 10 5

我認為Dmytro走在正確的道路上,但不完全正確。

我看到您正在使用Upstart作為Chef中的服務提供商。 請檢查redis-server Upstart配置中是否有任何expect語句。 如果您在其中有一個expect forkexpect daemon語句,則意味着啟動redis-server ,Upstart將分別等待Redis服務分支一次或兩次。 如果在daemonize noredis.conf進程daemonize no ,那么Redis進程將永遠不會分叉,因此Upstart只會在執行初始化腳本時掛起。

您的redis不會啟動,只是在前台運行。

我使用的Redis食譜之一也有類似的問題。 redis.conf.erb文件中,它具有配置選項

daemonize no

其他一些食譜具有可通過屬性配置的此選項。 因此,您的修復將取決於您使用的食譜。 編輯您的redis.conf.erb文件,或者找到如何配置該屬性並將其設置為yes

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM