0

我正在尝试在 CentOS7 上设置 Icinga 2 并按照官方文档中的说明进行操作。[ https://docs.icinga.com/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/getting-started][1 ]。我已经创建了数据库和用户作为 icinga。我面临以下问题 psql: FATAL: password authentication failed for user "icinga" when trying to import the Icinga 2 IDO schema using the following commands

   export PGPASSWORD=icinga and psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql

下面是我正在使用的 pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# icinga
local   icinga      icinga                            md5
host    icinga      icinga      127.0.0.1/32          md5
host    icinga      icinga      ::1/128               md5
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident
4

2 回答 2

0

尝试改变

local   all             all                                     peer

至:

local   all             all                                     md5
于 2017-07-13T05:34:29.717 回答
0

在 Ubuntu Bionic 上有同样的问题,可以通过显式添加 localhost 作为主机来解决:

export PGPASSWORD=icinga
psql -U icinga -d icinga -h localhost < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
于 2020-03-02T03:58:53.523 回答