evertrue / zookeeper-cookbook

Chef cookbook for installing and managing Zookeeper.
https://supermarket.chef.io/cookbooks/zookeeper
Apache License 2.0
81 stars 117 forks source link

Zookeeper install issue. #112

Closed ctippur closed 9 years ago

ctippur commented 9 years ago

I have been having trouble installing zookeeper via chef.

  1. Zookeeper install fails with
  2. chef_gem[zookeeper] action install[2014-11-17T10:14:28-08:00] WARN: failed to find gem zookeeper (>= 0) from [http://rubygems.org/]

Error executing action install on resource 'chef_gem[zookeeper]' Illformed requirement [""]

I am able to install zookeeper via cli .. /opt/chef/embedded/bin/gem install zookeeper

  1. As I installed zookeeper by hand, I have issues with the service. Error: Could not locate main runit sv_bin at "/sbin/sv". Did you remember to install runit before declaring a "runit_service" resource?

I did include this line in the service.rb file - include_recipe "runit" I still see the same issue.

Appreciate any help.

Thanks Shekar

jakedavis commented 9 years ago

Hey @ctipper,

That's a bummer ... can you post the entire stacktrace and the expanded run list? I am not sure off the top of my head what's up. Thanks!

ctipper commented 9 years ago

@ctippur over to you. :-)

ctippur commented 9 years ago

Here is the knife bootstrap log :) :

 Recipe: zookeeper::config_render
   * zookeeper_config[/opt/zookeeper/zookeeper-3.4.6/conf/zoo.cfg] action renderRecipe: <Dynamically Defined Resource>
   * file[/opt/zookeeper/zookeeper-3.4.6/conf/zoo.cfg] action create (up to date)
  (up to date)
   * service[zookeeper] action nothing (skipped due to action :nothing)
 Recipe: zookeeper::service
   * runit_service[zookeeper] action enable
 ================================================================================
 Error executing action `enable` on resource 'runit_service[zookeeper]'
 ================================================================================

 RuntimeError
 ------------
 Could not locate main runit sv_bin at "/sbin/sv". Did you remember to install runit before declaring a "runit_service" resource? 

 Try adding the following to the top of your recipe:

 include_recipe "runit"

 Cookbook Trace:
 ---------------
 /var/chef/cache/cookbooks/runit/libraries/provider_runit_service.rb:71:in `load_current_resource'

 Resource Declaration:
 ---------------------
 # In /var/chef/cache/cookbooks/zookeeper/recipes/service.rb

  46:   runit_service 'zookeeper' do
  47:     default_logger true
  48:     options({
  49:       exec: executable_path
  50:     })
  51:     action [:enable, :start]
  52:   end
  53: when 'exhibitor'

 Compiled Resource:
 ------------------
 # Declared in /var/chef/cache/cookbooks/zookeeper/recipes/service.rb:46:in `from_file'

 runit_service("zookeeper") do
   provider Chef::Provider::Service::Runit
   action [:enable, :start]
   supports {:restart=>true, :reload=>true, :status=>true}
   retries 0
   retry_delay 2
   service_name "zookeeper"
   pattern "zookeeper"
   status_command "/sbin/sv status /etc/service"
   startup_type :automatic
   sv_bin "/sbin/sv"
   sv_dir "/etc/sv"
   service_dir "/etc/service"
   lsb_init_dir "/etc/init.d"
   options {:exec=>"/opt/zookeeper/zookeeper-3.4.6/bin/zkServer.sh"}
   log true
   default_logger true
   restart_on_update true
   run_template_name "zookeeper"
   log_template_name "zookeeper"
   check_script_template_name "zookeeper"
   finish_script_template_name "zookeeper"
   sv_templates true
   service_mirror # Declared in 

 service("zookeeper") do
   provider Chef::Provider::Service::Simple
   action [:nothing]
   supports {:restart=>true, :reload=>true, :status=>true}
   retries 0
   retry_delay 2
   service_name "zookeeper"
   pattern "zookeeper"
   start_command "/sbin/sv start /etc/service/zookeeper"
   stop_command "/sbin/sv stop /etc/service/zookeeper"
   status_command "/sbin/sv status /etc/service/zookeeper"
   restart_command "/sbin/sv restart /etc/service/zookeeper"
   startup_type :automatic
 end

   cookbook_name "zookeeper"
   recipe_name "service"
 end

 [2014-11-17T10:53:22-08:00] ERROR: Running exception handlers
 [2014-11-17T10:53:22-08:00] ERROR: Exception handlers complete
 [2014-11-17T10:53:22-08:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
 Chef Client failed. 7 resources updated
 [2014-11-17T10:53:23-08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ctippur commented 9 years ago

Let me delete zookeeper. i will paste the error while it is installing zookeeper.

ctippur commented 9 years ago

Here it is .. While installing zookeeper, for whatever reason, it times out! The error was different when I tried 1 hour ago. I used to get:

chef_gem[zookeeper] action install[2014-11-17T10:14:28-08:00] WARN: failed to find gem zookeeper (>= 0) from [http://rubygems.org/]
#########################################
 Recipe: zookeeper::install
   * zookeeper[3.4.6] action installRecipe: <Dynamically Defined Resource>
   * chef_gem[zookeeper] action installWARNING:  Error fetching data: Errno::ETIMEDOUT: Connection timed out - connect(2) (http://rubygems.org/latest_specs.4.8.gz)

 ================================================================================
 Error executing action `install` on resource 'chef_gem[zookeeper]'
 ================================================================================

 NoMethodError
 -------------
 undefined method `full_name' for nil:NilClass

 Cookbook Trace:
 ---------------
 /var/chef/cache/cookbooks/zookeeper/providers/default.rb:36:in `block (2 levels) in class_from_file'
 /var/chef/cache/cookbooks/zookeeper/providers/default.rb:35:in `each'
 /var/chef/cache/cookbooks/zookeeper/providers/default.rb:35:in `block in class_from_file'

 Compiled Resource:
 ------------------
 # Declared in 

 chef_gem("zookeeper") do
   provider Chef::Provider::Package::Rubygems
   action :install
   retries 0
   retry_delay 2
   package_name "zookeeper"
   version "1.4.9"
 end

 ================================================================================
 Error executing action `install` on resource 'zookeeper[3.4.6]'
 ================================================================================

 NoMethodError
 -------------
 chef_gem[zookeeper] (dynamically defined) had an error: NoMethodError: undefined method `full_name' for nil:NilClass

 Cookbook Trace:
 ---------------
 /var/chef/cache/cookbooks/zookeeper/providers/default.rb:36:in `block (2 levels) in class_from_file'
 /var/chef/cache/cookbooks/zookeeper/providers/default.rb:35:in `each'
 /var/chef/cache/cookbooks/zookeeper/providers/default.rb:35:in `block in class_from_file'

 Resource Declaration:
 ---------------------
 # In /var/chef/cache/cookbooks/zookeeper/recipes/install.rb

  22: zookeeper node[:zookeeper][:version] do
  23:   user        node[:zookeeper][:user]
  24:   mirror      node[:zookeeper][:mirror]
  25:   checksum    node[:zookeeper][:checksum]
  26:   install_dir node[:zookeeper][:install_dir]
  27:   action      :install
  28: end

 Compiled Resource:
 ------------------
 # Declared in /var/chef/cache/cookbooks/zookeeper/recipes/install.rb:22:in `from_file'

 zookeeper("3.4.6") do
   action [:install]
   retries 0
   retry_delay 2
   cookbook_name "zookeeper"
   recipe_name "install"
   user "zookeeper"
   mirror "http://apache.mesi.com.ar/zookeeper/"
   checksum "01b3938547cd620dc4c93efe07c0360411f4a66962a70500b163b59014046994"
   install_dir "/opt/zookeeper"
   version "3.4.6"
 end

 [2014-11-17T12:45:31-08:00] ERROR: Running exception handlers
 [2014-11-17T12:45:31-08:00] ERROR: Exception handlers complete
 [2014-11-17T12:45:31-08:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
 Chef Client failed. 6 resources updated
 [2014-11-17T12:45:34-08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ctippur commented 9 years ago

I can run a wget without a issue.

# wget http://rubygems.org/latest_specs.4.8.gz
--2014-11-17 13:29:34--  http://rubygems.org/latest_specs.4.8.gz
Resolving qy1prdproxy01.ie.intuit.net... 10.158.64.16
Connecting to qy1prdproxy01.ie.intuit.net|10.158.64.16|:80... connected.
Proxy request sent, awaiting response... 302 Found
Location: http://production.s3.rubygems.org/latest_specs.4.8.gz [following]
--2014-11-17 13:29:34--  http://production.s3.rubygems.org/latest_specs.4.8.gz
Connecting to qy1prdproxy01.ie.intuit.net|10.158.64.16|:80... connected.
Proxy request sent, awaiting response... 200 OK
Length: 777714 (759K) []
Saving to: “latest_specs.4.8.gz”

100%[=============================================================================================================>] 777,714     1.11M/s   in 0.7s    

2014-11-17 13:29:37 (1.11 MB/s) - “latest_specs.4.8.gz” saved [777714/777714]
jeffbyrnes commented 9 years ago

Added some additional formatting to more easily see said output pasted in by @ctippur. Wrapping code & CLI output in three backpacks will render it in this fashion, which makes things easier to read through.

ctippur commented 9 years ago

Any updates on this please?

ctippur commented 9 years ago

For now, I have installed zookeeper via cli

gem install zookeeper

when I try to use chef now, I see

Could not locate main runit sv_bin at "/sbin/sv". Did you remember to install runit before declaring a "runit_service" resource?

for runit_service[zookeeper]

ctippur commented 9 years ago

I have seen jakedavis's one of earlier comment to include

include_recipe 'runit::default'

on service.rb file - which I did. I still see this error.

ctippur commented 9 years ago

Found couple more issues

had to create a folder called /etc/service Create 2 symlinks

ln -s /etc/sv/zookeeper /etc/service/zookeeper and ln -s /usr/local/bin/sv /sbin/sv

Now when I run, I get this error:

---- Begin output of /sbin/sv start /etc/service/zookeeper ---- STDOUT: warning: /etc/service/zookeeper: unable to open supervise/ok: file does not exist STDERR: ---- End output of /sbin/sv start /etc/service/zookeeper ---- Ran /sbin/sv start /etc/service/zookeeper returned 1

jeffbyrnes commented 9 years ago

@ctippur I haven't investigated at all, but it’s sounding like runit isn’t being set up properly. Are you sure that runit::default is happening before the Zookeeper runit service is being managed/installed?

By the way, @jakedavis, it seems as though, if we’re using runit, we should include runit::default at line 46 of zookeeper::service. Any reason we’re not doing that if it’s definitely needed? Users can alter that recipe’s behavior using the runit cookbook’s attributes in a wrapper cookbook if need be.

ctippur commented 9 years ago

I am not sure but I do see that runit gets installed earlier.

On Wed, Nov 19, 2014 at 8:18 AM, Jeff Byrnes notifications@github.com wrote:

@ctippur https://github.com/ctippur I haven't investigated at all, but it’s sounding like runit isn’t being set up properly. Are you sure that runit::default is happening before the Zookeeper runit service is being managed/installed?

By the way, @jakedavis https://github.com/jakedavis, it seems as though, if we’re using runit, we should include runit::default at line 46 of zookeeper::service https://github.com/SimpleFinance/chef-zookeeper/blob/d922ed6d0cda600200308fa9c42d2ff12928b3f9/recipes/service.rb#L46. Any reason we’re not doing that if it’s definitely needed? Users can alter that recipe’s behavior using the runit cookbook’s attributes in a wrapper cookbook if need be.

— Reply to this email directly or view it on GitHub https://github.com/SimpleFinance/chef-zookeeper/issues/112#issuecomment-63665979 .

jakedavis commented 9 years ago

Hey all, I am on vacation / at Clojure/conj this week and won't be able to help until next week. Sorry.

jeffbyrnes commented 9 years ago

@ctippur if runit is being installed properly, you shouldn’t need to create/symlink anything. The runit_service LWRP should be placing the Zookeeper service in the right place.

This seems to be an issue with installed the RubyGem via the chef_gem resource. I’m not entirely sure why you’re able to manually install said gem, but unable to do so using Chef & it’s chef_gem resource.

ctippur commented 9 years ago

Jeffbyrnes,

I agree. I removed runit pkg and reinstalled the rpm

I see this installed now: runit-2.1.1-3mdv2011.0.x86_64

In the linking section, I still see this issue

link[/etc/service/zookeeper] action create Error executing action create on resource 'link[/etc/service/zookeeper]' No such file or directory - (/etc/sv/zookeeper, /etc/service/zookeeper)

I am not sure if this is a issue with runit

jeffbyrnes commented 9 years ago

@ctippur this isn’t an issue with this cookbook, but instead, how the runit cookbook is creating the zookeeper service, using its runit_service resource.

If you take a look at line 41 of libraries/resource_runit_service.rb in the runit cookbook, you'll see that it’s pulling that value from either the node attribute node['runit']['service_dir'], or falling back to /etc/service.

You can see the attributes being set by runit on lines 39–42 of its default attributes file.

Based on all of this, I believe your issue lies with the setup of runit, not Zookeeper. I’d suggest experimenting with wrapping the runit cookbook and trying to set up a simple service on one of your servers, and seeing if the runit_service resource works correctly that way.

If it doesn’t work well, then the culprit isn’t with the zookeeper cookbook, and we’ll close this issue out.

ctippur commented 9 years ago

Jeff,

You are right. This was a internal issue and got resolved after whitelisting smarden.org (from where it resolves the pkg contents for runit)

jeffbyrnes commented 9 years ago

Great! Closing out.