ruby zookeeper

Ruby 2017. 2. 7. 10:58



ruby 공부차, ruby에서 zookeeper 클라이언트(https://github.com/zk-ruby/zookeeper)를 사용한 예시이다. 



require 'json'

require 'zookeeper'


@zookeeper = Zookeeper.new("zk1.plus.google.com:2181")

@root_key = "redis"


@zookeeper.get_children(:path => @root_key).tap do |node|

  queue = node[:children]

  while ! queue.empty? do

    children_path = queue.shift

    child_node = @zookeeper.get_children(:path => @root_key + "/" + children_path)

    children_queue = child_node[:children]

    ........

    

  end

end



'Ruby' 카테고리의 다른 글

geminabox 설치/실행  (0) 2017.10.24
gem 설치 디버깅하기  (0) 2017.10.20
[ruby] http call 예시  (0) 2017.01.06
[capistrano] 다른 task 호출하기  (0) 2016.12.07
ruby on rails 애플리케이션 실행하기  (0) 2016.10.12
Posted by '김용환'
,