Class: DCHouse

Inherits:
DataHouse show all
Defined in:
lib/common/data_house.rb

Overview

  • datacenter: datacenter1 host: 10.81.13.169 username: space password: spaceapptest datacenterpath: /home/space/datacenter/ db01:

    dbpath: /home/space/database/mysql5.1.30/
    dbuser: root
    dbpass: "123456"
    dbport: "3308"
    

    db02:

    dbpath: /home/space/database/mysql5.22/
    dbuser: root
    dbpass: "123456"
    dbport: "3308"
    

Constant Summary collapse

@@instance =
nil

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataHouse

#initialize, #size

Constructor Details

This class inherits a constructor from DataHouse

Class Method Details

.get_instanceObject



372
373
374
375
# File 'lib/common/data_house.rb', line 372

def self.get_instance
	@@instance = new("datacenter") unless @@instance
	@@instance
end

Instance Method Details

#get_by_name(name) ⇒ Object

功能: 根据名字获取数据中心的相关信息

Example: dc = DCHouse.get_instance.get_by_name(“datacenter1”) str = dc str = dc[“dbpath”]



384
385
386
387
388
# File 'lib/common/data_house.rb', line 384

def get_by_name(name)
	@data_house.find do |u|
		u["datacenter"] == name if u.key? "datacenter"
	end
end