<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tahmid Ul Muntakim</title>
    <description>The latest articles on DEV Community by Tahmid Ul Muntakim (@tms7).</description>
    <link>https://dev.to/tms7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F831045%2F184425ca-2eb0-4dc0-9712-16c506459f51.png</url>
      <title>DEV Community: Tahmid Ul Muntakim</title>
      <link>https://dev.to/tms7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tms7"/>
    <language>en</language>
    <item>
      <title>MariaDB Administration Cheat Sheet: Practical Use Cases and Examples</title>
      <dc:creator>Tahmid Ul Muntakim</dc:creator>
      <pubDate>Fri, 10 Jan 2025 14:00:58 +0000</pubDate>
      <link>https://dev.to/tms7/mariadb-administration-cheat-sheet-practical-use-cases-and-examples-4fc</link>
      <guid>https://dev.to/tms7/mariadb-administration-cheat-sheet-practical-use-cases-and-examples-4fc</guid>
      <description>&lt;p&gt;&lt;strong&gt;MariaDB Administration Cheat Sheet: Practical Use Cases and Examples&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Managing MariaDB effectively requires an in-depth understanding of its core configurations, commands, and features. This cheat sheet, enriched with interactive use cases, provides a practical guide for database administrators to handle MariaDB efficiently.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Core Configurations&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;MariaDB Configuration File:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Location: &lt;code&gt;/etc/mysql/mariadb.conf.d/50-server.cnf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Key sections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;[mysqld]:&lt;/strong&gt; Define server options like port, socket, and datadir.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;port = 3306
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Logging Options:&lt;/strong&gt; Enable logs for monitoring.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;log_error = /var/log/mysql/error.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 1
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Performance Tuning:&lt;/strong&gt; Optimize performance with parameters like:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;innodb_buffer_pool_size = 512M
query_cache_size = 32M
max_connections = 200
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Interactive Use Case:&lt;/strong&gt;&lt;br&gt;
Imagine your database performance degrades during peak traffic. By tweaking &lt;code&gt;innodb_buffer_pool_size&lt;/code&gt;, you can allocate more memory for caching data, significantly improving read speeds.&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;strong&gt;Basic Commands&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Starting MariaDB Service:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start mariadb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Accessing MariaDB Shell:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Creating a Database:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;sales_data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Granting Privileges:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;USER&lt;/span&gt; &lt;span class="s1"&gt;'lab_user'&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;'localhost'&lt;/span&gt; &lt;span class="n"&gt;IDENTIFIED&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="s1"&gt;'test123'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;sales_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="s1"&gt;'lab_user'&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;'localhost'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;FLUSH&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Exiting MariaDB Shell:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;QUIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;Use Case: Recovering from Common Issues&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Anonymous user conflicts with root login.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start MariaDB in safe mode:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;mysqld_safe &lt;span class="nt"&gt;--skip-grant-tables&lt;/span&gt; &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Update root user password:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;user&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;authentication_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PASSWORD&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'newpassword'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;User&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'root'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;Host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'localhost'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;FLUSH&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Restart MariaDB:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart mariadb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Hands-On: Creating and Managing a Table&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; Creating a table for student records in a new database &lt;code&gt;lab_db&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create the database:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;lab_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Use the database:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="n"&gt;USE&lt;/span&gt; &lt;span class="n"&gt;lab_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;students&lt;/code&gt; table:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="n"&gt;AUTO_INCREMENT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;
   &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Insert a record:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Alice'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Update the record:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Alice'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Delete the record:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;DELETE&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Alice'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Drop the table and database:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;DROP&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;DROP&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;lab_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Performance Monitoring&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Enable Slow Query Log:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Edit the configuration file:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/mysql/mariadb.conf.d/50-server.cnf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   slow_query_log = 1
   slow_query_log_file = /var/log/mysql/mariadb-slow.log
   long_query_time = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Restart MariaDB:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart mariadb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Check Logs:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /var/log/mysql/mariadb-slow.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;Advanced Concepts: Role Management&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Creating and Assigning Roles:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a role:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;ROLE&lt;/span&gt; &lt;span class="s1"&gt;'developer_role'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Grant privileges to the role:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;project_alpha&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="s1"&gt;'developer_role'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Assign the role to a user:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="s1"&gt;'developer_role'&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="s1"&gt;'bob'&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;'192.168.121.%'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Revoking Roles:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;REVOKE&lt;/span&gt; &lt;span class="s1"&gt;'developer_role'&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="s1"&gt;'bob'&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;'192.168.121.%'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;MariaDB in Docker&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Docker Setup for MariaDB:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;docker-compose.yaml&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.8'&lt;/span&gt;
   &lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="na"&gt;mariadb&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
       &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mariadb:10.5&lt;/span&gt;
       &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
         &lt;span class="na"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rootpassword&lt;/span&gt;
         &lt;span class="na"&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;testdb&lt;/span&gt;
       &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
         &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3306:3306"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the container:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker-compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Access MariaDB:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; &amp;lt;container_name&amp;gt; mariadb &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;MyISAM and InnoDB Storage Engines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Key Differences:&lt;/p&gt;

&lt;p&gt;MyISAM:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simplicity and Speed: Optimized for read-heavy operations.&lt;/li&gt;
&lt;li&gt;No Transactions: Lacks ACID compliance.&lt;/li&gt;
&lt;li&gt;Table-Level Locking: Can lead to contention in write-heavy environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;InnoDB:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ACID Compliance: Supports transactions for data integrity.&lt;/li&gt;
&lt;li&gt;Row-Level Locking: Higher concurrency for write-heavy applications.&lt;/li&gt;
&lt;li&gt;Foreign Key Support: Enforces referential integrity between tables.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When to Use:&lt;/p&gt;

&lt;p&gt;Use MyISAM for read-heavy operations requiring full-text indexing.&lt;/p&gt;

&lt;p&gt;Use InnoDB for transactional applications needing high reliability and data integrity.&lt;/p&gt;




&lt;p&gt;Table Partitioning Cheat Sheet&lt;/p&gt;

&lt;p&gt;Why Needed:&lt;/p&gt;

&lt;p&gt;Distribute large tables into smaller, manageable pieces.&lt;/p&gt;

&lt;p&gt;Improve query performance by scanning only relevant partitions.&lt;/p&gt;

&lt;p&gt;Enable parallel processing for better throughput.&lt;/p&gt;

&lt;p&gt;Common Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE sales (
    id INT,
    sale_date DATE
) PARTITION BY RANGE (YEAR(sale_date)) (
    PARTITION p0 VALUES LESS THAN (2000),
    PARTITION p1 VALUES LESS THAN (2010),
    PARTITION p2 VALUES LESS THAN MAXVALUE
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Partition Types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Range Partitioning: Based on column value ranges.&lt;/li&gt;
&lt;li&gt;List Partitioning: Uses discrete column values.&lt;/li&gt;
&lt;li&gt;Hash Partitioning: Distributes data based on a hash function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;**Table Indexing and Why Needed&lt;/p&gt;

&lt;p&gt;Why Indexing Matters:**&lt;/p&gt;

&lt;p&gt;Speed up data retrieval for large datasets.&lt;/p&gt;

&lt;p&gt;Optimize query performance, especially for SELECT statements.&lt;/p&gt;

&lt;p&gt;Enforce uniqueness of column values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Index Types:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primary Index: Automatically created for the primary key.&lt;/li&gt;
&lt;li&gt;Unique Index: Ensures column values are distinct.&lt;/li&gt;
&lt;li&gt;Full-Text Index: Used for text-based searches.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Composite Index: Combines multiple columns for advanced queries.&lt;/p&gt;

&lt;p&gt;Creating an Index:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE INDEX idx_name ON students (name);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Best Practices:&lt;/p&gt;

&lt;p&gt;Use indexes sparingly to avoid performance overhead during INSERT and UPDATE.&lt;/p&gt;

&lt;p&gt;Analyze query patterns to determine the most effective columns to index.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Closing Thoughts&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This cheat sheet encapsulates essential MariaDB commands, configurations, and troubleshooting techniques. By combining these practices with real-world scenarios, you’ll be well-equipped to manage MariaDB databases with confidence. Dive into these use cases and bring efficiency to your database administration tasks!&lt;/p&gt;

&lt;p&gt;MariaDB is a powerful and open-source #DatabaseManagement system widely used for efficient #DataStorage and #SQL operations. With its compatibility with Docker, #MariaDBDocker offers seamless containerization, making it a favorite in #DevOps workflows. By leveraging #DatabaseOptimization techniques like #TablePartitioning and #Indexing, administrators can achieve better performance and scalability. Understanding the difference between #InnoDB and #MyISAM storage engines is crucial for making informed decisions in #DatabaseAdministration. For those passionate about #LearningSQL and #TechTips, MariaDB serves as an excellent platform to enhance #ITSupport skills and create a robust #OpenSource environment.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Java Build and Packaging: A Beginner's Guide to DevOps</title>
      <dc:creator>Tahmid Ul Muntakim</dc:creator>
      <pubDate>Sat, 09 Nov 2024 14:44:33 +0000</pubDate>
      <link>https://dev.to/tms7/understanding-java-build-and-packaging-a-beginners-guide-to-devops-2jjo</link>
      <guid>https://dev.to/tms7/understanding-java-build-and-packaging-a-beginners-guide-to-devops-2jjo</guid>
      <description>&lt;h1&gt;
  
  
  Understanding Java Build and Packaging: A Beginner's Guide to DevOps#
&lt;/h1&gt;

&lt;p&gt;Hey there, future DevOps engineers! 👋 If you're just starting your journey into the world of Java build processes, you're in the right place. Today, we're going to break down everything you need to know about building and packaging Java applications – no previous experience required!&lt;/p&gt;

&lt;h2&gt;
  
  
  First Things First: What's Java, Anyway?
&lt;/h2&gt;

&lt;p&gt;Before we dive into the build process, let's get our basics straight. Java is like a universal language for computers. When developers write Java code, it gets transformed into something called "bytecode" that can run on any device with a Java Virtual Machine (JVM). Pretty neat, right?&lt;/p&gt;

&lt;p&gt;Here's a super simple Java program to get us started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloWorld&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, DevOps world!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This little program might look simple, but there's actually quite a bit happening behind the scenes when we want to run it. Let's explore that!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Build Process: From Code to Running Application
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Compilation
&lt;/h3&gt;

&lt;p&gt;Remember when I mentioned bytecode? That's what we get when we compile our Java code. Think of it like translating a recipe from English to a universal cooking language that any chef (or in our case, any computer) can understand.&lt;/p&gt;

&lt;p&gt;To compile our HelloWorld program, we'd use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;javac HelloWorld.java
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a &lt;code&gt;HelloWorld.class&lt;/code&gt; file – that's our bytecode!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Understanding Dependencies
&lt;/h3&gt;

&lt;p&gt;Real-world applications aren't as simple as our HelloWorld example. They usually need external libraries (we call these dependencies) to work. It's like building a car – you need parts from different manufacturers to make everything work together.&lt;/p&gt;

&lt;p&gt;Let's look at a more realistic project structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-java-app/
├── src/
│   └── main/
│       └── java/
│           └── com/
│               └── mycompany/
│                   ├── App.java
│                   └── Utils.java
├── pom.xml
└── target/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Enter Maven (Your New Best Friend)
&lt;/h3&gt;

&lt;p&gt;Maven is like your personal assistant for building Java applications. It handles all the tedious stuff like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Downloading dependencies&lt;/li&gt;
&lt;li&gt;Compiling your code&lt;/li&gt;
&lt;li&gt;Running tests&lt;/li&gt;
&lt;li&gt;Packaging everything together&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's a basic &lt;code&gt;pom.xml&lt;/code&gt; file (Maven's configuration file):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;project&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;modelVersion&amp;gt;&lt;/span&gt;4.0.0&lt;span class="nt"&gt;&amp;lt;/modelVersion&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.mycompany&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;my-java-app&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.0-SNAPSHOT&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;dependencies&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;junit&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;junit&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;4.13.2&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class="nt"&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/dependencies&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/project&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Building Your Application
&lt;/h3&gt;

&lt;p&gt;With Maven, building your application is as simple as running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn clean package
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cleans up any previous builds (&lt;code&gt;clean&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Compiles your code&lt;/li&gt;
&lt;li&gt;Runs your tests&lt;/li&gt;
&lt;li&gt;Creates a JAR file (Java ARchive) in the &lt;code&gt;target&lt;/code&gt; directory&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Packaging: Making Your Application Portable
&lt;/h2&gt;

&lt;p&gt;The final step is packaging your application. The most common package types are:&lt;/p&gt;

&lt;h3&gt;
  
  
  JAR Files
&lt;/h3&gt;

&lt;p&gt;Think of a JAR file as a zip file containing your compiled code and resources. It's perfect for libraries or simple applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  WAR Files
&lt;/h3&gt;

&lt;p&gt;Web Application aRchive files are used for web applications. They contain everything needed to run your web app, including HTML, CSS, and JavaScript files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spring Boot Executable JARs
&lt;/h3&gt;

&lt;p&gt;If you're using Spring Boot (a popular Java framework), you can create a special type of JAR that includes an embedded web server. It's like a complete meal deal – everything you need in one package!&lt;/p&gt;

&lt;h2&gt;
  
  
  Pro Tips From the Trenches 🛠️
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Always Use a Build Tool&lt;/strong&gt;: Don't try to manage dependencies manually. Maven or Gradle will save you countless hours of work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Version Everything&lt;/strong&gt;: Use semantic versioning for your applications (e.g., 1.0.0). It helps track changes and manage deployments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Keep Your Dependencies Updated&lt;/strong&gt;: Regular updates help prevent security vulnerabilities and ensure you're using the latest features.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automate Everything&lt;/strong&gt;: Learn to use continuous integration tools like Jenkins or GitHub Actions. They can automate your build process and catch issues early.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Let's Put It All Together
&lt;/h2&gt;

&lt;p&gt;Here's a complete example of building and packaging a simple Spring Boot application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone the project&lt;/span&gt;
git clone https://github.com/mycompany/java-app

&lt;span class="c"&gt;# Navigate to project directory&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;java-app

&lt;span class="c"&gt;# Build the application&lt;/span&gt;
mvn clean package

&lt;span class="c"&gt;# Run the application&lt;/span&gt;
java &lt;span class="nt"&gt;-jar&lt;/span&gt; target/my-java-app-1.0-SNAPSHOT.jar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Building and packaging Java applications might seem overwhelming at first, but it's really just a series of logical steps. Start with the basics we covered here, and gradually explore more advanced concepts as you get comfortable.&lt;/p&gt;

&lt;p&gt;Remember: everyone started somewhere, and DevOps is all about continuous learning. Don't be afraid to experiment and make mistakes – that's how we all learn!&lt;/p&gt;

&lt;p&gt;Have questions? Feel free to drop them in the comments below. Happy building! 🚀&lt;/p&gt;




&lt;p&gt;&lt;em&gt;P.S. Want to dive deeper? Check out the official Maven documentation and Spring Boot guides. They're fantastic resources for taking your Java DevOps skills to the next level!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>java</category>
      <category>devops</category>
    </item>
    <item>
      <title>Cilium vs. Calico Comparison</title>
      <dc:creator>Tahmid Ul Muntakim</dc:creator>
      <pubDate>Sat, 12 Oct 2024 15:37:37 +0000</pubDate>
      <link>https://dev.to/tms7/cilium-vs-calico-comparison-3b44</link>
      <guid>https://dev.to/tms7/cilium-vs-calico-comparison-3b44</guid>
      <description>&lt;p&gt;&lt;strong&gt;In Kubernetes network policy management, Cilium and Calico have emerged as two leading contenders. Both tools offer robust solutions for securing and controlling network traffic within Kubernetes clusters. This blog post will clarify Cilium and Calico, highlighting their key features, advantages, and potential use cases.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Choosing Between Cilium and Calico&lt;/em&gt;&lt;br&gt;
The best choice between Cilium and Calico depends on your specific requirements and preferences. Consider the following factors when making your decision: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance&lt;/strong&gt;: If high performance is a critical factor, Cilium's eBPF-based approach may be the better choice. &lt;br&gt;
&lt;strong&gt;Complexity&lt;/strong&gt;: If you prefer a simpler solution, Calico might be easier to manage. &lt;br&gt;
&lt;strong&gt;Features&lt;/strong&gt;: Evaluate the specific features offered by each tool to determine if they align with your needs. &lt;br&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Consider the level of integration with other tools or technologies in your environment. &lt;/p&gt;

&lt;p&gt;Go to this link for more details -&lt;br&gt;
&lt;a href="https://www.linkedin.com/pulse/cilium-vs-calico-comparison-tahmid-ul-muntakim-tpqcc/?trackingId=NhBNGODwTZmiypZfuOiCRQ%3D%3D" rel="noopener noreferrer"&gt;https://www.linkedin.com/pulse/cilium-vs-calico-comparison-tahmid-ul-muntakim-tpqcc/?trackingId=NhBNGODwTZmiypZfuOiCRQ%3D%3D&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both Cilium and Calico are powerful tools for managing network policies in Kubernetes clusters. The choice between them depends on your specific needs and priorities. By evaluating their features, advantages, and potential use cases carefully, you can select the tool that best suits your Kubernetes environment.&lt;/p&gt;

&lt;h1&gt;
  
  
  Kubernetes #Cilium #Calico #networking
&lt;/h1&gt;

&lt;h1&gt;
  
  
  NetworkPolicy #NetworkSecurity #CloudNative #DevOps #Cilium #Calico #eBPF #BGP #KubernetesNetworking #ContainerSecurity #Microservices #DevSecOps #CloudSecurity #ITSecurity
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>Do You Know /proc at Linux Does Not Contain Real Files?</title>
      <dc:creator>Tahmid Ul Muntakim</dc:creator>
      <pubDate>Fri, 06 Sep 2024 17:22:08 +0000</pubDate>
      <link>https://dev.to/tms7/do-you-know-proc-at-linux-does-not-contain-real-files-55ne</link>
      <guid>https://dev.to/tms7/do-you-know-proc-at-linux-does-not-contain-real-files-55ne</guid>
      <description>&lt;h3&gt;
  
  
  Do You Know /proc at Linux Does Not Contain Real Files?
&lt;/h3&gt;

&lt;p&gt;The proc file system, often referred to as &lt;code&gt;/proc&lt;/code&gt;, is a pseudo file system that provides a dynamic interface to the kernel's data structures. Unlike traditional file systems, &lt;code&gt;/proc&lt;/code&gt; doesn't contain real files. Instead, it holds virtual files that are created on-the-fly, reflecting the current state of the system. This file system is created upon system boot and disappears when the system shuts down. By navigating &lt;code&gt;/proc&lt;/code&gt;, you can gain deep insights into various kernel components and processes, making it a powerful tool for system administrators.&lt;/p&gt;

&lt;h3&gt;
  
  
  Navigating the &lt;code&gt;/proc&lt;/code&gt; Directory
&lt;/h3&gt;

&lt;p&gt;Within &lt;code&gt;/proc&lt;/code&gt;, you'll find numerous subdirectories and files, each offering specific information about the system. Each process running on the system has its own directory in &lt;code&gt;/proc&lt;/code&gt;, identified by its process ID (PID). For example, &lt;code&gt;/proc/[PID]/&lt;/code&gt; contains detailed information about a particular process, including its status, command line arguments, and file descriptors.&lt;/p&gt;

&lt;p&gt;Some files within &lt;code&gt;/proc&lt;/code&gt; are read-only, providing static details like the operating system version or CPU information. Others are writable, allowing you to configure kernel tunables and settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Commonly Used Files and Subdirectories
&lt;/h3&gt;

&lt;p&gt;Here are some essential files and subdirectories within &lt;code&gt;/proc&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;/proc/cpuinfo:&lt;/strong&gt; Provides detailed information about the CPU, including its model, clock speed, and cache size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/proc/meminfo:&lt;/strong&gt; Displays details about the system's memory usage, including total, free, and used memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/proc/swaps:&lt;/strong&gt; Shows information about the swap space, including its total, free, and used capacity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/proc/mounts:&lt;/strong&gt; Lists the currently mounted file systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/proc/self/stat:&lt;/strong&gt; Provides statistics about the current process, including its process ID, CPU time, memory usage, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/proc/sys/:&lt;/strong&gt; Contains subdirectories with various kernel tunables that can be modified to fine-tune system behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Configuring Kernel Tunables
&lt;/h3&gt;

&lt;p&gt;To modify kernel tunables, you'll typically write to specific files within the &lt;code&gt;/proc/sys/&lt;/code&gt; hierarchy. For example, to adjust the TCP buffer size, you might write to &lt;code&gt;/proc/sys/net/ipv4/tcp_mem&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"4096 65536 16777216"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /proc/sys/net/ipv4/tcp_mem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Persistent vs. Temporary Changes
&lt;/h4&gt;

&lt;p&gt;Changes made directly to &lt;code&gt;/proc&lt;/code&gt; files are typically temporary and will be lost upon reboot. To make changes persistent, you should use the &lt;code&gt;sysctl&lt;/code&gt; tool and configure settings in &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; or create custom configuration files in &lt;code&gt;/etc/sysctl.d/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"net.ipv4.tcp_mem = 4096 65536 16777216"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/sysctl.conf
sysctl &lt;span class="nt"&gt;-p&lt;/span&gt;  &lt;span class="c"&gt;# Apply the changes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Modifying Kernel Tunables Persistently
&lt;/h4&gt;

&lt;p&gt;In this blog, I will talk about modifying kernel tunables persistently. The kernel loads tunable settings from configuration files found in the following directories during boot. The kernel tunable configuration files must end with &lt;code&gt;.conf&lt;/code&gt; to be loaded automatically.&lt;/p&gt;

&lt;p&gt;When modifying kernel tunables, always create a file inside &lt;code&gt;/etc/sysctl.d&lt;/code&gt;. Never modify files inside &lt;code&gt;/usr/lib/sysctl.d&lt;/code&gt;, as this directory contains configurations set by the vendor in the package distribution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Modify Kernel Tunables:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the parameter you want to change using the command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   sysctl &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;parameter_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, if the current value of the parameter is 30 and you want to change it, use the &lt;code&gt;sysctl&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   sysctl &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;parameter_name]&lt;span class="o"&gt;=[&lt;/span&gt;new_value]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Making the Change Permanent:&lt;/strong&gt;
To make the change permanent, create a configuration file in &lt;code&gt;/etc/sysctl.d/&lt;/code&gt; with the &lt;code&gt;.conf&lt;/code&gt; extension. The name of the file doesn't matter, but the extension must be &lt;code&gt;.conf&lt;/code&gt;. Inside the file, mention the parameter with its desired value:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"[parameter_name] = [new_value]"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /etc/sysctl.d/my_custom.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Applying the Configuration Without Reboot:&lt;/strong&gt;
Use the following command to apply the configuration without rebooting:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   sysctl &lt;span class="nt"&gt;-p&lt;/span&gt; /etc/sysctl.d/my_custom.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After executing this command, the parameter value will be updated.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Verifying the Change:&lt;/strong&gt;
Re-run the &lt;code&gt;sysctl -n [parameter_name]&lt;/code&gt; command to verify the new value.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, when the system reboots, it will automatically load the configuration files from the mentioned locations, ensuring the kernel tunables are set according to your custom configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security Considerations
&lt;/h3&gt;

&lt;p&gt;While &lt;code&gt;/proc&lt;/code&gt; provides valuable information, it also exposes sensitive data, such as process details and system configurations. To enhance security, you can restrict access to &lt;code&gt;/proc&lt;/code&gt; for non-privileged users. For example, adding the following option to &lt;code&gt;/etc/fstab&lt;/code&gt; will hide process information from non-root users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;proc /proc proc defaults,hidepid&lt;span class="o"&gt;=&lt;/span&gt;2 0 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Practical Examples
&lt;/h3&gt;

&lt;p&gt;Here are some useful commands for exploring &lt;code&gt;/proc&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;View CPU information:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;cat&lt;/span&gt; /proc/cpuinfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enable IP forwarding:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;echo &lt;/span&gt;1 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /proc/sys/net/ipv4/ip_forward
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional Considerations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static vs. Dynamic Kernel Tunables:&lt;/strong&gt; Some tunables can be modified at runtime (e.g., TCP settings), while others require a kernel rebuild.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact of Changes:&lt;/strong&gt; Be cautious when modifying kernel tunables. Changes can have unintended consequences, such as system instability or degraded performance. Always test changes in a controlled environment before applying them to production systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persistent Changes:&lt;/strong&gt; Use &lt;code&gt;sysctl&lt;/code&gt; for persistent configurations. Direct modifications to &lt;code&gt;/proc&lt;/code&gt; will not survive a reboot.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The proc file system is a versatile tool that offers deep insights into the Linux kernel. By exploring &lt;code&gt;/proc&lt;/code&gt; and understanding the available kernel tunables, you can optimize system performance and gain greater control over your environment. However, with great power comes great responsibility—always proceed with caution when making changes, and ensure you understand the potential impact.&lt;/p&gt;




</description>
    </item>
    <item>
      <title>Comparing RabbitMQ and Kafka: Choosing the Right Message Broker for Your Application</title>
      <dc:creator>Tahmid Ul Muntakim</dc:creator>
      <pubDate>Fri, 26 May 2023 16:49:31 +0000</pubDate>
      <link>https://dev.to/tms7/comparing-rabbitmq-and-kafka-choosing-the-right-message-broker-for-your-application-5g41</link>
      <guid>https://dev.to/tms7/comparing-rabbitmq-and-kafka-choosing-the-right-message-broker-for-your-application-5g41</guid>
      <description>&lt;p&gt;When it comes to handling large volumes of data and building robust messaging systems, RabbitMQ and Kafka are two popular choices. While both offer high performance, they have different design principles and features that make them suitable for different use cases. In this article, we'll compare RabbitMQ and Kafka, exploring their key differences and providing real-life examples to help you make an informed decision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance and Scalability:&lt;/strong&gt;&lt;br&gt;
RabbitMQ and ActiveMQ provide high-performance messaging capabilities, but Kafka shines in scenarios that demand high throughput and horizontal scalability. For example, let's consider a real-life use case of a social media platform processing millions of user interactions per second. Kafka's distributed log-based model and built-in scalability features make it an excellent choice for handling such high data volumes efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Message Prioritization:&lt;/strong&gt;&lt;br&gt;
One important aspect of message brokers is the ability to prioritize messages. RabbitMQ and ActiveMQ support message prioritization, enabling the processing of higher-priority messages before lower-priority ones. However, Kafka does not offer built-in message priority support. If your application relies heavily on message prioritization, RabbitMQ or ActiveMQ might be a better fit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Message Ordering:&lt;/strong&gt;&lt;br&gt;
Ensuring message ordering is crucial in many applications. RabbitMQ and ActiveMQ guarantee message ordering within a single queue or topic, respectively. On the other hand, Kafka ensures ordering within a partition but not across partitions within a topic. This makes Kafka suitable for scenarios where message order within a partition is critical, such as event sourcing or log processing systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Message Model:&lt;/strong&gt;&lt;br&gt;
RabbitMQ follows the Advanced Message Queuing Protocol (AMQP) and utilizes a queue-based message model. Kafka, on the other hand, employs a distributed log-based model, which allows for high-throughput and fault-tolerant data streaming. ActiveMQ is built on the Java Message Service (JMS) standard and also uses a queue-based message model. Depending on your application requirements, you can choose the message model that aligns best with your use case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Durability and Replication:&lt;/strong&gt;&lt;br&gt;
All three message brokers support durable messaging to prevent message loss during failures. RabbitMQ and ActiveMQ offer configurable durability options, allowing you to fine-tune the level of persistence based on your needs. Kafka, on the other hand, provides built-in durability through log replication, ensuring data redundancy and fault tolerance. For example, a financial application handling critical transactions may benefit from Kafka's built-in durability features.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Real-Life Example *&lt;/em&gt;- &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Microservices Communication:&lt;br&gt;
Consider a microservices architecture where different services communicate with each other. RabbitMQ can be an excellent choice here due to its support for AMQP and its flexible messaging patterns. It enables reliable communication between services, ensuring that messages are not lost even when services experience downtime.&lt;/p&gt;

&lt;p&gt;Real-Life Example - Real-Time Data Processing:&lt;br&gt;
Suppose you're building a real-time analytics system that requires processing and analyzing a continuous stream of data. Kafka's distributed and scalable nature makes it a natural fit for such use cases. Its ability to handle high data volumes and provide fault-tolerant data streaming ensures that you can process and analyze the incoming data in real-time with minimal delays.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Choosing the right message broker for your application depends on several factors such as performance requirements, message prioritization, ordering guarantees, and durability needs. RabbitMQ is well-suited for prioritized message handling and guaranteed ordering within a single queue or topic. Kafka shines in scenarios demanding high throughput, horizontal scalability, and fault-tolerant data streaming. Consider your specific use case and requirements to make an informed decision and build a robust messaging system that meets your application's needs.&lt;/p&gt;

</description>
      <category>kafka</category>
      <category>activemq</category>
      <category>rabbitmq</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
