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

[Services] Restart database service upon unexpected critical process exit. #4138

Merged
merged 7 commits into from
Feb 11, 2020
Merged

[Services] Restart database service upon unexpected critical process exit. #4138

merged 7 commits into from
Feb 11, 2020

Conversation

yozhao101
Copy link
Contributor

Signed-off-by: Yong Zhao [email protected]

  • What I did
    Restart database service if one of critical processes running in database container exited or crashed abnormally.

  • How I did it
    Generally I follow the framework created by Joe to implement this feature in database container.
    First, add supervisor-proc-exit-listener event listener option in Supervisord configuration file in database docker container. Supervisord will read a list of critical processes for which to monitor the unexpected crashed and exited.
    Second, configure database.service to always auto-restart the service if it stops, with a delay of 30 seconds. Also set a rate limit of 3 restarts within 20 minutes (1200 seconds).

  • How to verify it
    On your switch device, please use docker ps command to list all running docker containers.
    Then use docker exec -it container_id bash to login target container. Typing top command
    on the shell will display all the processes dynamically and you will spot the process id of one
    of the critical processes. Finally type the command kill -9 process_id to terminate one process.
    After exiting the container, you can use watch -n 1 docker ps to dynamically see the restart
    of database container.

@yozhao101 yozhao101 requested a review from jleveque February 10, 2020 23:43
already have updategraph ---> config_setup ---> database, we do not need
explicitly add database.service in all other container service files.

Signed-off-by: Yong Zhao <[email protected]>
@yozhao101 yozhao101 merged commit 729f343 into sonic-net:master Feb 11, 2020
abdosi pushed a commit that referenced this pull request Feb 14, 2020
…exit. (#4138)

* [database] Implement the auto-restart feature for database container.

Signed-off-by: Yong Zhao <[email protected]>

* [database] Remove the duplicate dependency in service files. Since we
already have updategraph ---> config_setup ---> database, we do not need
explicitly add database.service in all other container service files.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Reorganize the line 73 in event listener script.

Signed-off-by: Yong Zhao <[email protected]>

* [database] update the file sflow.service.j2 to remove the duplicate
dependency.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add comments in event listener.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Update the comments in line 56.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add parentheses for if statement in line 76 in event listener.

Signed-off-by: Yong Zhao <[email protected]>
stepanblyschak pushed a commit to stepanblyschak/sonic-buildimage that referenced this pull request Feb 26, 2020
…exit. (sonic-net#4138)

* [database] Implement the auto-restart feature for database container.

Signed-off-by: Yong Zhao <[email protected]>

* [database] Remove the duplicate dependency in service files. Since we
already have updategraph ---> config_setup ---> database, we do not need
explicitly add database.service in all other container service files.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Reorganize the line 73 in event listener script.

Signed-off-by: Yong Zhao <[email protected]>

* [database] update the file sflow.service.j2 to remove the duplicate
dependency.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add comments in event listener.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Update the comments in line 56.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add parentheses for if statement in line 76 in event listener.

Signed-off-by: Yong Zhao <[email protected]>
pphuchar pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Mar 9, 2020
…exit. (sonic-net#4138)

* [database] Implement the auto-restart feature for database container.

Signed-off-by: Yong Zhao <[email protected]>

* [database] Remove the duplicate dependency in service files. Since we
already have updategraph ---> config_setup ---> database, we do not need
explicitly add database.service in all other container service files.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Reorganize the line 73 in event listener script.

Signed-off-by: Yong Zhao <[email protected]>

* [database] update the file sflow.service.j2 to remove the duplicate
dependency.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add comments in event listener.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Update the comments in line 56.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add parentheses for if statement in line 76 in event listener.

Signed-off-by: Yong Zhao <[email protected]>
tiantianlv pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Apr 24, 2020
…exit. (sonic-net#4138)

* [database] Implement the auto-restart feature for database container.

Signed-off-by: Yong Zhao <[email protected]>

* [database] Remove the duplicate dependency in service files. Since we
already have updategraph ---> config_setup ---> database, we do not need
explicitly add database.service in all other container service files.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Reorganize the line 73 in event listener script.

Signed-off-by: Yong Zhao <[email protected]>

* [database] update the file sflow.service.j2 to remove the duplicate
dependency.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add comments in event listener.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Update the comments in line 56.

Signed-off-by: Yong Zhao <[email protected]>

* [event listener] Add parentheses for if statement in line 76 in event listener.

Signed-off-by: Yong Zhao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants