Dgraph always shows'Connection lost with alpha: 7080' error

I now use docker-compose to start Dgraph, but it always fails to start. The contents of docker-compose.yml are as follows:

# This Docker Compose file can be used to quickly bootup Dgraph Zero
# and Alpha in different Docker containers.

# It mounts /tmp/data on the host machine to /dgraph within the
# container. You can change /tmp/data to a more appropriate location.
# Run `docker-compose up` to start Dgraph.

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:v20.03.2
    volumes:
      - /data/nlp/dgraph/data-volume:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:v20.03.2
    volumes:
      - /data/nlp/dgraph/data-volume:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --lru_mb=4096 --zero=zero:5080
  ratel:
    image: dgraph/dgraph:v20.03.2
    ports:
      - 8000:8000
    command: dgraph-ratel

“Connection lost with alpha:7080. Error: rpc error: code = Unknown desc = No node has been set up yet” always appears after docker-compose up.

I have spent three days and changed three machines, and they all ended in failure. Where is the problem? please help me

The complete error message is as follows:

Pulling zero (dgraph/dgraph:v20.03.2)...
v20.03.2: Pulling from dgraph/dgraph
5bed26d33875: Already exists
f11b29a9c730: Already exists
930bda195c84: Already exists
78bf9a5ad49e: Already exists
56d14a4dc4d7: Already exists
b2e6192c62a3: Pull complete
02dca55cd04c: Pull complete
Digest: sha256:36d2de071a603bd65d28bbe41eea01fef7c7114d1c30a5deac6d9d2b33a48e65
Status: Downloaded newer image for dgraph/dgraph:v20.03.2
Creating dgraph_zero_1  ... done
Creating dgraph_alpha_1 ... done
Creating dgraph_ratel_1 ... done
Attaching to dgraph_ratel_1, dgraph_alpha_1, dgraph_zero_1
ratel_1  | 2020/07/15 07:57:26 Listening on :8000...
zero_1   | [Decoder]: Using assembly version of decoder
alpha_1  | [Decoder]: Using assembly version of decoder
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: ContextifyFrames
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: Environment
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: Modules
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: IgnoreErrors
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: ContextifyFrames
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: Environment
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: Modules
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: IgnoreErrors
alpha_1  | [Decoder]: Using assembly version of decoder
zero_1   | [Decoder]: Using assembly version of decoder
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: ContextifyFrames
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: Environment
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: Modules
alpha_1  | [Sentry] 2020/07/15 07:57:27 Integration installed: IgnoreErrors
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: ContextifyFrames
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: Environment
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: Modules
zero_1   | [Sentry] 2020/07/15 07:57:27 Integration installed: IgnoreErrors
zero_1   | I0715 07:57:28.048232      18 init.go:99] 
zero_1   | 
zero_1   | Dgraph version   : v20.03.1
zero_1   | Dgraph SHA-256   : 6a40b1e084205ae9e29336780b3458a3869db45c0b96b916190881c16d705ba8
zero_1   | Commit SHA-1     : c201611d6
zero_1   | Commit timestamp : 2020-04-24 13:53:41 -0700
zero_1   | Branch           : HEAD
zero_1   | Go version       : go1.14.1
zero_1   | 
zero_1   | For Dgraph official documentation, visit https://docs.dgraph.io.
zero_1   | For discussions about Dgraph     , visit http://discuss.dgraph.io.
zero_1   | To say hi to the community       , visit https://dgraph.slack.com.
zero_1   | 
zero_1   | Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
zero_1   | Copyright 2015-2020 Dgraph Labs, Inc.
zero_1   | 
zero_1   | 
alpha_1  | I0715 07:57:28.051478      13 init.go:99] 
alpha_1  | 
alpha_1  | Dgraph version   : v20.03.1
alpha_1  | Dgraph SHA-256   : 6a40b1e084205ae9e29336780b3458a3869db45c0b96b916190881c16d705ba8
alpha_1  | Commit SHA-1     : c201611d6
alpha_1  | Commit timestamp : 2020-04-24 13:53:41 -0700
alpha_1  | Branch           : HEAD
alpha_1  | Go version       : go1.14.1
alpha_1  | 
alpha_1  | For Dgraph official documentation, visit https://docs.dgraph.io.
alpha_1  | For discussions about Dgraph     , visit http://discuss.dgraph.io.
alpha_1  | To say hi to the community       , visit https://dgraph.slack.com.
alpha_1  | 
alpha_1  | Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
alpha_1  | Copyright 2015-2020 Dgraph Labs, Inc.
alpha_1  | 
alpha_1  | 
zero_1   | I0715 07:57:28.054939      18 run.go:108] Setting up grpc listener at: 0.0.0.0:5080
zero_1   | I0715 07:57:28.055489      18 run.go:108] Setting up http listener at: 0.0.0.0:6080
alpha_1  | I0715 07:57:28.054714      13 run.go:609] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000}
alpha_1  | I0715 07:57:28.054769      13 run.go:610] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:1 MyAddr:alpha:7080 ZeroAddr:[zero:5080] RaftId:0 WhiteListedIPRanges:[] MaxRetries:-1 StrictMutations:false AclEnabled:false AbortOlderThan:5m0s SnapshotAfter:10000 ProposedGroupId:0 StartTime:2020-07-15 07:57:27.378123756 +0000 UTC m=+0.023254073 LudicrousMode:false BadgerKeyFile:}
alpha_1  | I0715 07:57:28.054879      13 run.go:611] worker.Config: {PostingDir:p BadgerTables:mmap BadgerVlog:mmap BadgerKeyFile: BadgerCompressionLevel:3 WALDir:w MutationsMode:0 AuthToken: AllottedMemory:4096 HmacSecret:[] AccessJwtTtl:0s RefreshJwtTtl:0s AclRefreshInterval:0s}
alpha_1  | I0715 07:57:28.055068      13 server_state.go:75] Setting Badger Compression Level: 3
alpha_1  | I0715 07:57:28.055084      13 server_state.go:84] Setting Badger table load option: mmap
alpha_1  | I0715 07:57:28.055094      13 server_state.go:96] Setting Badger value log load option: mmap
alpha_1  | I0715 07:57:28.055112      13 server_state.go:141] Opening write-ahead log BadgerDB with options: {Dir:w ValueDir:w SyncWrites:false TableLoadingMode:1 ValueLogLoadingMode:2 NumVersionsToKeep:1 ReadOnly:false Truncate:true Logger:0x282e510 Compression:2 InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:true MaxCacheSize:10485760 MaxBfCacheSize:0 LoadBloomsOnOpen:false NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:10000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:3 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s BypassLockGuard:false ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
alpha_1  | I0715 07:57:28.064142      13 log.go:34] All 0 tables opened in 0s
zero_1   | badger 2020/07/15 07:57:28 INFO: All 0 tables opened in 0s
zero_1   | E0715 07:57:28.067072      18 storage.go:97] deleteRange failed with error: requested index is unavailable due to compaction, from: 0, until: 0
alpha_1  | I0715 07:57:28.066455      13 server_state.go:75] Setting Badger Compression Level: 3
alpha_1  | I0715 07:57:28.066481      13 server_state.go:84] Setting Badger table load option: mmap
alpha_1  | I0715 07:57:28.066492      13 server_state.go:96] Setting Badger value log load option: mmap
zero_1   | I0715 07:57:28.067035      18 node.go:148] Setting raft.Config to: &{ID:1 peers:[] learners:[] ElectionTick:20 HeartbeatTick:1 Storage:0xc000118500 Applied:0 MaxSizePerMsg:262144 MaxCommittedSizePerReady:67108864 MaxUncommittedEntriesSize:0 MaxInflightMsgs:256 CheckQuorum:false PreVote:true ReadOnlyOption:0 Logger:0x282e510 DisableProposalForwarding:false}
alpha_1  | I0715 07:57:28.066511      13 server_state.go:160] Opening postings BadgerDB with options: {Dir:p ValueDir:p SyncWrites:false TableLoadingMode:2 ValueLogLoadingMode:2 NumVersionsToKeep:2147483647 ReadOnly:false Truncate:true Logger:0x282e510 Compression:2 InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1024 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:true MaxCacheSize:1073741824 MaxBfCacheSize:0 LoadBloomsOnOpen:false NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:1000000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:3 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s BypassLockGuard:false ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
zero_1   | I0715 07:57:28.068384      18 node.go:326] Group 0 found 0 entries
zero_1   | I0715 07:57:28.068464      18 log.go:34] 1 became follower at term 0
zero_1   | I0715 07:57:28.068527      18 log.go:34] newRaft 1 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
zero_1   | I0715 07:57:28.068541      18 log.go:34] 1 became follower at term 1
zero_1   | I0715 07:57:28.068680      18 run.go:307] Running Dgraph Zero...
zero_1   | E0715 07:57:28.069139      18 raft.go:516] While proposing CID: Not Zero leader. Aborting proposal: cid:"e557fdc5-1c13-4ce0-8ec8-70d12003832b" . Retrying...
zero_1   | I0715 07:57:28.069725      18 node.go:185] Setting conf state to nodes:1 
zero_1   | I0715 07:57:28.069811      18 raft.go:702] Done applying conf change at 0x1
alpha_1  | I0715 07:57:28.084521      13 log.go:34] All 0 tables opened in 0s
alpha_1  | I0715 07:57:28.086360      13 groups.go:107] Current Raft Id: 0x0
alpha_1  | I0715 07:57:28.086533      13 worker.go:96] Worker listening at address: [::]:7080
alpha_1  | I0715 07:57:28.087653      13 run.go:480] Bringing up GraphQL HTTP API at 0.0.0.0:8080/graphql
alpha_1  | I0715 07:57:28.087681      13 run.go:481] Bringing up GraphQL HTTP admin API at 0.0.0.0:8080/admin
alpha_1  | I0715 07:57:28.087719      13 run.go:512] gRPC server started.  Listening on port 9080
alpha_1  | I0715 07:57:28.087735      13 run.go:513] HTTP server started.  Listening on port 8080
alpha_1  | I0715 07:57:28.186720      13 pool.go:160] CONNECTING to zero:5080
zero_1   | I0715 07:57:28.191987      18 zero.go:417] Got connection request: cluster_info_only:true 
zero_1   | I0715 07:57:28.192273      18 log.go:34] 1 no leader at term 1; dropping index reading msg
zero_1   | W0715 07:57:30.192349      18 node.go:674] [0x1] Read index context timed out
zero_1   | I0715 07:57:30.192393      18 log.go:34] 1 no leader at term 1; dropping index reading msg
zero_1   | E0715 07:57:31.069479      18 raft.go:516] While proposing CID: Not Zero leader. Aborting proposal: cid:"bea66177-c84a-4db7-b77a-06711e9e1ec3" . Retrying...
zero_1   | I0715 07:57:31.368927      18 log.go:34] 1 is starting a new election at term 1
zero_1   | I0715 07:57:31.368974      18 log.go:34] 1 became pre-candidate at term 1
zero_1   | I0715 07:57:31.368993      18 log.go:34] 1 received MsgPreVoteResp from 1 at term 1
zero_1   | I0715 07:57:31.369022      18 log.go:34] 1 became candidate at term 2
zero_1   | I0715 07:57:31.369032      18 log.go:34] 1 received MsgVoteResp from 1 at term 2
zero_1   | I0715 07:57:31.369058      18 log.go:34] 1 became leader at term 2
zero_1   | I0715 07:57:31.369078      18 log.go:34] raft.node: 1 elected leader 1 at term 2
zero_1   | I0715 07:57:31.369122      18 raft.go:667] I've become the leader, updating leases.
zero_1   | I0715 07:57:31.369141      18 assign.go:42] Updated Lease id: 1. Txn Ts: 1
zero_1   | W0715 07:57:32.192623      18 node.go:674] [0x1] Read index context timed out
zero_1   | I0715 07:57:32.192805      18 zero.go:435] Connected: cluster_info_only:true 
zero_1   | I0715 07:57:32.194095      18 zero.go:417] Got connection request: addr:"alpha:7080" 
zero_1   | I0715 07:57:32.194443      18 pool.go:160] CONNECTING to alpha:7080
zero_1   | I0715 07:57:32.197464      18 zero.go:562] Connected: id:1 group_id:1 addr:"alpha:7080" 
zero_1   | W0715 07:57:32.197954      18 pool.go:254] Connection lost with alpha:7080. Error: rpc error: code = Unknown desc = No node has been set up yet
alpha_1  | I0715 07:57:32.197827      13 groups.go:135] Connected to group zero. Assigned group: 1
alpha_1  | I0715 07:57:32.197863      13 groups.go:137] Raft Id after connection to Zero: 0x1
alpha_1  | I0715 07:57:32.197987      13 pool.go:160] CONNECTING to alpha:7080
alpha_1  | I0715 07:57:32.198190      13 draft.go:200] Node ID: 0x1 with GroupID: 1
alpha_1  | I0715 07:57:32.198268      13 node.go:148] Setting raft.Config to: &{ID:1 peers:[] learners:[] ElectionTick:20 HeartbeatTick:1 Storage:0xc0007fa300 Applied:0 MaxSizePerMsg:262144 MaxCommittedSizePerReady:67108864 MaxUncommittedEntriesSize:0 MaxInflightMsgs:256 CheckQuorum:false PreVote:true ReadOnlyOption:0 Logger:0x282e510 DisableProposalForwarding:false}
alpha_1  | I0715 07:57:32.198467      13 node.go:326] Group 1 found 0 entries
alpha_1  | I0715 07:57:32.198490      13 draft.go:1567] New Node for group: 1
alpha_1  | E0715 07:57:32.198489      13 storage.go:97] deleteRange failed with error: requested index is unavailable due to compaction, from: 0, until: 0
alpha_1  | I0715 07:57:32.198538      13 log.go:34] 1 became follower at term 0
alpha_1  | I0715 07:57:32.199109      13 log.go:34] newRaft 1 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
alpha_1  | I0715 07:57:32.199124      13 log.go:34] 1 became follower at term 1
alpha_1  | I0715 07:57:32.199176      13 draft.go:147] Operation started with id: opRollup
alpha_1  | I0715 07:57:32.199211      13 groups.go:155] Server is ready
alpha_1  | I0715 07:57:32.199362      13 draft.go:962] Found Raft progress: 0
alpha_1  | I0715 07:57:32.199546      13 groups.go:784] Got address of a Zero leader: zero:5080
alpha_1  | I0715 07:57:32.199683      13 groups.go:797] Starting a new membership stream receive from zero:5080.
alpha_1  | I0715 07:57:32.200891      13 groups.go:814] Received first state update from Zero: counter:3 groups:<key:1 value:<members:<key:1 value:<id:1 group_id:1 addr:"alpha:7080" > > > > zeros:<key:1 value:<id:1 addr:"zero:5080" leader:true > > maxRaftId:1 
alpha_1  | I0715 07:57:32.201282      13 node.go:185] Setting conf state to nodes:1 
alpha_1  | I0715 07:57:32.201501      13 log.go:34] 1 is starting a new election at term 1
alpha_1  | I0715 07:57:32.201535      13 log.go:34] 1 became pre-candidate at term 1
alpha_1  | I0715 07:57:32.201549      13 log.go:34] 1 received MsgPreVoteResp from 1 at term 1
alpha_1  | I0715 07:57:32.201573      13 log.go:34] 1 became candidate at term 2
alpha_1  | I0715 07:57:32.201582      13 log.go:34] 1 received MsgVoteResp from 1 at term 2
alpha_1  | I0715 07:57:32.201605      13 log.go:34] 1 became leader at term 2
alpha_1  | I0715 07:57:32.201624      13 log.go:34] raft.node: 1 elected leader 1 at term 2
alpha_1  | I0715 07:57:33.095019      13 admin.go:523] No GraphQL schema in Dgraph; serving empty GraphQL API
alpha_1  | I0715 07:57:33.199613      13 groups.go:865] Leader idx=0x1 of group=1 is connecting to Zero for txn updates
alpha_1  | I0715 07:57:33.199656      13 groups.go:874] Got Zero leader: zero:5080
alpha_1  | I0715 07:57:33.207585      13 groups.go:495] Serving tablet for: dgraph.type
alpha_1  | I0715 07:57:33.210863      13 draft.go:147] Operation started with id: opIndexing
alpha_1  | I0715 07:57:33.210955      13 index.go:857] Deleting index for attr dgraph.type and tokenizers []
alpha_1  | I0715 07:57:33.210972      13 index.go:871] Deleting index for attr dgraph.type and tokenizers [exact]
alpha_1  | I0715 07:57:33.211049      13 log.go:34] Writes flushed. Stopping compactions now...
alpha_1  | I0715 07:57:33.211128      13 draft.go:112] Operation completed with id: opRollup
alpha_1  | I0715 07:57:33.213027      13 log.go:34] DropPrefix done
alpha_1  | I0715 07:57:33.213113      13 log.go:34] Resuming writes
alpha_1  | I0715 07:57:33.213151      13 log.go:34] Writes flushed. Stopping compactions now...
alpha_1  | I0715 07:57:33.217155      13 log.go:34] DropPrefix done
alpha_1  | I0715 07:57:33.217209      13 log.go:34] Resuming writes
alpha_1  | I0715 07:57:33.217333      13 log.go:34] Writes flushed. Stopping compactions now...
alpha_1  | I0715 07:57:33.219706      13 log.go:34] DropPrefix done
alpha_1  | I0715 07:57:33.219815      13 log.go:34] Resuming writes
alpha_1  | I0715 07:57:33.219845      13 log.go:34] Writes flushed. Stopping compactions now...
alpha_1  | I0715 07:57:33.222086      13 log.go:34] DropPrefix done
alpha_1  | I0715 07:57:33.222198      13 log.go:34] Resuming writes
alpha_1  | I0715 07:57:33.231221      13 log.go:34] All 0 tables opened in 0s
alpha_1  | I0715 07:57:33.233648      13 log.go:34] Rebuilding index for predicate dgraph.type (1/2): Sent 0 keys
alpha_1  | I0715 07:57:33.234585      13 log.go:34] Rebuilding index for predicate dgraph.type (2/2): Sent 0 keys
alpha_1  | I0715 07:57:33.234950      13 log.go:34] Got compaction priority: {level:0 score:1.73 dropPrefix:[]}
alpha_1  | I0715 07:57:33.237090      13 index.go:902] Rebuilding index for attr dgraph.type and tokenizers [exact]
alpha_1  | I0715 07:57:33.241469      13 groups.go:495] Serving tablet for: dgraph.graphql.schema
alpha_1  | I0715 07:57:33.268897      13 log.go:34] All 0 tables opened in 0s
alpha_1  | I0715 07:57:33.270953      13 log.go:34] Rebuilding index for predicate dgraph.type (1/2): Sent 0 keys
alpha_1  | I0715 07:57:33.271934      13 log.go:34] Rebuilding index for predicate dgraph.type (2/2): Sent 0 keys
alpha_1  | I0715 07:57:33.272218      13 log.go:34] Got compaction priority: {level:0 score:1.73 dropPrefix:[]}
alpha_1  | I0715 07:57:33.273607      13 mutation.go:193] Done schema update predicate:"dgraph.type" value_type:STRING directive:INDEX tokenizer:"exact" list:true 
alpha_1  | I0715 07:57:33.273794      13 draft.go:112] Operation completed with id: opIndexing
alpha_1  | I0715 07:57:33.275182      13 draft.go:147] Operation started with id: opIndexing
alpha_1  | I0715 07:57:33.275603      13 draft.go:112] Operation completed with id: opIndexing
zero_1   | I0715 07:57:34.071127      18 raft.go:509] CID set for cluster: b8e35885-46c1-436a-bd9c-d912f6dcb6c9
zero_1   | I0715 07:57:34.073456      18 license_ee.go:45] Enterprise state proposed to the cluster: key:"z1-12343296788639156194" license:<maxNodes:18446744073709551615 expiryTs:1597391854 > 
alpha_1  | I0715 07:57:43.274192      13 draft.go:147] Operation started with id: opRollup

Please help me find the problem, thank you very much!!!

@gongshaojie12 Your cluster looks healthy from the logs. Alpha/zero did throw an error while starting (which can happen) but eventually it was able to connect.

Try running some queries and mutations. It should work fine.

@ibrahim Thank you very much, I will try the queries and mutations

Solved?