Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Provide a simple way to specify multiple servers #3

Closed
eric opened this Issue May 5, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Member

eric commented May 5, 2012

It would be nice to make it easier to configure multiple servers.

Here's a snippet of what I did:

    zoo_cfg_hash = {}
    count.times do |idx|
      zoo_cfg_hash["server.#{idx}"] = "127.0.0.1:#{BASE_PORT + 100 + idx}:#{BASE_PORT + 200 + idx}"
    end

    zoo_cfg_hash['initLimit'] = '10'
    zoo_cfg_hash['syncLimit'] = '5'

    count.times do |idx|
      @servers << ZK::Server.new do |config|
        config.myid = idx
        config.base_dir = File.expand_path("../data/zookeeper-#{idx}", __FILE__)
        config.client_port = BASE_PORT + idx
        config.force_sync = false
        config.zoo_cfg_hash = zoo_cfg_hash
      end
    end

    @servers.each { |server| server.run }

@ghost ghost assigned slyphon May 6, 2012

Member

eric commented Sep 8, 2013

👍

@eric eric closed this Sep 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment