Cluster not being made in dgraph

how to make clusters in dgraph?
After i read the documentation as given on https://docs.dgraph.io/deploy/#cluster-setup
I ran the zero and it was working very well, But when try to run the server1 using the command

docker run -it -p 7080:7080 -p 8080:8080 -p 9080:9080 -v ~/server1:/dgraph dgraph/dgraph:latest dgraph alpha --lru_mb=<typically one-third the RAM> --zero=HOSTIPADDR:5080 --my=HOSTIPADDR:7080

and i mentioned by host ip address too it says

[Decoder]: Using assembly version of decoder
I0110 11:56:50.616565       1 init.go:98] 

Dgraph version   : v1.1.1
Dgraph SHA-256   : 20a10e9db316b565464e0a04cea09657eebbaea3b91460ab651997ada63243cc
Commit SHA-1     : 8994a5740
Commit timestamp : 2019-12-16 18:24:50 -0800
Branch           : HEAD
Go version       : go1.13.5

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


I0110 11:56:50.617431       1 run.go:511] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000}
I0110 11:56:50.617457       1 run.go:512] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:1 MyAddr:localhost:7080 ZeroAddr:localhost:5080 RaftId:0 WhiteListedIPRanges:[] MaxRetries:-1 StrictMutations:false AclEnabled:false AbortOlderThan:5m0s SnapshotAfter:10000 ProposedGroupId:0}
I0110 11:56:50.617492       1 run.go:513] worker.Config: {PostingDir:p BadgerTables:mmap BadgerVlog:mmap WALDir:w MutationsMode:0 AuthToken: AllottedMemory:2048.0MB AccessJwtTtl:0s RefreshJwtTtl:0s AclRefreshInterval:0s}
I0110 11:56:50.617657       1 server_state.go:101] Setting Badger table load option: mmap
I0110 11:56:50.617670       1 server_state.go:113] Setting Badger value log load option: mmap
I0110 11:56:50.617687       1 server_state.go:158] Opening write-ahead log BadgerDB with options: {Dir:w ValueDir:w SyncWrites:false TableLoadingMode:1 ValueLogLoadingMode:2 NumVersionsToKeep:1 ReadOnly:false Truncate:true Logger:0x2409218 Compression:2 EventLogging:true InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:true MaxCacheSize:10485760 NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:10000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:15 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
I0110 11:56:50.652416       1 log.go:34] All 0 tables opened in 0s
I0110 11:56:50.665140       1 server_state.go:101] Setting Badger table load option: mmap
I0110 11:56:50.665156       1 server_state.go:113] Setting Badger value log load option: mmap
I0110 11:56:50.665163       1 server_state.go:177] Opening postings BadgerDB with options: {Dir:p ValueDir:p SyncWrites:false TableLoadingMode:2 ValueLogLoadingMode:2 NumVersionsToKeep:2147483647 ReadOnly:false Truncate:true Logger:0x2409218 Compression:2 EventLogging:true InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1024 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:true MaxCacheSize:1073741824 NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:1000000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:15 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
I0110 11:56:50.699010       1 log.go:34] All 0 tables opened in 0s
I0110 11:56:50.712360       1 groups.go:105] Current Raft Id: 0x0
I0110 11:56:50.712799       1 run.go:422] gRPC server started.  Listening on port 9080
I0110 11:56:50.712823       1 run.go:423] HTTP server started.  Listening on port 8080
I0110 11:56:50.712853       1 worker.go:81] Worker listening at address: [::]:7080
I0110 11:56:50.813232       1 pool.go:148] CONNECTING to localhost:5080
W0110 11:56:50.815943       1 pool.go:238] 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"

what should i do?

Have you tried to run Dgraph Alpha several times in the same container?

BTW. Creating a cluster with Docker makes it easier and less error-prone using Docker Compose.

First I created the zero and then the alpha server but when I try making the second alpha server it throws an error

What was the command you used for the Zero?

https://tour.dgraph.io/intro/2/
The command that is given to start the zero server in this link

This process used in the Tour means that you gonna use a single container. (Similar to https://hub.docker.com/r/dgraph/standalone). In the commands you posted, you are not referencing the container that Zero started (so you’re using two different docker containers). Which in this case would be docker exec -it dgraph (Container name or ID). In the Tour example, it creates a container called “dgraph”. And uses Docker Exec to execute a second command within the same container called “dgraph”.

The second command to start the Alpha instance does not need to add ports, docker image and other Docker settings. Because these were already defined in the creation of the container.

In your case, run the “docker ps” command and see which container is running the Zero instance. Write down the container name or Docker ID and then run the command docker exec -it {Container name or ID} dgraph alpha --lru_mb 2048 --zero localhost: 5080.

Cheers.

I’ve just noticed that you may end up mixing things. The first command you’ve shared is from https://docs.dgraph.io/deploy/#run-using-docker which is a different approach from the Tour. If you keep just with one or another and understand it, you should be fine.

Also, you should change “HOSTIPADDR” to “localhost” or the host IP address.

hi there again, i tried making the cluster using the commands given on https://docs.dgraph.io/deploy/#run-using-docker
the zero server is created successfully, but when i try to create the alpha one
[Decoder]: Using assembly version of decoder
I0113 06:30:24.079800 1 init.go:98]

Dgraph version : v1.1.1
Dgraph SHA-256 : 20a10e9db316b565464e0a04cea09657eebbaea3b91460ab651997ada63243cc
Commit SHA-1 : 8994a5740
Commit timestamp : 2019-12-16 18:24:50 -0800
Branch : HEAD
Go version : go1.13.5

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph , visit https://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-2018 Dgraph Labs, Inc.

I0113 06:30:24.080453 1 run.go:511] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000}
I0113 06:30:24.080484 1 run.go:512] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:1 MyAddr:localhost:7080 ZeroAddr:localhost:5080 RaftId:0 WhiteListedIPRanges: MaxRetries:-1 StrictMutations:false AclEnabled:false AbortOlderThan:5m0s SnapshotAfter:10000 ProposedGroupId:0}
I0113 06:30:24.080517 1 run.go:513] worker.Config: {PostingDir:p BadgerTables:mmap BadgerVlog:mmap WALDir:w MutationsMode:0 AuthToken: AllottedMemory:2048.0MB AccessJwtTtl:0s RefreshJwtTtl:0s AclRefreshInterval:0s}
I0113 06:30:24.080575 1 server_state.go:101] Setting Badger table load option: mmap
I0113 06:30:24.080586 1 server_state.go:113] Setting Badger value log load option: mmap
I0113 06:30:24.080598 1 server_state.go:158] Opening write-ahead log BadgerDB with options: {Dir:w ValueDir:w SyncWrites:false TableLoadingMode:1 ValueLogLoadingMode:2 NumVersionsToKeep:1 ReadOnly:false Truncate:true Logger:0x2409218 Compression:2 EventLogging:true InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:true MaxCacheSize:10485760 NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:10000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:15 VerifyValueChecksum:false EncryptionKey: EncryptionKeyRotationDuration:240h0m0s ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
I0113 06:30:24.086409 1 log.go:34] All 0 tables opened in 0s
I0113 06:30:24.093265 1 log.go:34] Replaying file id: 0 at offset: 0
I0113 06:30:24.093288 1 log.go:34] Replay took: 4.544µs
I0113 06:30:24.093350 1 server_state.go:101] Setting Badger table load option: mmap
I0113 06:30:24.093365 1 server_state.go:113] Setting Badger value log load option: mmap
I0113 06:30:24.093387 1 server_state.go:177] Opening postings BadgerDB with options: {Dir:p ValueDir:p SyncWrites:false TableLoadingMode:2 ValueLogLoadingMode:2 NumVersionsToKeep:2147483647 ReadOnly:false Truncate:true Logger:0x2409218 Compression:2 EventLogging:true InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1024 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:true MaxCacheSize:1073741824 NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:1000000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:15 VerifyValueChecksum:false EncryptionKey: EncryptionKeyRotationDuration:240h0m0s ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
I0113 06:30:24.101973 1 log.go:34] All 0 tables opened in 0s
I0113 06:30:24.107931 1 log.go:34] Replaying file id: 0 at offset: 0
I0113 06:30:24.107985 1 log.go:34] Replay took: 8.421µs
I0113 06:30:24.108678 1 groups.go:105] Current Raft Id: 0x0
I0113 06:30:24.109299 1 run.go:422] gRPC server started. Listening on port 9080
I0113 06:30:24.109320 1 run.go:423] HTTP server started. Listening on port 8080
I0113 06:30:24.109336 1 worker.go:81] Worker listening at address: [::]:7080
I0113 06:30:24.209329 1 pool.go:148] CONNECTING to localhost:5080
W0113 06:30:24.212366 1 pool.go:238] 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”

what should i do? and a second query how many zero and alpha servers we need actually?

Please read my penultimate comment.

I made a video showing the process

But, for the doc’s part https://docs.dgraph.io/deploy/#run-using-docker it Shouldn’t be a problem.

For " run-using-docker" you have to put in mind that is different from

In “run-using-docker” you need to know the Host IP addr and use it replacing “HOSTIPADDR”. In this approach, you are creating a container for each instance. One for Zero, two others for Alphas and one last for Ratel.

So each container needs to talk with each other.
In the case of https://tour.dgraph.io/intro/2/, you are running a single Docker container and it can’t be mixed with “run-using-docker” approach. For that you can follow this video

Note: I did a mistake in the beginning. Because I did not remember that docker via VirtualBox does not allow to use the volume of the machine. Only in Native Docker. You can skip the video for 3:42 minutes (I did better, changed the url time). Also, wait until Youtube makes a better video quality.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.