Error While creating second alpha image

I have tried below command to run to create second alpha for my cluster

dgraph alpha --lru_mb=2048 --my=10.100.64.33:7081 --zero localhost:5080 -o=1

but it is showing an error

Error while creating badger KV WAL store error: resource temporarily unavailableCannot acquire directory lock on “w”. Another process is using this Badger database.

Can you explain to me how to resolve this error?

This means that you forced a turn off of Dgraph. To “solve” this just delete a file .lock on /w or /p directories.

Where should I find these directories or .lock file?

Where you started Dgraph. Open the terminal and run “PWD”.

Okay. But in w and p directory only three files are there .vlog .sst and MANIFEST
.lock file is not there in those directories.

Well that means you’re not in the desired file path. If you try to start Dgraph and it gives the error about “lock”, it means that there is a .lock.

Clean those files and start from scratch.

Yes, done! I have deleted lock file. Now again I have to run from scratch? right? or just by running second alpha image it will work.

If you found the lock file then you do not have to start from scratch. Unless you want to.

I found it and deleted from both p and w directories. Then I have run a command

dgraph alpha --lru_mb=2048 --my=10.100.64.33:7081 --zero localhost:5080 -o=1

But again it is creating a lock file in those directories.

Well, Dgraph have to create it. You only delete it in an emergency context. If you close Dgraph correcly, Dgraph will take off the locks.

Okay , so how to close Dgraph? or how to overcome this issue?

ctrl + C
OR
Command + c
and wait. It will do a sigterm turn off.

Well, I am not sure but I think for both alpha images … I think there should separate w and p directories and that is why it is creating problem.
Isn’t it?

Hum, tell me what exactly are you doing? Alpha images? are running docker? are u running binaries locally? If you’re running docker nothing like that should be happening.

No, I am not using Docker. I am running on a locally installed binary. Ya so, I want to create a cluster with 3 alpha so that I can run DGraph in distributed mode. That is why, I am following these steps.

In this procedure while running second alpha it is showing error

Error while creating badger KV WAL store error: resource temporarily unavailableCannot acquire directory lock on “w”. Another process is using this Badger database.

As this error says Another process is using this Badger database. I thought there might be some directories issue.

Okay, now I understand your context. And that below what is happening since the beginning.

If you run Dgraph by binaries in the same path. It will overwrite any default file. Not just .lock files.

Yes!
So do I have to create different one? If yes, then How?

Create a folder for each Alpha. Then open a terminal for each one and “cd to each path”. And run it normally as you’re doing.

Ooh okay. For dgraph zero there is no change …right?