【问题标题】:pgAgent fails to connect database :'fe_sendauth: no password supplied' (in Windows7)pgAgent 无法连接数据库:'fe_sendauth:未提供密码'(在 Windows7 中)
【发布时间】:2020-03-01 01:43:15
【问题描述】:

请帮帮我。我有一些关于 pgAgent 的问题。

[环境]

DB : PostgreSQL 9.3

OS : Window 7

OS login ID : someid@mail.com

pgAdmin login ID : postgres

pgAgent user : postgres 

pgAgent schema belongs to: postgres DB

DB that I'll treat : testDB  (In Step configuration, I specified 'testDB' as Database.
                   Connection type is 'local'. Connection string is empty.)

DB server : local machine (my laptop computer)

我安排了 pgAgent 作业,但它无法连接数据库。

输出消息(pgAdmin>统计)

[Warning] Couldn't get a connection to the database (pgAgent)

(什么数据库?有2个数据库。'postgres'和'testDB'。我会处理'testDB'。然后无法连接到哪个数据库?)

Windows 事件查看器

Failed to create new connection to database 'testDB':'fe_sendauth: no password supplied'

我的 pgpass.conf

localhost:5432:postgres:postgres:[pgAdmin password for postgres]
localhost:5432:testDB:postgres:[pgAdmin password for postgres]

我的 pg_hba.conf

@remove-line-for-nolocal@# "local" is for Unix domain socket connections only

@remove-line-for-nolocal@local   all             all                                     @authmethodlocal@
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 @authmethodhost@
# Allow replication connections from localhost, by a user with the
# replication privilege.
@remove-line-for-nolocal@#local   replication     @default_username@                                @authmethodlocal@
#host    replication     @default_username@        127.0.0.1/32            @authmethodhost@
#host    replication     @default_username@        ::1/128                 @authmethodhost@

我的 pgAgent 命令选项(服务>pgAgent>属性>常规选项卡)

C:\Program Files (x86)\pgAgent\bin\pgagent.exe RUN pgAgent host=localhost port=5432 user=postgres dbname=postgres

pgAgent 服务登录 ID(Service>pgAgent>Property>Logon 选项卡)

id : someid@mail.com

pwd : [ someid@mail.com's password ]

[结论]

pgpass.conf 中的密码设置对于我所知道的任何事情来说似乎都是错误的。 或 pg_hba.conf 或 Services>pgAgent>Logon 中的登录 ID 其实..我真的不明白这是怎么回事。^^

提前感谢您的帮助^^

【问题讨论】:

  • Windows 事件查看器显示“与 testDB 的连接因密码而失败。”那么testDB密码的问题呢? (不是具有 pgAgent 架构的 postgres 数据库。登录到 postgres 数据库成功。)如果是这样,我该如何设置 testDB 密码?
  • 我在步骤配置中将连接类型更改为“远程”(从“本地”)。并将连接字符串设置为 'user=postgres host=localhost port=5432 dbname=testDB password=[pgAdmin password for postgres]'。现在,工作成功。但是在 testDB 中什么也没发生。刚刚工作在统计面板上没有错误地结束。就这样。并且我想在 pgpass.conf 中设置密码。还有其他想法吗?
  • 因为 someid@mail.com ?我应该创建“postgres”操作系统 ID 吗?并使用它登录 pgAgent ?
  • 现在我正在尝试在我的 Windows 7 上创建“postgres”操作系统 ID。但我做不到。对于其他帐户没有问题。但对于“postgres”,我做不到。哈...不容易...
  • 我猜 pgAgent 找不到 pgpass.conf 文件。所以我正在尝试制作“postgres”操作系统 ID。

标签: windows-7 postgresql-9.3 pgagent


【解决方案1】:

美好的一天...我解决了 ^^

[解决方案]

I made other OS login ID. (NOT need to be 'postgres' !!)
And put pgpass.conf in that ID's AppData\Roaming\postgresql

[原因]

pgAgent could not find pgpass.conf in login ID's directory.

我说我的操作系统登录 ID 是 someid@mail.com。

但是 someid@mail.com 的真实姓名(C:\Users 中的文件夹名称)是'SOME NAME TEST'

不一样的!!

当我在服务中检查登录 ID 时,pgAgent 的登录 ID 是 '.\someid@mail.com'。

我猜 pgAgent 试图在 'C:\Users\someid@mail.com\AppData\Roaming\postgresql' 中找到 pgpass.conf。

但是没有这样的目录。!!

我的 pgpass.conf 位于 'C:\Users\SOME NAME TEST\AppData\Roaming\postgresql'

我以随意的方式创建了另一个 OS ID 'anyname'。 (控制面板>帐户管理。)

login ID : anyname

real name : anyname ( C:\Users\anyname )

那是一样的! ^^

并将pgpass.conf放在'C:\Users\anyname\AppData\Roaming\postgresql'

然后在服务中将 pgAgent 的登录 ID 更改为 '.\anyname'。

现在效果很好^^

【讨论】:

    【解决方案2】:
    SET PGPASSWORD=<PassWord>
    pg_dump -h <HostName> -p 5432 -U <UserName> -F c -b -v -f %BACKUP_FILE% <DATABASENAME>
    

    来源:https://wiki.postgresql.org/wiki/Automated_Backup_on_Windows

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      • 2014-06-16
      • 1970-01-01
      • 1970-01-01
      • 2021-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多