Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Elastic Agent] Prevent a second agent from starting. #18243

Closed
ph opened this issue May 5, 2020 · 9 comments · Fixed by #18483
Closed

[Elastic Agent] Prevent a second agent from starting. #18243

ph opened this issue May 5, 2020 · 9 comments · Fixed by #18483
Assignees
Labels
Ingest Management:beta1 Group issues for ingest management beta1

Comments

@ph
Copy link
Contributor

ph commented May 5, 2020

Prevent a second instance of the Agent from running to reduce the problems of collision in the configuration or race in the configuration on disk

@ph ph added elastic-agent Ingest Management:beta1 Group issues for ingest management beta1 labels May 5, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@ph
Copy link
Contributor Author

ph commented May 5, 2020

cc @EricDavisX

@EricDavisX EricDavisX changed the title [Elastic Agent] Revent a second agent from starting. [Elastic Agent] Prevent a second agent from starting. May 5, 2020
@EricDavisX
Copy link
Contributor

what is the actual desired behavior if / when this is attempted? Perhaps the behavior should be to un-install the existing agent and then install the new / current agent? I don't know ramifications.

@blakerouse
Copy link
Contributor

@ph I think with #18021 we can easily prevent multiple from running. Being that the GRPC server will be open on a specific port or socket. We can verify that if its already in use then to not start.

@ph
Copy link
Contributor Author

ph commented May 12, 2020

@blakerouse I think we might need mot than that, I was considering adding an flock on the data folder to make sure only one process can read the file in it. This would prever two agents running on different port accessing the same files.

@blakerouse
Copy link
Contributor

@ph okay I can work on adding the flock

@ruflin
Copy link
Member

ruflin commented May 13, 2020

Is a flock something that is supported cross platform?

@blakerouse
Copy link
Contributor

Seems github.com/gofrs/flock supports both unix and windows, so should be. libbeat already uses that module in its libbeat/cmd/instance/locker.go.

@ph
Copy link
Contributor Author

ph commented May 13, 2020

@blakerouse sound good., I believe we use it for the exact same thing or even the persisted queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ingest Management:beta1 Group issues for ingest management beta1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants