-
Notifications
You must be signed in to change notification settings - Fork 19
Samples Connect
veny edited this page Nov 2, 2012
·
9 revisions
# create client for http://localhost:2480 by default
client = Orientdb4r.client
# or
client = Orientdb4r.client :host => 'any.host.com', :port => 2480, :ssl => false
client.connect :database => 'temp', :user => 'admin', :password => 'admin'client = Orientdb4r.client :nodes => [{:host => '1.domain.com'}, {:host => '2.domain.com', :port => 2481}]
# or with RoundRobin load balancing and Recover Time
client = Orientdb4r.client :nodes => [{}, {:port => 2481}], :load_balancing => :round_robin, :lb_recover_time => 2- default mode is :sequence which calls cluster nodes in the order of nodes defined by the client initialization (next node will be used if the current one fails)
- :round_robin assigns work in round-robin order per nodes defined by the client initialization.
- when a server node is down due to maintenance or a crash, load balancer will use the recover-time as a delay before retrying the downed server node
client.disconnect# additional authentication to the server with a user that has rights to 'server.info' resource
client.server :user => 'root', :password => 'root'
=> {"connections"=>[{"connectionId"=>"9", "remoteAddress"=>"/127.0.0.1:49546", "db"=>"-", "user"=>"-", ...