While trying to setup connection: context deadline exceeded. Retrying

hi
The following error occurred while executing the command

dgraph live --tls_cacert ./tls/ca.crt  --tls_key ./tls/client.user.key --tls_server_name "192.168.123.34"   -f A100_unlisted_1.json.gz  -s entities.schema -a alpha1:9080 -x ./index  

the error

While trying to setup connection: context deadline exceeded. Retrying...
2020/06/24 01:49:55 Could not setup connection after 1 retries
github.com/dgraph-io/dgraph/x.Fatalf
        /ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:114
github.com/dgraph-io/dgraph/x.GetDgraphClient
        /ext-go/1/src/github.com/dgraph-io/dgraph/x/x.go:793
github.com/dgraph-io/dgraph/dgraph/cmd/live.run
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:440
github.com/dgraph-io/dgraph/dgraph/cmd/live.init.0.func1
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:120
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864

What went wrong

This error happens if your cluster fails or something (like “wrong url”). This logs don’t tell much about the history.

hi @MichelDiz

The following error log appears on alpha

2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45034: remote error: tls: unknown certificate
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45040: EOF
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45042: remote error: tls: unknown certificate
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45046: EOF
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45050: remote error: tls: unknown certificate
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45058: tls: client didn't provide a certificate
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45054: EOF
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45062: remote error: tls: unknown certificate
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45066: EOF
2020/06/24 03:32:08 http: TLS handshake error from 172.24.0.1:45070: tls: client didn't provide a certificate

But I used a Python file to verify that the TLS executed successfully


tls_example.py (1.6 KB)

Did I have a parameter setting error in live Loader?

the command

dgraph live --tls_cacert ./tls/ca.crt  --tls_key ./tls/client.user.key --tls_server_name 192.168.123.34  -f A100_unlisted_1.json.gz  -s entities.schema -a alpha1:9080 -x ./index

Not sure, I haven’t used TLS in a long time. Gonna ping @joaquin. He has tested it lately.

PS. Pls, share the steps you used to create the certs.

hey @MichelDiz @joaquin
I can provide a complete set of replication steps, which I’ll add later

The full sample file is shown below. Download and unzip the file
tls.zip (15.5 KB)

Deploy the Dgraph cluster

cd tls
docker-compose up -d

Then enter the zero1 container to execute bash./bach_import.sh error occurs

docker exec -it zero1 /bin/bash
cd /work

chmod a+x bach_import.sh   

./bach_import.sh

hey @MichelDiz

Here are my steps for creating the certificate

 dgraph cert
 dgraph cert -n localhost,192.168.123.34,alpha1,alpha2,alpha3,zero1,zero2,zero3
 dgraph cert -c user 

The dgraph live was executed from within one of the containers? With that cluster running (docker-compose) could you run this command below on the host? This requires the data files and the dgraph binary to be on the host.

dgraph live \
  --tls_cacert ./tls/ca.crt  \
  --tls_key ./tls/client.user.key 
  --tls_server_name localhost  \
  -f A100_unlisted_1.json.gz  \
  -s entities.schema 
  -x ./index

What does 192.168.123.34 represent? This is the host’s IP address?