Blog


  • WordPress update all post with WP-CLI

    In wordpress folder, run commands: Above commands mean “do nothing”. But you can edit to do something.

    >> Read more

  • Run WP CRON with crontab and WP CLI

    Download wp-cli: Add crontab in /var/spool/cron/root: Make sure your crontab file is good linux format: Disable WP_CRON in wp-config.php: By Proxy, block or return empty page for requests to your http://domain.com/wp-cron.php

    >> Read more

  • Tuning performance Mariadb/ MySQL

    Add more config (maybe at /etc/my.cnf.d/server.conf): With a powerful server, can adjust I/O: How to find the good innodb_buffer_pool_size number? Here is Recommended InnoDB Buffer Pool Size: Or adjust more 10%: After your DB run with new config in a period time (daily, weekly,…), check how many memory in used. This Data_MB number can be…

    >> Read more

  • Run PHP-FPM (FastCGI) with NGINX

    Install PHP-FPM (FastCGI) and NGINX Selinux Create new website: New user and project Create new php-fpm pool New file: /etc/php-fpm.d/domain.com.conf: Restart Create Nginx config: Restart Install SSL Install certbot: Create cert Then update cert to nginx config with new server block for port 443 ssl with fastcgi_param HTTPS on; and declare cert & key. Some…

    >> Read more

  • Install ClamAV antivirus or Linux Malware Detect

    Install ClamAV Install Linux Malware Detect ClamAV should be install first, helpful for Linux Malware Detect. Install Linux Malware Detect: Scan: Show quarantine files:

    >> Read more

  • Count the usage size of Mariadb/MySQL

    Query: Result:

    >> Read more

  • Config HAProxy community edition Active/Active cluster (Solution)

    The first, install keepalived to manage Virtual IP. My concept is use 2 Virtual IPs bind on 2 Nodes. Node 1 is MASTER on Virtual IP 1 and BACKUP on Virtual IP 2, Node 2 is MASTER on Virtual IP 2 and BACKUP on Virtual IP 1. DNS Round-robin to 2 Public IPs, every Public…

    >> Read more

  • Count connections to the Server

    Find nginx pid: Results: pool: mean nginx run php-fpm master: not worker, just is a parent cache manager: Just for cache color=auto: The ps -ef | grep nginx worker process: This is result. 57234 is parent pid, this pid is 57235 So, if we have many worker process pids from 1833681 to 1833692. We can…

    >> Read more

  • Makes NextJS easy to understand

    >> Read more

  • UI/UX Design thinking

    >> Read more

  • Tips to improve Kafka performance

    >> Read more

  • Write Error Logs only in mongodb.log

    Write Cron Job as below Change example by your path

    >> Read more

  • Use Child_Process to pull code?

    Yes, that is a simple opinion. Do it with one simple file: Now, you can write an API to call http://localhost:3000 to pull 3 project. You can `composer update` or something more.

    >> Read more

  • Convert Interface in Typescript

    I have one Interface: Convert fields in the interface to required The desired result is as follows: Solution: Convert fields in the interface to optional The desired result is as follows: Solution: Convert some fields by name instead of all The desired result is as follows: Solution: Convert fields in the interface to other value…

    >> Read more

  • Install VPN Client on Linux

    My Example for RHEL/Centos/Linux… Important: Just some SNX Build version work in CLI mode! Install SNX build 800007075: Or install SNX build 800010003: Connect to VPN Checkpoint:

    >> Read more

  • Create new Linux User with ChrootDirectory

    This is quick trick for chroot user in Linux Or make a bash-script for 1 hit (save below code in create-user.sh file then run):

    >> Read more

  • Create MongoDB cluster with 3 nodes

    Edit /etc/hosts file in 3 nodes, add with 3 node ips: In terminal, set root password: Create ssl key then COPY folder to all members for same key. Disable THP: Edit file /etc/mongod.conf, add: Restart mongod for all nodes: Connect to primary node (node 1) with your yourRootPassword Setup replication: Check it: Create new user…

    >> Read more

  • Create Kafka Cluster with 3 nodes

    Edit file “server.properties” with different broker.id and advertised.listeners: Delete folder “logs” which defined in config (“/home/kafka/logs”) in secondary nodes and folder “zookeeper”. Stop all nodes then restart all node: Important! In node 01: Open meta.properties file in /home/kafka/logs. Copy cluster.id value. Paste cluster.id value to /home/kafka/logs/meta.properties in other node, for the same cluster. For multi…

    >> Read more

  • Create Redis Cluster with few steps

    With 3 computers (10.5.10.1, 10.5.10.2, 10.5.10.3). My example is Rocky Linux/ Centos Step 1: Install Redis on computer Step 2: Edit /etc/redis.conf: Step 3: Open Firewall on 7001 & 17001 (7001+10000): Step 4: Run Redis Server with command: Repeat all steps above on other computer with other port (7002, 7003) Step 5: Create cluster Open…

    >> Read more

  • How to alert when disk usage is greater than the allowable threshold easily?

    Alert when disk usage is greater than the allowable How to alert when disk usage is greater than the allowable threshold easily?You can set a cron job to check disk usage then send to you alert-API when it is greater than the allowable threshold. Here is an example, hourly periodic check. If the system has…

    >> Read more

  • Build NestJS Library

    To build a NestJS library, you can follow these steps: Create a new NestJS project using the NestJS CLI: Change the working directory to your library folder: Create a new library module using the NestJS CLI: This will generate a new folder my-library inside the src folder. This folder contains the library module and its…

    >> Read more

  • Completely remove user accounts on linux for security

    Completely remove user accounts on linux for security:Show all User account: Kill all programs running by this user: Delete the user, all the user’s files and folders will also be deleted:

    >> Read more

  • MongoDB error: child process failed, exited with error number

    Check all path in /etc/mongod.conf. If files or folders not exist, create them then:

    >> Read more

  • Install and use Docker on Linux/ Centos/ Rocky Linux

    Basic: Build from OS and your apps

    >> Read more

  • Compare strings and calculate scores, find the closest string

    Compare strings and calculate scores, find the closest string by JS:

    >> Read more

  • Store compressed data in MongoDB and decompress it

    Storing compressed data in MongoDB and decompressing it is a necessary task when you store large data files like Logs. Database schema Interface Upload Controller Method: POST – ‘multipart/form-data‘ Field name: file Type: Use .zip file for lightweight Allows to use multiple text files in a zip file Upload Service Input: file Extract the zip…

    >> Read more

  • NGINX – Installation and configuration

    It’s easy to install NGINX from the repo. For example on RHEL/ Centos/ Rocky Linux: So, this tutorial I want to show you how to install from source. You can read something here for NGINX and streaming: [Full install] Streaming HLS with Nginx & FFMPEG (quicktricks.net). Or below: Preparing for the installation Install some required…

    >> Read more

  • MongoServerError: Plan executor error during findAndModify :: caused by :: E11000 duplicate key error collection [Solved]

    Tips for “MongoServerError: Plan executor error during findAndModify :: caused by :: E11000 duplicate key error collection“. Mongo duplicate when findAndModify(), same for findOneAndUpdate() Don’t try to query the dynamic field with the upsert option! The same problem will occur when querying multiple conditions (include some not unique fields), while turn on option upsert=true. This…

    >> Read more

  • [Full install] Streaming HLS with Nginx & FFMPEG

    This guide for Centos/ RHEL/ Rocky Linux,… So, you can use for other Linux. Install some required packages Install NGINX from source Download some required packages: ZLIB: Find lastest version here: https://zlib.net/ My version is https://zlib.net/zlib-1.2.12.tar.gz PCRE Find lastest version here: https://www.pcre.org/ or https://sourceforge.net/projects/pcre/files/pcre2/ My version is pcre2-10.37.tar.gz OPEN SSL Find lastest version here: https://www.openssl.org/source/…

    >> Read more

  • [Installation] System monitoring with Grafana + Prometheus + Node Export on Linux

    This guide use RHEL/Centos/RockyLinux. Other OS are same. You should have 2 SERVERs: Monitoring server: Install Grafana Monitored server: Install Prometheus PROMETHEUS INSTALL (On monitored server) Create user for this service: // Swap to prometheus user: Create directories: Download Prometheus: Create a config file: Create a service file, this is an examle use port 9090…

    >> Read more