I dont think is possible to use the same datasource across topologies/bolts how would u share such a resource across multiple jvms and threads?
On Wed, Jun 8, 2016 at 2:49 PM, Jacob Johansen <[email protected]> wrote: > In the HikariCPConnectionProvider you need to set the connection pool > smaller or in your MySQL DB configure, increase the number of > available connections. > Jacob Johansen > > > On Wed, Jun 8, 2016 at 6:06 AM, Alex Chew <[email protected]> wrote: > > Hi all, > > > > > > I got Too Many Connections error while running my topology in test > > environment. I am checking below codes, > > > > > > //prepare JDBC configuration > > Map jdbcConfigMap = Maps.newHashMap(); > > jdbcConfigMap.put("dataSourceClassName", > > > prop.getProperty("mysql.dataSource.className"));//com.mysql.jdbc.jdbc2.optional.MysqlDataSource > > jdbcConfigMap.put("dataSource.url", > > prop.getProperty("mysql.url"));//jdbc:mysql://localhost/test > > jdbcConfigMap.put("dataSource.user", > > prop.getProperty("mysql.user"));//root > > jdbcConfigMap.put("dataSource.password", > > prop.getProperty("mysql.password"));//password > > config.put(JDBC_CONF, jdbcConfigMap); > > this.connectionProvider = new > > HikariCPConnectionProvider(jdbcConfigMap); > > > > This will create a new HikariCPConnectionProvider each Spout/Bolt task. > By > > default each connectionProvider will initial 10 connections. Totally > there > > have 48 tasks. This will create 480 connections while MySQL > max-conenctions > > is 400. I am going to change this, but I don't know how to force all > tasks > > running on my 4 supervisor nodes to use the same dataSource? > > > > > > Thanks in advance. > > > > Alex > > > > > > >
