Connection refused when running Dgraph Alpha for the first time

I am on macOS Catalina 10.15.4 and have just installed Dgraph 20.03.1 for the first time using

curl -sSf https://get.dgraph.io | bash

I then attempt to start Dgraph Alpha with

/usr/local/bin/dgraph alpha --lru_mb 1024

This returns the following connection refused error:

[Decoder]: Using assembly version of decoder
[Sentry] 2020/06/01 13:01:49 Integration installed: ContextifyFrames
[Sentry] 2020/06/01 13:01:49 Integration installed: Environment
[Sentry] 2020/06/01 13:01:49 Integration installed: Modules
[Sentry] 2020/06/01 13:01:49 Integration installed: IgnoreErrors
[Decoder]: Using assembly version of decoder
[Sentry] 2020/06/01 13:01:49 Integration installed: ContextifyFrames
[Sentry] 2020/06/01 13:01:49 Integration installed: Environment
[Sentry] 2020/06/01 13:01:49 Integration installed: Modules
[Sentry] 2020/06/01 13:01:49 Integration installed: IgnoreErrors
I0601 13:01:49.646139   16533 init.go:99] 

Dgraph version   : v20.03.1
Dgraph SHA-256   : cbd3c7fd96d08f6b78259a10e03d70ab85a4afd3c9a4c68daac6358fe84a4b6e
Commit SHA-1     : c201611d6
Commit timestamp : 2020-04-24 13:53:41 -0700
Branch           : HEAD
Go version       : go1.14.1

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
To say hi to the community       , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.


I0601 13:01:49.646773   16533 run.go:609] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000}
I0601 13:01:49.646804   16533 run.go:610] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:1 MyAddr: ZeroAddr:[localhost:5080] RaftId:0 WhiteListedIPRanges:[] MaxRetries:-1 StrictMutations:false AclEnabled:false AbortOlderThan:5m0s SnapshotAfter:10000 ProposedGroupId:0 StartTime:2020-06-01 13:01:49.354717 +0400 +04 m=+0.013318978 LudicrousMode:false BadgerKeyFile:}
I0601 13:01:49.646862   16533 run.go:611] worker.Config: {PostingDir:p BadgerTables:mmap BadgerVlog:mmap BadgerKeyFile: BadgerCompressionLevel:3 WALDir:w MutationsMode:0 AuthToken: AllottedMemory:1024 HmacSecret:[] AccessJwtTtl:0s RefreshJwtTtl:0s AclRefreshInterval:0s}
I0601 13:01:49.646966   16533 server_state.go:75] Setting Badger Compression Level: 3
I0601 13:01:49.646980   16533 server_state.go:84] Setting Badger table load option: mmap
I0601 13:01:49.646987   16533 server_state.go:96] Setting Badger value log load option: mmap
I0601 13:01:49.646995   16533 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:0x5d135c8 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}
I0601 13:01:49.651680   16533 log.go:34] All 0 tables opened in 0s
I0601 13:01:49.658015   16533 log.go:34] Replaying file id: 0 at offset: 0
I0601 13:01:49.658034   16533 log.go:34] Replay took: 7.161µs
I0601 13:01:49.658104   16533 server_state.go:75] Setting Badger Compression Level: 3
I0601 13:01:49.658111   16533 server_state.go:84] Setting Badger table load option: mmap
I0601 13:01:49.658117   16533 server_state.go:96] Setting Badger value log load option: mmap
I0601 13:01:49.658137   16533 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:0x5d135c8 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}
I0601 13:01:49.668176   16533 log.go:34] All 0 tables opened in 0s
I0601 13:01:49.673268   16533 log.go:34] Replaying file id: 0 at offset: 0
I0601 13:01:49.673292   16533 log.go:34] Replay took: 7.179µs
I0601 13:01:49.673785   16533 groups.go:107] Current Raft Id: 0x0
I0601 13:01:49.675583   16533 worker.go:96] Worker listening at address: [::]:7080
I0601 13:01:49.677694   16533 run.go:480] Bringing up GraphQL HTTP API at 0.0.0.0:8080/graphql
I0601 13:01:49.677718   16533 run.go:481] Bringing up GraphQL HTTP admin API at 0.0.0.0:8080/admin
I0601 13:01:49.677781   16533 run.go:512] gRPC server started.  Listening on port 9080
I0601 13:01:49.677823   16533 run.go:513] HTTP server started.  Listening on port 8080
I0601 13:01:49.779045   16533 pool.go:160] CONNECTING to localhost:5080
W0601 13:01:49.784041   16533 pool.go:254] Connection lost with localhost:5080. Error: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:5080: connect: connection refused"
I0601 13:01:54.679384   16533 query.go:123] Dgraph query execution failed : Dgraph query failed because Please retry again, server is not ready to accept requests
I0601 13:01:54.679420   16533 admin.go:520] Error reading GraphQL schema: Dgraph query failed because Dgraph query failed because Please retry again, server is not ready to accept requests.

What is going wrong here?

Hey @kevin.obrien, you would need to start a zero instance as well. Dgraph has two main components, zero and alpha. Alpha processes the data while zero takes care of administrative tasks.

You can start zero as

/usr/local/bin/dgraph zero

The alpha is trying to connect to zero running at port 5080 (default port) but it’s crashing because zero is not running.

@ibrahim ah ok, I hadn’t even tried this yet as I thought the previous connection error had to be resolved before I could start Dgraph Zero. Thanks.

@kevin.obrien Ideally you would start zero followed by the alpha.