Skip to main content

Posts

Showing posts from February, 2021

Pgpool PgBouncer Postgresql streaming replication, load balancing and administration

The term scalability refers to the ability of a software system to grow as the business that uses it grows. PostgreSQL provides some features to help you build scalable solutions, but strictly speaking, PostgreSQL itself is not scalable. It can effectively use the following resources from one computer. Now, we will show you some configurations that may be useful for your use case. However, this can be problematic when distributing the database solution to multiple computers, because the standard PostgreSQL server can only run on a single computer. In this article, we will study different extension schemes and their implementation in PostgreSQL. Replication can be used in many expansion scenarios. Its main purpose is to create and maintain a backup database when the system fails. This is especially true for physical replication. However, replication can also be used to improve the performance of PostgreSQL-based solutions. Sometimes third-party tools can be used to implement complex exp

UFW Firewall config

Ubuntu includes its own firewall, known as ufw – short for “uncomplicated firewall.” Ufw is an easier-to-use frontend for the standard Linux iptables commands. You can even control ufw from a graphical interface. Ubuntu's firewall is designed as an easy way to perform basic firewall tasks without learning iptables apt-get install ufw  ufw default deny incoming ufw default allow outgoing vim /etc/ufw/user.rules  ### tuple ### allow any 22 0.0.0.0/0 any 94.111.115.2 in -A ufw-user-input -p tcp --dport 22 -s 94.111.115.2 -j ACCEPT -A ufw-user-input -p udp --dport 22 -s 94.111.115.2 -j ACCEPT   ufw enable     

Web Server log analysis ( Apache log analyzer )

If you just want to see which url is usually called by which devices or browser then just use goaccess. For example: apt-get install goaccess goaccess  -f /var/log/apache2/vindazo_be_access.log This way you can discover suspicious requests. Like [17/Feb/2021:07:01:05 +0100] "GET /job/?q=&l= HTTP/1.0" 200 975813 "-" "ApacheBench/2.3" In this way you can analyze traffic. Analyze log with python to process further results in application. python3 -m pip install apachelogs   >>> from apachelogs import LogParser >>> parser = LogParser("%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"") >>> # The above log format is also available as the constant `apachelogs.COMBINED`. >>> entry = parser.parse('209.126.136.4 - - [01/Nov/2017:07:28:29 +0000] "GET / HTTP/1.1" 301 521 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, lik