Postgres和Atlassian Jira:司机问题

时间:2014-09-22 14:17:11

标签: postgresql jira

我正在尝试使用centOS 32位设置服务器来安装Atlassian Jira。 我按照https://confluence.atlassian.com/display/JIRA/Installing+JIRA

上的官方Atlassian安装指南进行了操作

现在我正在运行安装向导,我需要配置PostgreSQL数据库。在我的centOS上,我通过yum安装了版本8.4.20。 但是,我很难设置Jira。 Postgres正在运行,我可以通过Linux控制台登录,但是当我测试与数据库的连接时,我收到以下错误:

Error connecting to database
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Connection refused

此外,当我输入完整的公共IP地址时会出现此错误。如果我插入localhost,我会得到:

Error connecting to database
FATAL: Ident authentication failed for user "jiradbuser"

如果我插入

http://<public ip> 

我得到以下内容:

Error connecting to database
No suitable driver found for jdbc:postgresql://http://<public ip>:5432/jiradb

但是,我将我的jdbc驱动程序放入/ opt / atlassian / jira / lib,其名称为postgresql-8.4-703.jdbc4.jar。 Postgresql版本是8.4.20。

我在哪里做错了?

3 个答案:

答案 0 :(得分:4)

  

连接被拒绝。检查主机名和端口是否正确以及postmaster是否接受TCP / IP连接。

默认情况下,PostgreSQL仅侦听本地环回接口,因此无法连接到公共IP。如果您从localhost连接,则无需使用localhost

  

致命:用户“jiradbuser”的身份验证失败

这很好,它表明你成功连接到PostgreSQL,然后在尝试登录时遇到身份验证错误。

您的PostgreSQL服务器安装默认为ident身份验证TCP / IP连接,但JIRA应用程序未在名为“jiradbuser”的unix用户下运行,因此连接被拒绝。将pg_hba.conf更改为使用md5而不是ident,并为用户设置密码。请参阅the client authentication chapter in the docs,尤其是pg_hba.conf

  

找不到合适的jdbc驱动程序:postgresql:// http://:5432 / jiradb

我不知道你在哪里知道这个网址会起作用......

你想要这样的东西:

jdbc:postgresql://localhost:5432/jiradb

答案 1 :(得分:1)

我遇到了同样的问题。我可以解决它从maven存储库设置postgres驱动程序.jar到\ target \ jira \ webapp \ WEB-INF \ lib \

答案 2 :(得分:0)

这里的问题相当晚,但我认为我会添加几个来帮助未来,倒退:

找不到合适的jdbc驱动程序

    A while ago Atlassian didn't distribute the PostGreSQL JDBC driver file with the JIRA releases. They have been doing this for a while now (I'd say since mid 2013) - regardless, the driver file belongs in the <jira-base>/lib directory unless you are doing a WAR install, in which case you shouldn't, and just put the driver file in the lib directory anyway

致命:对用户&#34; jiradbuser&#34;

的身份验证失败
1. Listen on a socket if you need to - The best approach to this is to look at your JDBC driver URL - if it has an IP/hostname other than 127.x.x.x or 'localhost' you need to modify PostGreSQL to listen to a TCP port by modifying your postgresql.conf file to enable listening on ports. Just find the file, back it up, then open it and search for localhost, read the file comments and make the correct change. If you find yourself looking around in multiple locations in the file or changing more than a single word you are trying too hard - restore your backup and try again. Just remember to *stop* and *start* your postgres db cluster when you are done

2. enable the correct login METHOD in pg_hba.conf (same directory as the postgresql.conf file - on unix typically under /etc/postgresql/<version>/main/.) - this is difficult to writeup in brief but I'll try
    1. backup the pg_hba.conf file - I ain't foolin, this is something you'll be happy with later - back the sucker up
    2. edit the file 
    3. go to the bottom of the file - look for the last line like "# TYPE  DATABASE        USER            ADDRESS                 METHOD"
    4. comment out every line under this 'table heading' line
        - the reason to do this is that the package maintainers often fall back to commenting here and so you'll have 2 commented out lines and then one line that isn't commented out - and you'll never notice it - it's easiest to just start off with commenting out the whole block of stuff so there isn't a single uncommented line in the file
        - add a two lines for the postgres user to connect local and to a db socket unless your corporate security does not allow - something like this:
        local   all             postgres        127.0.0.1/32     peer 
        host    all             postgres        127.0.0.1/32     trust
        - add a line for your jiradbuser to connect to the newly created database via sockets with md5 encryption. md5 isn't the best - there are other options to google - if you use md5, it'd look something like this:
        host    jiraversiondb   jiradbuser      127.0.0.1/32     md5

然后保存文件,重新启动postgres集群(使用停止并启动,而不是使用&#39; restart&#39;选项),并从命令行测试连接。

如何从命令行测试连接

如果您登录到安装了postgres工具的unix系统,您应该能够模仿JIRA服务器尝试连接到数据库的连接尝试。如果您无法从命令行连接到新的postgresql数据库,那么JIRA无法实现这一目标。此外,您将获得更好的错误消息。所以要做到这一点,只需打开一个shell并输入(在适当的地方替换变量 - &#39;&lt;&#39;&#39;&#39;字符中的内容) - 这些的所有值都是在你的头脑和postgresql.conf文件中:

psql --port <port - default is 5434> --username=<db user name> --password --dbname=<database name>

一旦你可以从命令行连接,那么JIRA也是一个不错的选择 - 没有承诺,但你会站稳脚跟。

......啊......现在,希望能帮助别人...