Re: Hello ! May I ask you one question ?

2020-08-11 Thread Axel DUMAS

Hi !

Thanks to your help, my problem seem to be solved.
https://code-examples.net/en/q/16962c
http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/

You were right.
The problem of disconnections after some wait time was due to some 
timeouts parameters.


In the "default" section, there was :

   timeout connect 5000
   timeout client  5
   timeout server  5

I have replaced the values of "timeout client" and "timeout server" :

   timeout client  30m
   timeout server  30m

Thus, as my IoT devices send data every 15 minutes maximum, a timeout of 
30 minutes should be good. No ?


Also, I have added a "KeepAlive" option on the client socket (in my java 
program).


I would like to thanks you all for your help.

I will continue to learn more about HAProxy.

Sincerely,
Axel DUMAS.

PS : For futures questions, I will take care to give you more 
information. ^^
PS 2 : If you have any additional comments to make, I am always okay to 
take them. :)




Re: Hello ! May I ask you one question ?

2020-08-11 Thread Axel DUMAS

Hello !

Sorry for the subject of my email.
Sometimes, I have some understanding concern in English.

So you want all the configuration of HAProxy ? You can look at the 
attachment (haproxy.cfg). I have just used the basic configuration of 
HAProxy.
And I have forgotten to mention the version of HAProxy (maybe there are 
some differences) : HA-Proxy version 1.8.19-1+deb10u2 2020/04/01.


Also, sorry for the asterisks they seems to be added after my sending. :/

You can see the logs after a restart and some exchange of data.
I have seen that when I change the configuration of my IoT device to a 
sending interval of 30 seconds instead of 15 minutes or 30 minutes, 
HAProxy works and exchanges between my device and my java server seems 
to be made normally. So maybe, it's a problem of timeout.



Also, you can see in the log file, these two last lines :

   Aug 11 11:24:30 AS-Freedom haproxy[5371]: 185.99.26.70:60749
   [11/Aug/2020:11:22:12.639] srv_java all_java_srv/srv_1 1/0/138128 17
   cD 1/1/0/0/0 0/0
   Aug 11 11:27:36 AS-Freedom haproxy[5371]: 185.99.26.66:49655
   [11/Aug/2020:11:26:45.595] srv_java all_java_srv/srv_1 1/0/50755 5
   cD 1/1/0/0/0 0/0

I think they should be appearing when the connection is interrupted 
between the server and the device is interrupted.


I will search again about timeouts in HAProxy.

Thanks a lot for your help !
And sorry for the lack of information.
Sincerely.


Le 11/08/2020 à 00:00, Tim Düsterhus a écrit :

Axel,

Am 10.08.20 um 19:02 schrieb Axel DUMAS:

Can I ask my question here ? Or do I have to write it in an other place ?

This is the appropriate place. However I must admit that your email
looked like spam based off the Subject at a first glance.


In order to test load-balancing, in the config file of HAProxy, I wrote
theses two things :
*frontend* java_srv
*bind* 192.168.0.19:26001
*mode* tcp
*default_backend* all_java_srv

*backend* all_java_srv
*balance* roundrobin
*mode* tcp
*server* srv_1 192.168.0.19:26001

Can you please give your *literal* configuration instead of just the
options you consider important? And please give the configuration in the
original format without the asterisks in there.


Some fast exchanges seems to be made between the IoT device and my
server, but when it have to wait, the connection is cut and the device
is disconnected.

Any error messages? Did you enable logging in HAProxy (you should)? Can
you provide a log message?

Best regards
Tim Düsterhus
Aug 11 11:20:34 AS-Freedom haproxy[5188]: [WARNING] 223/111742 (5188) : Exiting Master process...
Aug 11 11:20:34 AS-Freedom haproxy[5188]: [ALERT] 223/111742 (5188) : Current worker 5189 exited with code 143
Aug 11 11:20:34 AS-Freedom haproxy[5188]: [WARNING] 223/111742 (5188) : All workers exited. Exiting... (143)
Aug 11 11:20:34 AS-Freedom haproxy[5370]: [WARNING] 223/112034 (5370) : parsing [/etc/haproxy/haproxy.cfg:26] : 'option httplog' not usable with frontend 'srv_java' (needs 'mode http'). Falling back to 'option tcplog'.
Aug 11 11:20:34 AS-Freedom haproxy[5370]: Proxy srv_java started.
Aug 11 11:20:34 AS-Freedom haproxy[5370]: Proxy srv_java started.
Aug 11 11:20:34 AS-Freedom haproxy[5370]: Proxy all_java_srv started.
Aug 11 11:20:34 AS-Freedom haproxy[5370]: Proxy all_java_srv started.
Aug 11 11:24:30 AS-Freedom haproxy[5371]: 185.99.26.70:60749 [11/Aug/2020:11:22:12.639] srv_java all_java_srv/srv_1 1/0/138128 17 cD 1/1/0/0/0 0/0
Aug 11 11:27:36 AS-Freedom haproxy[5371]: 185.99.26.66:49655 [11/Aug/2020:11:26:45.595] srv_java all_java_srv/srv_1 1/0/50755 5 cD 1/1/0/0/0 0/0


global
log /dev/loglocal0
log /dev/loglocal1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd 
listeners
stats timeout 30s
user haproxy
group haproxy
daemon

# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private

# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
#  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
#  
https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers 
ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3

defaults
log global
modehttp
option  httplog
option  dontlognull
timeout connect 5000
timeout client  5
timeout server  5
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 

Re: Hello ! May I ask you one question ?

2020-08-10 Thread Tim Düsterhus
Axel,

Am 10.08.20 um 19:02 schrieb Axel DUMAS:
> Can I ask my question here ? Or do I have to write it in an other place ?

This is the appropriate place. However I must admit that your email
looked like spam based off the Subject at a first glance.

> In order to test load-balancing, in the config file of HAProxy, I wrote
> theses two things :
> *frontend* java_srv
> *bind* 192.168.0.19:26001
> *mode* tcp
> *default_backend* all_java_srv
> 
> *backend* all_java_srv
> *balance* roundrobin
> *mode* tcp
> *server* srv_1 192.168.0.19:26001

Can you please give your *literal* configuration instead of just the
options you consider important? And please give the configuration in the
original format without the asterisks in there.

> Some fast exchanges seems to be made between the IoT device and my
> server, but when it have to wait, the connection is cut and the device
> is disconnected.

Any error messages? Did you enable logging in HAProxy (you should)? Can
you provide a log message?

Best regards
Tim Düsterhus



Hello ! May I ask you one question ?

2020-08-10 Thread Axel DUMAS

Hello !
I am a new (french) user of HAProxy. I have learned some little things 
on it and on the configuration file and parameters.


I wanted to use/learn it for my project, but I have some problems that I 
don't know how to solve.

I have made some searchs...but I haven't found a corresponding answer.

I would like to use HAProxy for load-balancing on my custom TCP Java Server.
It's for the IoT domain.

Can I ask my question here ? Or do I have to write it in an other place ?


I will try to explain you how does it works. Actually, the IoT device 
connect to my server and open a "link" with it. In addition, it create 
one thread per connection.

My server will keep this link open and answer to the IoT device.
The device will use this link in order to send futures data to my 
server. So the link between the device and the server can be opened 
during many hours.

I am not an expert so...I expect you will understand.

In order to test load-balancing, in the config file of HAProxy, I wrote 
theses two things :

*frontend* java_srv
*bind* 192.168.0.19:26001
*mode* tcp
*default_backend* all_java_srv

*backend* all_java_srv
*balance* roundrobin
*mode* tcp
*server* srv_1 192.168.0.19:26001

Some fast exchanges seems to be made between the IoT device and my 
server, but when it have to wait, the connection is cut and the device 
is disconnected.


Do you have an idea of what could be wrong with my configuration file ? 
Or could you give me one suggestion ?

Also, yes, I have only one server for the moment.

If you have any question, feel free to ask.
I thanks you a lot for your help.

And in case that this email is not made for asking question, I am sorry 
for that.

Have a good evening,
Sincerely.