occxx Technical Documentation

website·Indexed 30 days ago

https://www.occxx.com

A collection of technical guides and notes covering Kubernetes (k8s) installation and upgrades, database management (MySQL, MongoDB, Percona XtraDB Cluster), networking (WireGuard, H3C, Ingress-nginx), and system administration for Linux, Windows, and macOS.

Tokens
57.8K
Snippets
326
Records
352
Agent score
48%

What's inside occxx

  1. Overview of community.windows.psexec

    The community.windows.psexec module allows a Linux Ansible controller to run remote commands on Windows hosts without needing WinRM configured beforehand. It is primarily used to bootstrap Windows hosts to prepare them for WinRM or OpenSSH management.
  2. Overview of Percona XtraDB Cluster (PXC) Features

    Percona XtraDB Cluster (PXC) provides a high-availability MySQL solution with the following key characteristics:

    • Synchronous Replication: Data is written to all nodes simultaneously; if a single node fails, the write does not occur.
    • Multi-Source Replication: Any node in the cluster can trigger data updates.
    • Parallel Replication: Multiple threads on replicas execute replication at the row level.
    • Automatic Node Provisioning: New nodes automatically synchronize upon being added to the cluster.
    • Data Consistency: Eliminates out-of-sync nodes.
    • PXC Strict Mode: Prevents the use of technical previews and unsupported features.
    • ProxySQL Integration: Includes the proxysql-admin tool for automatic configuration of ProxySQL with PXC nodes.
    • Automatic SSL Configuration: Uses the pxc-encrypt-cluster-traffic variable to automate SSL encryption setup.
  3. Overview of Percona XtraDB Cluster (PXC) Features

    Percona XtraDB Cluster (PXC) provides a highly available MySQL solution with the following key characteristics:

    • Synchronous Replication: Data is written to all nodes simultaneously; if a single node fails, the write is not committed.
    • Multi-Source Replication: Any node in the cluster can trigger data updates.
    • Parallel Replication: Multiple threads on replicas execute replication at the row level.
    • Automatic Node Provisioning: New nodes automatically synchronize upon being added to the cluster.
    • Data Consistency: Eliminates the issue of out-of-sync nodes.
    • PXC Strict Mode: Prevents the use of technical previews and unsupported features.
    • ProxySQL Integration: Includes the proxysql-admin tool for automatic configuration of ProxySQL nodes.
    • Automatic SSL Configuration: Uses the pxc-encrypt-cluster-traffic variable to automate SSL encryption setup.
  4. Overview of Percona XtraDB Cluster (PXC) features

    Percona XtraDB Cluster (PXC) provides a high-availability MySQL solution with the following key characteristics:

    • Synchronous Replication: Data is written to all nodes simultaneously; if a single node fails, the write does not occur.
    • Multi-Source Replication: Any node in the cluster can trigger data updates.
    • Parallel Replication: Multiple threads on replicas execute replication at the row level.
    • Automatic Node Provisioning: New nodes synchronize automatically upon being added.
    • Data Consistency: Eliminates the issue of out-of-sync nodes.
    • PXC Strict Mode: Prevents the use of technical previews and unsupported features.
    • ProxySQL Integration: Includes the proxysql-admin tool for automatic configuration of ProxySQL nodes.
    • Automated SSL Configuration: Uses the pxc-encrypt-cluster-traffic variable to automate SSL encryption setup.
  5. Overview of Percona XtraDB Cluster (PXC) features

    Percona XtraDB Cluster (PXC) provides a high-availability MySQL solution with the following key characteristics:

    • Synchronous Replication: Data is written to all nodes simultaneously; if a single node fails, the write does not occur.
    • Multi-Source Replication: Any node in the cluster can trigger data updates.
    • Parallel Replication: Multiple threads on replicas execute replication at the row level.
    • Automatic Node Provisioning: New nodes synchronize automatically upon being added.
    • Data Consistency: Eliminates the issue of out-of-sync nodes.
    • PXC Strict Mode: Prevents the use of technical preview or unsupported features.
    • ProxySQL Integration: Includes the proxysql-admin tool for automatic configuration of ProxySQL nodes.
    • Automated SSL Configuration: Uses the pxc-encrypt-cluster-traffic variable to automate SSL encryption setup.
  6. Bootstrap Windows hosts using community.windows.psexec

    The community.windows.psexec module allows a Linux Ansible controller to run remote commands on Windows hosts without prior WinRM configuration. This is typically used to bootstrap a Windows machine so that it can later be managed via WinRM or OpenSSH.
  7. Understand RabbitMQ Exchange Types

    Exchanges route messages to queues based on specific logic:

    1. Direct Exchange: Exact match. Routes messages to queues where the Routing key matches the binding key exactly.
    2. Fanout Exchange: Broadcast. Ignores the Routing key and forwards messages to all bound queues.
    3. Headers Exchange: Attribute match. Routes based on the headers attribute of the message matching the binding parameters.
    4. Topic Exchange: Partial/fuzzy match. Routes messages based on a wildcard match between the Routing key and the binding key.
  8. Prepare Linux system environment for Kubernetes

    Before installing Kubernetes, disable swap and configure kernel parameters to ensure network stability and performance. This includes enabling the br_netfilter module and increasing file descriptor limits.
    # Disable swap
    swapoff -a
    sed -i 's/.*swap/#&/' /etc/fstab
    
    # Configure kernel parameters
    cat <<EOF > /etc/sysctl.d/k8s.conf
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    net.ipv4.ip_nonlocal_bind = 1
    net.ipv4.ip_forward = 1
    vm.swappiness = 0
    vm.max_map_count = 262144
    net.netfilter.nf_conntrack_max = 1000000
    EOF
    
    cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
    br_netfilter
    EOF
    
    # Increase file limits
    echo "* soft nofile 65536" >> /etc/security/limits.conf
    echo "* hard nofile 65536" >> /etc/security/limits.conf
    
    # Apply changes
    modprobe br_netfilter
    sysctl -p /etc/sysctl.d/k8s.conf
  9. Configure client login users in ProxySQL

    To allow clients to connect, the user must exist on both the MySQL backend nodes and the ProxySQL instance with matching credentials. ProxySQL currently only supports the mysql_native_password authentication plugin. Use default_hostgroup to route the user to a specific backend group.
    -- 1. Execute on MySQL backend nodes
    CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password by '123456';
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
    
    -- 2. Execute on ProxySQL admin interface
    INSERT INTO mysql_users (username,password,default_hostgroup) VALUES ('root',MYSQL_NATIVE_PASSWORD('123456'),0);
    LOAD MYSQL USERS TO RUNTIME;
    SAVE MYSQL USERS TO DISK;
    
    -- Verify
    SELECT * FROM mysql_users;
  10. Install and configure Remote Desktop Services (RDS)

    To set up Remote Desktop Services for session-based desktop deployment, follow these steps:

    1. Install Active Directory Domain Services (AD DS).
    2. Use the 'Add Roles and Features Wizard' to install Remote Desktop Services. Select 'Quick Start' and then 'Session-based desktop deployment'.
    3. Configure the deployment via Server Manager > Remote Desktop Services:
      • Configure the RD Gateway and RD Licensing from the Overview page.
      • To manage certificates: Go to the 'Deployment Overview Tasks' dropdown > 'Edit Deployment Properties' > 'Certificates'.

    Important Caveats:

    • Certificate Import Error: If you encounter the error "Unable to configure the certificate on one or more servers" when selecting an existing certificate, ensure the .pfx certificate is imported to the 'Local Machine' store.
    • RemoteApp Naming: Avoid using Chinese characters in RemoteApp aliases. Using non-ASCII characters can cause a "String has UTF-16 code units that do not fit in 8 bits" error, resulting in a black screen for users.
    # Example: Exporting a pfx certificate using openssl
    openssl pkcs12 -export -out twss.pfx -inkey /etc/pki/ssl/twss.tk.key -in /etc/pki/ssl/twss.tk.crt
  11. Install Apache Ambari Server and Agent

    Install the compiled Ambari Server and Agent packages using the system package manager. The packages are located in the target directory after a successful build.
    # RHEL (CentOS 7) & SUSE (SLES 12 SP2 & SP3)
    yum install ambari-server/target/rpm/ambari-server/RPMS/noarch/ambari-server*.rpm 
    yum install ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent*.rpm
    
    # Ubuntu/Debian
    apt-get install ambari-server/target/rpm/ambari-server/RPMS/noarch/ambari-server*.deb
    apt-get install ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent*.deb
  12. Compile and install libdaq and Snort 3 from source

    Snort 3 requires libdaq to be installed first. After installing libdaq, you can compile Snort 3 using the configure_cmake.sh script. The example below installs Snort 3 to /usr/local/snort3 with tcmalloc enabled.
    # Install libdaq
    git clone https://github.com/snort3/libdaq.git
    cd libdaq
    ./bootstrap
    ./configure
    make -j 4
    make install
    ldconfig
    
    # Install Snort 3
    cd ..
    git clone https://github.com/snort3/snort3.git
    cd snort3
    ./configure_cmake.sh --prefix=/usr/local/snort3 --enable-tcmalloc
    cd build
    make -j 4
    make install