`
myreligion
  • 浏览: 202396 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

4. 配置guzz_app.properties

    博客分类:
  • guzz
阅读更多

一般使用:

guzz_app.properties用来存储系统各部分的配置信息,最常见的为数据库配置和service配置。

guzz_app.properties文件组织类似于mysql的配置文件,每一行为1个配置项,以#开头的行为注释。

[groupName] 用来标记一个配置组的开始,这个标记以下以及下一个[xxx]以上的每一行,为groupName的1条配置项,如:

[masterDB]
xxx=xxx
xxx=xxx

[slaveDB]
....
 

groupName为组名称,也叫配置(信息)组,组名称可以重复出现,用于为一个配置组定义多组配置,最常见的情况是配置多个[slaveDB]用于定于多个从数据库源。

下面是一个典型的配置实例:

#guzz app config file.

#master db
[masterDB]
guzz.identifer=blogMasterDB
guzz.IP=localhost
guzz.maxLoad=120
driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=UTF-8&useServerPrepStmts=true
user=root
password=root
acquireIncrement=10
idleConnectionTestPeriod=60

[updateMasterDB]
guzz.identifer=incUpdateDB1
guzz.IP=localhost
guzz.maxLoad=20
driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost:3306/guzzSlowUpdate?useUnicode=true&characterEncoding=UTF-8&useServerPrepStmts=true
user=slowupdate
password=slowupdate
acquireIncrement=10
idleConnectionTestPeriod=60

[logMasterDB]
guzz.identifer=logUpdateDB1
guzz.IP=localhost
guzz.maxLoad=20
driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost:3306/guzzLogDB?useUnicode=true&characterEncoding=UTF-8&useServerPrepStmts=true&cachePrepStmts=truee&prepStmtCacheSize=4096&prepStmtCacheSqlLimit=4096&rewriteBatchedStatements=true
user=loguser
password=loguser
acquireIncrement=10
idleConnectionTestPeriod=60

[guzzSlowUpdate]
#max size of cached queue
queueSize=20480
batchSize=2048

[guzzSlowUpdateServer]
#max size of cached queue
batchSize=50
pageSize=40
combinePageCount=10

[guzzDBLogServiceClient]
#max size of cached queue
batchSize=2048
queueSize=20480

#debug settings
[guzzDebug]
#runMode=debug/production
runMode=debug
#onError=halt/log/ignore
onError=halt
printSQL=false
printSQLParams=false
ignoreDemonThreadSQL=true


############################### fundamental services #####################
#other services' configurations go here...

  与配置管理服务器集成

配置管理服务器可以完成对所有系统配置文件的统一管理,以及在配置发生改变时,对应用的推送通知。目前guzz还没有开发默认的配置管理服务器,也不支持配置服务器的推送。不过可以通过查询接口,在应用启动时从配置管理服务器查询配置。

实现自己的配置管理,需要实现如下接口:

 org.guzz.config.ConfigServer

并且在guzz.xml中配置为自己的实现类。

<config-server>
	<server class="your config server's client implementation">
		<param name="param1" value="somevalue" />
		<param name="param2" value="somevalue2" />
        </server>
</config-server>
 

 guzz在初始化时将会初始化此处定义的实现类,并将param参数以javabean方式注入到实现类中。name为实现类属性,value为 值。value类型允许为java.lang.String或者org.guzz.io.Resource。默认 LocalFileConfigServer中resouce参数的注入方法即为:public void setResource(org.guzz.io.Resource r) ;

在所有配置注入完成后,guzz调用startup() 启动。在guzz退出时,调用shutdown() 关闭。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics