NutzCN Logo
问答 采用druid+多数据源的方式 监控缺失
发布于 2816天前 作者 qq_3c29d04b 5061 次浏览 复制 上一个帖子 下一个帖子
标签:

nutz一开始只加载了initdatasource-1 没有同时加载多个数据源 是否会导致监控只有主数据源的监控的问题?

6 回复

现在我是4个库 有个正在设计还没贴 现在druid的监控只能显示主数据源的那个 没有其他的数据源信息

var ioc = {

	conf : {
		type : "org.nutz.ioc.impl.PropertiesProxy",
		fields : {
			paths : [ "custom/" ]
		}
	},
	dao3 : {
		type : "org.nutz.dao.impl.NutDao",
		args : [ {
			refer : "cbapsdb"
		} ]
	},
	cbapsdb : {
		type : "com.alibaba.druid.pool.DruidDataSource",
		events : {
			create : "init",
			depose : 'close'
		},
		fields : {
			url : {
				java : "$conf.get('db.url')"
			},
			username : {
				java : "$conf.get('db.username')"
			},
			password : {
				java : "$conf.get('db.password')"
			},
			testWhileIdle : true,
			validationQuery : "select 1",
			maxActive : 100,
			maxWait : 15000,
			filters : "mergeStat",
			connectionProperties : "druid.stat.slowSqlMillis=2000"

		}
	},
	dao2 : {
		type : "org.nutz.dao.impl.NutDao",
		args : [ {
			refer : "cpospdb"
		} ]
	},
	dao : {
		type : "org.nutz.dao.impl.NutDao",
		args : [ {
			refer : "cpospasdb"
		} ]
	},
	cpospdb : {
		type : "com.alibaba.druid.pool.DruidDataSource",
		events : {
			create : "init",
			depose : 'close'
		},
		fields : {
			url : "jdbc:mysql://25.0.89.66:3308/cpospdb?useUnicode=true&characterEncoding=UTF8",
			username : "wdb_cposp",
			password : "FguiheCRtSd!",
			testWhileIdle : true,
			validationQuery : "select 1",
			maxActive : 100,
			maxWait : 15000,
			filters : "mergeStat",
			connectionProperties : "druid.stat.slowSqlMillis=2000"
		}
	},
	cpospasdb : {
		type : "com.alibaba.druid.pool.DruidDataSource",
		events : {
			create : "init",
			depose : 'close'
		},
		fields : {
			url : "jdbc:mysql://25.0.89.66:3309/cpospasdb?useUnicode=true&characterEncoding=UTF8",
			username : "wdb_cpospas",
			password : "OpCwFDawRtFV#",
			testWhileIdle : true,
			validationQuery : "select 1",
			maxActive : 100,
			maxWait : 15000,
			filters : "mergeStat",
			connectionProperties : "druid.stat.slowSqlMillis=2000"
			
		}
	}
};

@Rekoe 我这边是希望分别显示

是因为还没取dao2,dao3,dao4吧
第一次取的时候才会初始化

//在MainSetup.init方法内添加这样的代码

ioc.get(Dao.class, "dao2");
ioc.get(Dao.class, "dao3");
ioc.get(Dao.class, "dao4");
ioc.get(Dao.class, "daoAgainAgainAgain");
ioc.get(Dao.class, "daoForever");

添加回复
请先登陆
回到顶部