Openfire 整合数据库
1.Openfire 开始使用的时候,就会自己创建一个数据库,那个数据库是原先自定义的,他就会在数据库里新建好多以“of”开头的标,比如ofuser,ofproperty...之类的。
2.如果你有原本有一个数据库,又不想跑2套数据库,那就修改ofproperty那个表吧,也可以在Openfire后台管理那里设置不过个人觉得太慢了,建议修改Ofproperty表。
3.主要添加,修改12)处地方,以键值方式添加。
4.
1)admin.authorizedJIDs 设置你的管理员账户后面记得带domain,比喻你的服务器叫做ms.com,你就abc@ms.com
2)jdbcAuthProvider.passwordSQL 这是密码的SQL语句
3)jdbcAuthProvider.passwordType 验证方式
4)jdbcProvider.connectionString连接数据库的语句
5)jdbcUserProvider.allUsersSQL 所有用户
6)jdbcUserProvider.emailField 电子邮件的列名,确实不会设置就新建一个email列,为空也没有问题的。
7)jdbcUserProvider.loadUserSQL
8)jdbcUserProvider.nameField
9)jdbcUserProvider.userCountSQL
10)jdbcUserProvider.usernameField
11)provider.auth.className
12)provider.user.className
对着数据库,有的就修改,没有的就添加。
附上一个SQL脚本
/* Navicat MySQL Data Transfer Source Server : ofdb Source Server Version : 50512 Source Database : test */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `ofproperty` -- ---------------------------- DROP TABLE IF EXISTS `ofproperty`; CREATE TABLE `ofproperty` ( `name` varchar(100) NOT NULL, `propValue` text NOT NULL, PRIMARY KEY (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of ofproperty -- ---------------------------- INSERT INTO `ofproperty` VALUES ('admin.authorizedJIDs', 'admin@abc.com'); INSERT INTO `ofproperty` VALUES ('cache.KrakenRegistrationCache.maxLifetime', '-1'); INSERT INTO `ofproperty` VALUES ('cache.KrakenRegistrationCache.min', '-1'); INSERT INTO `ofproperty` VALUES ('cache.KrakenRegistrationCache.size', '-1'); INSERT INTO `ofproperty` VALUES ('cache.KrakenRegistrationCache.type', 'optimistic'); INSERT INTO `ofproperty` VALUES ('cache.KrakenSessionLocationCache.maxLifetime', '-1'); INSERT INTO `ofproperty` VALUES ('cache.KrakenSessionLocationCache.min', '-1'); INSERT INTO `ofproperty` VALUES ('cache.KrakenSessionLocationCache.size', '-1'); INSERT INTO `ofproperty` VALUES ('cache.KrakenSessionLocationCache.type', 'optimistic'); INSERT INTO `ofproperty` VALUES ('demo.workgroup', 'true'); INSERT INTO `ofproperty` VALUES ('fastpath.database.setup', 'true'); INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordSQL', 'SELECT password FROM testuser WHERE name=?'); INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordType', 'plain'); INSERT INTO `ofproperty` VALUES ('jdbcProvider.connectionString', 'jdbc:mysql://192.168.0.16:3306/test2?user=root&password=1234567'); INSERT INTO `ofproperty` VALUES ('jdbcProvider.driver', 'com.mysql.jdbc.Driver'); INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.allUsersSQL', 'SELECT name FROM testuser'); INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.emailField', 'email'); INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.loadUserSQL', 'SELECT name,email FROM testuser WHERE name=?'); INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.nameField', 'name'); INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.userCountSQL', 'SELECT COUNT(*) FROM testuser'); INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.usernameField', 'name'); INSERT INTO `ofproperty` VALUES ('passwordKey', 'aSikBtr7O7iVQ2A'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.allow.on.match', 'false'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.filter.status.enabled', 'false'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.mask', '***'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.mask.enabled', 'false'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.patterns', 'fox,dog,fuck,草'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.patterns.enabled', 'true'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.rejection.msg', '你的语言不雅。'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.rejection.notification.enabled', 'true'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.violation.notification.by.email.enabled', 'false'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.violation.notification.by.im.enabled', 'true'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.violation.notification.contact', 'admin'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.violation.notification.enabled', 'false'); INSERT INTO `ofproperty` VALUES ('plugin.contentFilter.violation.notification.include.original.enabled', 'false'); INSERT INTO `ofproperty` VALUES ('plugin.userservice.secret', 'qgJRDXP1'); INSERT INTO `ofproperty` VALUES ('provider.admin.className', 'org.jivesoftware.openfire.admin.DefaultAdminProvider'); INSERT INTO `ofproperty` VALUES ('provider.auth.className', 'org.jivesoftware.openfire.auth.JDBCAuthProvider'); INSERT INTO `ofproperty` VALUES ('provider.group.className', 'org.jivesoftware.openfire.group.DefaultGroupProvider'); INSERT INTO `ofproperty` VALUES ('provider.lockout.className', 'org.jivesoftware.openfire.lockout.DefaultLockOutProvider'); INSERT INTO `ofproperty` VALUES ('provider.securityAudit.className', 'org.jivesoftware.openfire.security.DefaultSecurityAuditProvider'); INSERT INTO `ofproperty` VALUES ('provider.user.className', 'org.jivesoftware.openfire.user.JDBCUserProvider'); INSERT INTO `ofproperty` VALUES ('provider.vcard.className', 'org.jivesoftware.openfire.vcard.DefaultVCardProvider'); INSERT INTO `ofproperty` VALUES ('update.lastCheck', '1334894203229'); INSERT INTO `ofproperty` VALUES ('xmpp.auth.anonymous', 'true'); INSERT INTO `ofproperty` VALUES ('xmpp.auth.sharedSecretEnabled', 'true'); INSERT INTO `ofproperty` VALUES ('xmpp.domain', 'jh'); INSERT INTO `ofproperty` VALUES ('xmpp.filetransfer.enabled', 'true'); INSERT INTO `ofproperty` VALUES ('xmpp.session.conflict-limit', '0'); INSERT INTO `ofproperty` VALUES ('xmpp.socket.ssl.active', 'true');
这是个SQL脚本,保存为.sql文件。导入数据库吧。