Skip to content
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

nacos启动derby异常连接超时 #4170

Closed
MarkBellCN opened this issue Nov 9, 2020 · 0 comments
Closed

nacos启动derby异常连接超时 #4170

MarkBellCN opened this issue Nov 9, 2020 · 0 comments
Labels
kind/enhancement Category issues or prs related to enhancement.
Milestone

Comments

@MarkBellCN
Copy link

version 1.3.2
nacos与influxDB在一台服务器运行时,启动时infulxDB占用磁盘、服务器资源较高的情况下,nacos derby初始化数据文件会有失败的情况。失败之后只能删除nacos\data\derby。
建议增加容错机制或者将初始化连接时间可配置。
private synchronized void initialize(String jdbcUrl) {

HikariDataSource ds = new HikariDataSource();

ds.setDriverClassName(jdbcDriverName);

ds.setJdbcUrl(jdbcUrl);

ds.setUsername(userName);

ds.setPassword(password);

ds.setIdleTimeout(30_000L);

ds.setMaximumPoolSize(80);

ds.setConnectionTimeout(10000L);

DataSourceTransactionManager tm = new DataSourceTransactionManager();

tm.setDataSource(ds);

if (jdbcTemplateInit) {

jt.setDataSource(ds);

tjt.setTransactionManager(tm);

} else {

jt = new JdbcTemplate();

jt.setMaxRows(50000);

jt.setQueryTimeout(5000);

jt.setDataSource(ds);

tjt = new TransactionTemplate(tm);

tjt.setTimeout(5000);

jdbcTemplateInit = true;

}

reload();

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants