當我要建立EDB的JOB,執行pgagent的daemon,
$ pgagent -s ~/pgagent.log hostaddr=10.10.10.1 port=5888 dbname=edb user=enterprisedb
這時,在~/.pgpass裡面,己經有列了相關的密碼資訊
$ cat /home/conbar/.pgpass
10.10.10.1:5888:*:enterprisedb:password
在~/pgagent.log裡面,出現了無法連線的錯誤:
$ cat /home/conbar/pgagent.log
WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 2): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 3): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 4): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 5): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 6): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 7): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 8): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 9): fe_sendauth: no password supplied
WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth: no password supplied
ERROR: Stopping pgAgent: Couldn't establish the primary connection with the database server.
後來,在系統hosts檔中,加入該主機的hostname後,改以hostname代替IP address,就能夠正常運行。
(Ubuntu)
$ sudo vi /etc/hosts
在hosts中,加入一行,
10.10.10.1 test01
然後,改以底下指令執行pgagent,
$ pgagent -s ~/pgagent.log hostaddr=test01 port=5888 dbname=edb user=enterprisedb
在Server端,可以看到pgagent已連線至資料庫,
edb=# SELECT * FROM pgagent.pga_jobagent;
jagpid | jaglogintime | jagstation
--------+----------------------------------+---------------
12682 | 24-SEP-10 11:32:49.483639 +08:00 | conbar-laptop
(1 rows)