New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance connection fail-over with master/slave restriction and loadbalancing #209

Merged
merged 1 commit into from Dec 21, 2014

Conversation

Projects
None yet
3 participants
@gmokki

gmokki commented Nov 1, 2014

If multiple hosts are specified in the jdbc connection url then:

  • Adds querying of node writability and possibility to restrict connections to writable or read-only nodes.
  • Adds load balancing of connections.
  • Uses a JVM global cache of known node states.

Based on work by chenhj@cn.fujitsu.com from 2011. I rewrote most of the code, added more documentation and integrated properly the tests.

@davecramer davecramer closed this Dec 18, 2014

@davecramer davecramer reopened this Dec 18, 2014

@davecramer

This comment has been minimized.

Member

davecramer commented Dec 18, 2014

Any chance you can fix the merge issues ?

@gmokki gmokki force-pushed the NitorCreations:master branch 2 times, most recently from d00c8c1 to 8bab06b Dec 19, 2014

Mikko Tiihonen
Enhance connection fail-over with master/slave restriction and add lo…
…ad balancing of connections among multiple hosts. Based on work by chenhj@cn.fujitsu.com

@gmokki gmokki force-pushed the NitorCreations:master branch from 8bab06b to 43b2e36 Dec 19, 2014

@gmokki

This comment has been minimized.

gmokki commented Dec 19, 2014

Rebased on top of latest pgjdbc master.

davecramer added a commit that referenced this pull request Dec 21, 2014

Merge pull request #209 from NitorCreations/master
Enhance connection fail-over with master/slave restriction and load balancing

Thanks !

@davecramer davecramer merged commit 25f6758 into pgjdbc:master Dec 21, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@amarkanth1984

This comment has been minimized.

amarkanth1984 commented Jun 19, 2015

Does the latest release (9.4-1201) contain this enhancement ?

@davecramer

This comment has been minimized.

Member

davecramer commented Jun 19, 2015

Should have as the latest was released Jan 2015 and this was merged on Dec 21, 2014

@amarkanth1984

This comment has been minimized.

amarkanth1984 commented Jun 19, 2015

Thanks Dave !
One last qq ... any recommendation on a java connection pooling library which uses "pgjdbc" (or) "pgjdbc" does support connection pooling ?

@davecramer

This comment has been minimized.

Member

davecramer commented Jun 19, 2015

pgjdbc does not support connection pooling. I have no specific recommendation, but c3p0 seems to work fine

@amarkanth1984

This comment has been minimized.

amarkanth1984 commented Jun 23, 2015

We are currently using c3p0 and it works fine. How can i use it to leverage this feature ? c3p0 only supports providing master postgres connection details. Any suggestions ?

@gmokki

This comment has been minimized.

gmokki commented Jun 24, 2015

Because the load-balancing and fail-over is in the pgjdbc driver, below the connection pool there is no specific support needed in the pool. It just must be able to pass in the required parameters down to the driver to enable this feature (which I'm sure all pools already support).

If on the other hand you would like to monitor which connection is actually active from your application side then I think we need to think what would be the best way to export that information. Would it be through JMX for example. In that case we could even use JMX to allow remotely trigger a fail-over or fall-back.

And about your question about jdbc connection pools. I would go either with the HikariCP or tomcat-jdbc (which can be used as a standalone pool outside tomcat container).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment