7 ms·
> Application configuration can be static (just hardcode localhost:3306 for your DB, for example). I wonder how this scales when you have multiple databases, o
by 286c8cb04bda 12y ago
> Application configuration can be static (just hardcode localhost:3306 for your DB, for example).
I wonder how this scales when you have multiple databases, or have read-only slaves, or something like that.
Then developers have to remember to send some traffic to localhost:3306 and some traffic to localhost:3307, and who knows how many more ports.
Documentation never manages to stay up-to-date, so perhaps you could use some sort of Service Discovery Protocol to map these semi-arbitrary numbers to more memorable names.
Then, as long as you know what port the service-discovery-service runs on, you could simply query it for the address to reach your databases.
Maybe that's too much work, though. We could just stuff everything in /etc/hosts.
- igor47 12y agothe way we run synapse at airbnb, we do just stuff everything in /etc/hosts; the code is here: https://github.com/airbnb/smartstack-cookbook/blob/fd97e20bfbf5f4fff64c32f246faca51261976bb/attributes/synapse.rb#L70-L75 https://github.com/airbnb/smartstack-cookbook/blob/fd97e20bf... you do still have to look up the port for your service, but the preferred way to address, e.g., search, is by search.synapse:1234 vs. localhost:1234 . that way, you get better introspection when errors happen, or in your logs. it also looks better in things like newrelic's 'external services' tab.
- robszumski 12y ago> as you know what port the service-discovery-service runs on This bootstrapping problem is why CoreOS runs etcd on every node at localhost:4001.
- icebraining 12y agoDocumentation never manages to stay up-to-date, so perhaps you could use some sort of Service Discovery Protocol to map these semi-arbitrary numbers to more memorable names. That already exists, it's called getservbyname(). It gets the mapping from /etc/services, which would also serve as reliable documentation (since it's "executable", in a sense).