Search code examples
postgresqlazureazure-virtual-machinewiki.js

Postgres Database in Azure VM not working properly


We are using Ubuntu Azure VM. We have installed Postgres 16.1 in the VM for wiki.js application. All the things are working properly for few hours. later we are getting the issue in Postgres terminal and Postgres got down,

enter image description here

in Postgres log file as

enter image description here

The steps in below link resolved our issue temporarily.

postgresql: Invalid data directory | Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory

But again we are getting the same error after few hours. We dont know what is the issue. Please help us to understand the issue.


Solution

  • My Azure VM got hacked because the default PostgreSQL port 5432 was exposed publicly.

    Because of that malware file added. Refer this

    a crypto mining malware that spreads by exploiting flaws in resources that are exposed to the public. Killing the process was of no use since the malware also adds a cron job to replicate itself so that it can’t be stopped.

    enter image description here

    Fixed the error by,

    1. Created a new VM and installed Postgres
    2. Strong password for Postgres database
    3. Open port to specific IP address.