Got it, thank you for explanation.

I wondered why this connect was running. I know that it is better to use filesystem sockets on local machine, just got the same behavior on file sockets and gave a try to tcp setup, but saw this permanent connect.

Thought it was a bacula bug but guess it is really a postgresql library issue.

--

Mursenkov Andrey


On 05/17/2017 09:40 PM, Kern Sibbald wrote:

In looking at your output, I see that you are using a TCP connection. That is not the optimal way or the default way to run Bacula with a local database. On my server:

netstat -nap|grep bacula-dir

I get:

tcp 0 0 0.0.0.0:9101 0.0.0.0:* LISTEN 1660/bacula-dir
unix  2      [ ]         DGRAM                    201036 1660/bacula-dir

I suspect that the "permanent" connection you see is something that the PostgreSQL client library does itself as a control mechanism, and in that case, if that connection drops perhaps the client library ceases to work.

I use the default bacula-dir.conf for the Catalog.

Catalog {
  Name = BackupDB
  dbname = bacula; user = bacula; password = "highly secret"
}

Best regards,

Kern



On 05/17/2017 03:33 PM, Andrey Mursenkov wrote:

Hello, thank you for reply.

But Heartbeat interval is a socket option, and is not what I need.

Let me be more precise:

after completion job in bacula-console:

# netstat -nap|grep ESTABLISHED|grep bacula-dir
tcp 0 0 127.0.0.1:55336 127.0.0.1:5432 ESTABLISHED 10244/bacula-dir tcp 0 0 192.168.63.16:9101 192.168.63.16:51950 ESTABLISHED 10244/bacula-dir

as you can see there is still established database connection after job completion (to 127.0.0.1 port 5432), if I run the second job the same connection is used (no new connection is opened, and the first one remains established)


If I restart database and in the same console try to run job, I get these errors:

17-май 16:16 sup1-dir JobId 0: Fatal error: bdb.h:107 bdb.h:107 query SELECT ClientId,Uname FROM Client WHERE Name='serv1' failed:
...

17-май 16:17 sup1-dir JobId 0: Error: sql_create.c:514 Create DB Client record INSERT INTO Client (Name,Uname,AutoPrune,FileRetention,JobRetention) VALUES ('serv1','',1,31536000,31536000) failed. ERR=...

17-май 16:18 sup1-dir JobId 0: Fatal error: Could not create Client record. ERR=Query failed: INSERT INTO Log (JobId, Time, LogText) VALUES (0,'2017-05-17 16:17:56','sup1-dir JobId 0: Error: sql_create.c:514 Create DB Client record INSERT INTO Client (Name,Uname,AutoPrune,FileRetention,JobRetention) VALUES (''serv1'','''',1,31536000,31536000) failed. ERR=...


and of course no established connection appear in netstat

If it helps to clear the situation I can show tcpdump output.

--

Mursenkov Andrey


On 05/17/2017 04:03 PM, Wanderlei Huttel wrote:
Hello Andrey

As Kern said in that bugreport, "Every job that starts opens a new connection (sometimes during the job additional connections will be opened)."
But is not persistent.

If you are running a command "list files jobid=XXX" of a job with some million of files and you have connection problems, maybe bconsole can be close, but is very rare.
Probably you can have a network issue and not bacula issue

If you have some problem about connection lost with client or storage, is interesting activate the option "Heartbeat Interval" in some Resources:
Heartbeat Interval = 300 seconds  # Is a good configuration

Include the option above in the following files/resources:
bacula-dir.conf - Director, Storage, Client
bacula-fd.conf - FileDaemon (client side)

Best regards

*Wanderlei Hüttel*
http://www.huttel.com.br

2017-05-17 9:32 GMT-03:00 Andrey Mursenkov <[email protected] <mailto:[email protected]>>:

    Hello,

    what connection type does bacula-dir use while connecting to
    database,
    permanent or not?

    If bacula-dir uses permanent connection does it support reconnect?


    Here what I can see:

    When I launch bacula-console and run job manually, bacula-dir
    establishes network connection to database and keep it till I close
    bacula-console. If some network error occurs during this session any
    sequential job commands fails dew to database unavailability.

    I was trying to open a bug
    (http://bugs.bacula.org/view.php?id=2283
    <http://bugs.bacula.org/view.php?id=2283>) but
    it was closed. It seems to me that bacula-dir indeed uses permanent
    connections. I think there may be some misunderstanding on my side.
    Please explain.

    Debain 8, Bacula 7.4.3.

    --

    Mursenkov Andrey



    
------------------------------------------------------------------------------
    Check out the vibrant tech community on one of the world's most
    engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    _______________________________________________
    Bacula-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/bacula-users
    <https://lists.sourceforge.net/lists/listinfo/bacula-users>





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!http://sdm.link/slashdot


_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to