0

I have configured Hight Avaliabily WAL Log Shipping Hot Standby (SSL) with one node. But after I configure, both hosts (primary and secondary) take 100% CPU usage.

The most strange is because I have only one database called "TESTE" with one table called "EXAMPLE" to check if replication was OK. The replication worked perfectly but I don't understand why my CPU takes 100% usage because I don't have any application connect on my cluster.

I ran HTOP command and get this results:

Image 1 - Primary Server HTOP Info

Image 1 - Primary Server HTOP info

Image 2 - Secondary Server HTOP info

Image 2 - Secundary Server HTOP info

S.O. version:

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

PostgreSQL version:

postgres (PostgreSQL) 12.3 (Debian 12.3-1.pgdg100+1)

Primary server postgres.conf file:

max_connections = 100
SSL = on
shared_buffers = 2GB
work_mem = 10485kb
maintenance_work_mem = 512MB
dynamic_shared_memory_type = posix
effective_io_concurrency = 200
max_worker_processes = 4
max_parallel_maintenance_workers = 2
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
wal_level = replica
wal_buffers = 16MB
max_wal_size = 200MB
min_wal_size = 80MB
checkpoint_completion_target = 0.7
archive_mode = on
max_wal_senders = 3
wal_keep_segments = 8
hot_standby = on
hot_standby_feedback = on
random_page_cost = 1.1
effective_cache_size = 6GB
default_statistics_target = 100

pg_stat_activity info:

enter image description here

pg_stat_archiver info:

enter image description here

pg_stat_replication info: enter image description here

If I stop postgres service in both servers the CPU still has 100% usage.

Anyone can help me?

6
  • 2
    That command looks like as if you have been hacked. See here or here or here – a_horse_with_no_name Aug 19 '20 at 13:49
  • @a_horse_with_no_name Is it worth trying to change all passwords? It's a new cluster with no data – Leonardo Lacerda Aug 19 '20 at 13:56
  • Disconnect all servers from the internet, get rid of the malware, then re-configure Postgres to not allow connections with the superuser account from the outside. And then, yes, use secure passwords or SSH – a_horse_with_no_name Aug 19 '20 at 13:57
  • @a_horse_with_no_name But in this case, I use a cloud (IaaS). If I disconnect servers from the internet I lose my connection. – Leonardo Lacerda Aug 19 '20 at 14:01
  • @a_horse_with_no_name Can you post an answer to my question? It's really a malware. If you can post some safety tips and related articles to enrich the answer, I think it would be interesting for future readers. – Leonardo Lacerda Aug 19 '20 at 15:41
0

By exposing a database with a weak superuser password to the internet you invited somebody to break in and use your CPU for their own purposes, probably mining crypto-currencies.

Take the machine from the internet, wipe it clean and re-install the operating system. In the case of a hosted database, decommission the database and get a new one.

To protect yourself from this problem, choose good passwords.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.