Error: <_Inactivstatus = StatusCode.UNAVAILABLE details = "Trying to connect an http1.x server" ... "grpc_status":14}" >

Hello,
I used Docker Swarm to deploy DGraph and when I used HaProxy for load balancing, I received the following error message


Error: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.UNAVAILABLE
	details = "Trying to connect an http1.x server"
	debug_error_string = "{"created":"@1592373707.742817000","description":"Error received from peer ipv4:192.168.1.100:9083","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Trying to connect an http1.x server","grpc_status":14}"
>

My haProxy configuration is as follows

listen alpha-client-cluster
    bind *:9083
    mode http
    maxconn 300
    balance roundrobin
    server server1 192.168.1.100:9080 maxconn 300 check
    server server2 192.168.1.101:9081 maxconn 300 check
    server server3 192.168.1.102:9082 maxconn 300 check

What should I do next or what information should I provide to help solve the problem

Hi @gumupaier, Welcome to the Dgraph community. Can you tell us the following so that we understand it better and help you:

  • Which version of Dgraph are you using and machine specifications.
  • Steps followed by you to reach here.
  • Are you facing it every time or just some times?

Thank you for replying to my question! I will refine the relevant information to you later @minhaj

  • Which version of Dgraph are you using and machine specifications.
    R: V20.03.3 ,Machine configuration 2 vCPU 4 GiB, a total of three Ali cloud machines,The three machine IPs are as follows
    192.168.1.100 192.168.1.101 192.168.1.102

  • Steps followed by you to reach here.
    R: I used Docker Swarm to deploy Dgraph,After deploying according to the DGraph document, HaProxy was added for load balancing
    The steps for haProxy deployment are as follows
    Three files in total

docker-compose.yml

version: "3.2"
services:
  haproxy:
    container_name: haproxy
    build: .
    volumes:
      - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
    ports:
      - 9083:9083
      - 8083:8083
    restart: always

Dockerfile

FROM haproxy:1.7
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

EXPOSE 9083 8083

haproxy.cfg

global
    daemon
    maxconn 30000
    log 127.0.0.1 local0 info
    log 127.0.0.1 local1 warning

defaults
    log-format %hr\ %ST\ %B\ %Ts
    log  global
    mode http
    option http-keep-alive
    timeout connect 5000ms
    timeout client 10000ms
    timeout server 50000ms
    timeout http-request 20000ms

# custom your own frontends && backends && listen conf
#CUSTOM

listen alpha-cluster
    bind *:8083
    mode http
    maxconn 300
    balance roundrobin
    server server1 192.168.1.100:8080 maxconn 300 check
    server server2 192.168.1.101:8081 maxconn 300 check
    server server3 192.168.1.102:8082 maxconn 300 check

listen alpha-client-cluster
    bind *:9083
    mode http
    maxconn 300
    balance roundrobin
    server server1 192.168.1.100:9080 maxconn 300 check
    server server2 192.168.1.101:9081 maxconn 300 check
    server server3 192.168.1.102:9082 maxconn 300 check

listen stats
    bind *:1080
    stats refresh 30s
    stats uri /stats

Execute the command to complete the HaProxy installation

docker-compose up -d

Now Ratel is accessible

  • Are you facing it every time or just some times?

R:every time

Thanks for your response @gumupaier. Let us look into that get back to you.

Hi @gumupaier, I have tried reproducing the error but everything is working fine for me and I am able to query/mutate data via Ratel. However, can you elaborate on a few more things?

  1. Share the result of docker service ls on the manager node.
  2. Are you able to mutate/query data via Ratel.
  3. Any other insights on when exactly you are getting the error.

This error is related to the client’s inability to connect to the GRPC port.

14	UNAVAILABLE	
The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff.

Source: 狀態回應代碼  |  Google Actions Center  |  Google for Developers

You should check if you are exposing the port correctly and that you are configuring Dgraph correctly with --port_offset. Which in your case is --port_offset 3.

hi
the problem was solved, I changed the HAProxy mode from HTTP to TCP, and now it can work normally. The current haProxy configuration file is as follows:

@minhaj @MichelDiz
Thank you for your help

1 Like