Confluence 6 新 Confluence 安装配置一个数据源连接

如果在你的 Tomcat 中配置了数据源,并且Confluence 设置指南在安装的时候检测到这个配置的时候,配置数据源的选项将会提供给你进行配置。入股你希望使用数据源,请参考下面的配置。

1. 停止 Confluence

在 Confluence 的配置指南中,你将会提示选择你的数据库,在这个时候,你应该:

  1. 使用 bin/stop-confluence.sh or bin/stop-confuence.bat 停止  Confluence。
  2. 备份下面的文件,以防止你可能需要重新恢复你的配置:
    • <installation-directory>/conf/server.xml
    • <installation-directory>/confluence/WEB-INF/web.xml
    • <home-directory>/confluence.cfg.xml

2. 添加你的数据库驱动

拷贝你的数据库驱动到  <installation-directory>/lib 目录中。

下面的连接是有关如果找到你的数据库驱动:

  • PostgreSQL:捆绑到了 Confluence 中, 在<installation-directory>/confluence/WEB-INF/lib/postgresql-x.x.x.jar 
  • Microsoft SQL Server:捆绑到了 Confluence 中, 在 <installation-directory>/confluence/WEB-INF/lib/mssql-jdbc-x.x.x.x.jar 
  • MySQL:进入 Database JDBC Drivers  页面来下载驱动
  • Oracle:进入 Database JDBC Drivers  页面来下载驱动

3. 在 Tomcat 中配置数据源

下一步,将数据源配置到 Tomcat 中。

  1. 编辑 <installation-directory>/conf/server.xml
  2. 找到下面的行:
    < Context path = "" docBase = "../confluence" debug = "0" reloadable = "true" >
    <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is
    specified in confluence/WEB-INF/classes/log4j.properties -->
  3. 插入下面的数据源资源  Resource  元素。针对你具体使用的数据库不同,需要做一些修改(插入 Context  元素,在 <Context.../> 行,同时在 Manager 之前)。
     PostgreSQL...
    <Resource name= "jdbc/confluence" auth= "Container" type= "javax.sql.DataSource"
         username= "<database-user>"
         password= "<password>"
         driverClassName= "org.postgresql.Driver"
         url= "jdbc:postgresql://<host>:5432/<database-name>"
         maxTotal= "60"
         maxIdle= "20"
         validationQuery= "select 1" />  
     Microsoft SQL Server...
    <Resource name= "jdbc/confluence" auth= "Container" type= "javax.sql.DataSource"
         username= "<database-user>"
         password= "<password>"
        driverClassName= "com.microsoft.sqlserver.jdbc.SQLServerDriver"
         url= "jdbc:sqlserver://<host>:1433;database=<database-name>"
         maxTotal= "60"
         maxIdle= "20"
         validationQuery= "select 1" />

    如果你正在使用的 Confluence 6.3 及其早期的版本,针对 SQL Server 数据库服务器,你 制定jTDS 驱动。请参考  Configuring a SQL Server Datasource in Apache Tomcat 中的文档来进行配置。

     MySQL...
    <Resource name= "jdbc/confluence" auth= "Container" type= "javax.sql.DataSource"
         username= "<database-user>"
         password= "<password>"
         driverClassName= "com.mysql.jdbc.Driver"
         url= "jdbc:mysql://<host>:3306/<database-name>?useUnicode=true&amp;characterEncoding=utf8"
         maxTotal= "60"
         maxIdle= "20"
         defaultTransactionIsolation= "READ_COMMITTED"
         validationQuery= "Select 1" />
     Oracle...
    <Resource name= "jdbc/confluence" auth= "Container" type= "javax.sql.DataSource"
         driverClassName= "oracle.jdbc.OracleDriver"
         url= "jdbc:oracle:thin:@<host>:1521:<SID>"
         username= "<database-user>"
         password= "<password>"
         connectionProperties= "SetBigStringTryClob=true"
         accessToUnderlyingConnectionAllowed= "true"
         maxTotal= "60"
         maxIdle= "20"
         maxWaitMillis= "10000" />

    See how to find your Oracle URL.

    替换 <database-user>, <password>, <host><database-name> (或针对 Oracle 使用 <SID>  )来配置你自己的数据库。你同事还需要修改这个端口,如果你的数据库没有在默认端口中运行的话。

  4. 配置连接池和其他属性,请参考 Apache Tomcat 8 Datasource documentation 页面来获得更多的信息。
     配置属性...
  5. 如果你计划使用协作编辑,你需要确定:
    • 你需要使用支持的数据库驱动。如果你使用了不支持的数据库驱动或者自定义的 JDBC 驱动,或者你数据源中的  driverClassName,协作写编辑将会失败。请参考 Database JDBC Drivers 页面中的内容。
    • 你数据库连接池需要允许有足够的连接数来同时支持  Confluence 和 Synchrony (默认的最大连接池数量为 15)。
    • 在你的数据库中,你使用简单用户名和密码授权。

4. 配置 Confluence web 应用

配置 Confluence 来使用这个数据源:

  1. 编辑 <CONFLUENCE_INSTALLATION>/confluence/WEB-INF/web.xml.
  2. </web-app>  元素之前插入下面的内容:
< resource-ref >
   < description >Connection Pool</ description >
   < res-ref-name >jdbc/confluence</ res-ref-name >
   < res-type >javax.sql.DataSource</ res-type >
   < res-auth >Container</ res-auth >
</ resource-ref >

5. 重启 Confluence 然后继续设置进程

现在你的数据源已经成功配置了,你可以继续你 Confluence 的安装进程了。

  1. 使用 bin/start-confluence.sh 或  bin/start-confuence.bat 来重启你的 Confluence
  2. Go to http://localhost:8090 to return to the setup wizard.
  3. 当提示选择 My own database (datasource)
  4. 输入你数据源的 JNDI 名称,例如,java:comp/env/jdbc/confluence
  5. 针对弹出的内容来完成你 Confluence 的设置。

https://www.cwiki.us/display/CONFLUENCEWIKI/Configuring+a+datasource+connection

猜你喜欢

转载自www.cnblogs.com/huyuchengus/p/9157825.html
今日推荐