NoBrainerORM / nobrainer

Ruby ORM for RethinkDB
http://nobrainer.io/
Other
387 stars 49 forks source link

id value other then default? can config app to work with 2 ip? #248

Closed chengjk84 closed 6 years ago

chengjk84 commented 6 years ago

i am writing a program with blockchain like data store, and plan to use rethinkdb to store those data... i wonder if it is possible to declare custom id in model rather then using the predefined one because hope to store the id using the hash of previous data... at the i've create extra field to store it which i don't think would be ideal...

on configuration side, i currently having 2 rethinkdb proxy running on on docker swarm manager, point to my app to 1 of those ip... but if i shutdown manager1, i have to manually change the ip on config to manager2... is it possible to those 2 ips or i have to configure proxy on machine level or having load balancer to point to those 2 proxy?

nviennot commented 6 years ago

You can use something like this:

class Model
  field :id, :primary_key => true, :default => { some_hash() }
end

You can configure NoBrainer to use the two IPs instead of one by specifying a list of URLs in the configuration.

chengjk84 commented 6 years ago

thanks...