Skip to content

Service stopped when MySQL server restarted #3

@indrarudia

Description

@indrarudia

When MySQL server restarted, vaisala-bbd Supervisor process failed to restart. It caused the service to stop and not receiving data from telnet server which make the data continue to stop.

Supervisor log:

cendana15@apicendana15:~/GitLab/bpptkg-meteo/examples/vaisala-bbd$ tail /var/log/supervisor/vaisala-bbd-error.log

Output:

  File "/home/cendana15/GitLab/bpptkg-meteo/examples/vaisala-bbd/venv/lib/python3.6/site-packages/sqlalchemy/engine/create.py", line 578, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/cendana15/GitLab/bpptkg-meteo/examples/vaisala-bbd/venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 583, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/home/cendana15/GitLab/bpptkg-meteo/examples/vaisala-bbd/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 130, in Connect
    return Connection(*args, **kwargs)
  File "/home/cendana15/GitLab/bpptkg-meteo/examples/vaisala-bbd/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 185, in __init__
    super().__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
(Background on this error at: http://sqlalche.me/e/14/e3q8)

Although that we can easily restart the service using sudo supervisorctl restart vaisala-bbd, it is more convenient that the service itself can detect the error as we rarely monitor the service whether is up or not in the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions