PostgreSQL or MySQL in Master/Slave replica

42 views
Skip to first unread message

Felipe Figueroa

unread,
Aug 31, 2015, 8:22:56 AM8/31/15
to LoopbackJS
I moved my postgresql server to Amazon RDS, and a couple of days ago I created a slave replica to paralellize read operations.

I'm struggling to make loopback take advantage of the slave replica, but perhaps there is some advice or good practices I should learn in advance.

Currently, I created a new datasource in parallel to my master postgresql datasource. Some models that I just use for reading operations were manually pointed to the new datasource. However it's clear that's not the proper way to do it.

I feel like I'm missing something here, and it doesn't feel right to manually change the datasource of a model during runtime using operation hooks, which might eventually lead to race conditions.

Raymond Feng

unread,
Sep 2, 2015, 3:42:22 PM9/2/15
to loopb...@googlegroups.com
I don’t have an answer at the moment. The connectors rely on the underlying drivers to support replicas. We or you’ll need to check the mysql/pg drivers to see if it’s possible.

Thanks,

---
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.

StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/2540aebd-cf68-494f-b708-c8fb8396cac9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alan Yang

unread,
Sep 19, 2015, 7:40:36 AM9/19/15
to LoopbackJS
Could you help me how to do "manually change the datasource of a model during runtime using operation hooks"? Because I have the same trouble of this.
Thanks!

Felipe Figueroa於 2015年8月31日星期一 UTC+8下午8時22分56秒寫道:

Kesav Kumar Kolla

unread,
Oct 4, 2015, 10:50:22 AM10/4/15
to LoopbackJS
setup pgpool which can load balance the read queries across master and slaves and sends write queries to master only.  From loopback you connect to pgpool.

HTH
-Kesav
Reply all
Reply to author
Forward
0 new messages