<?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: Muhammad Adib Ahmad Roslan</title>
    <description>The latest articles on DEV Community by Muhammad Adib Ahmad Roslan (@adbrsln).</description>
    <link>https://dev.to/adbrsln</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%2F338204%2F0b168c3c-b715-49e3-9717-c0de7dacf156.jpeg</url>
      <title>DEV Community: Muhammad Adib Ahmad Roslan</title>
      <link>https://dev.to/adbrsln</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adbrsln"/>
    <language>en</language>
    <item>
      <title>Multiple MySQL Router Client in Single Server/Nodes</title>
      <dc:creator>Muhammad Adib Ahmad Roslan</dc:creator>
      <pubDate>Fri, 15 Apr 2022 16:38:22 +0000</pubDate>
      <link>https://dev.to/adbrsln/multiple-mysql-router-client-in-single-servernodes-2j99</link>
      <guid>https://dev.to/adbrsln/multiple-mysql-router-client-in-single-servernodes-2j99</guid>
      <description>&lt;h2&gt;
  
  
  Introductions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fweavk730u5o04rc19teu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fweavk730u5o04rc19teu.png" alt="High-level architecture of your application"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown as example of above architecture diagram, your application servers require to connect to 3 different InnoDB MySQL Cluster. &lt;/p&gt;

&lt;p&gt;Are you Planning to connect to multiple Cluster at once from a single server? heres the plan...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MySQL InnoDB Cluster 1 

&lt;ul&gt;
&lt;li&gt;c1-node-1&lt;/li&gt;
&lt;li&gt;c1-node-2&lt;/li&gt;
&lt;li&gt;c1-node-3&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;MySQL InnoDB Cluster 2

&lt;ul&gt;
&lt;li&gt;c2-node-1&lt;/li&gt;
&lt;li&gt;c2-node-2&lt;/li&gt;
&lt;li&gt;c2-node-3&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;MySQL InnoDB Cluster 3

&lt;ul&gt;
&lt;li&gt;c3-node-1&lt;/li&gt;
&lt;li&gt;c3-node-2&lt;/li&gt;
&lt;li&gt;c3-node-3&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;install the mysqlrouter as usual&lt;/li&gt;
&lt;li&gt;do not bootstrap anything yet&lt;/li&gt;
&lt;li&gt;set your /etc/hosts files containing all the relevant servers&lt;/li&gt;
&lt;li&gt;always set different base port so it doesnt clash to each other&lt;/li&gt;
&lt;li&gt;always set different https port so it doesnt clash to each other&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;run the command for bootstrapping the servers
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ##boostrap the Cluster 1

  $&amp;gt; mysqlrouter --boostrap &amp;lt;boostrap-user&amp;gt;@&amp;lt;c1-node-1&amp;gt; -d &amp;lt;c1-conf-directory&amp;gt; --user=mysqlrouter --conf-base-port=6446 --https-port=18443


  ##boostrap the Cluster 2

  $&amp;gt; mysqlrouter --boostrap &amp;lt;boostrap-user&amp;gt;@&amp;lt;c1-node-2&amp;gt; -d &amp;lt;c2-conf-directory&amp;gt; --user=mysqlrouter --conf-base-port=7446 --https-port=28443


  ##boostrap the Cluster 3

  $&amp;gt; mysqlrouter --boostrap &amp;lt;boostrap-user&amp;gt;@&amp;lt;c1-node-3&amp;gt; -d &amp;lt;c3-conf-directory&amp;gt; --user=mysqlrouter --conf-base-port=8446 --https-port=38443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;once the boostrap is done, you can start using the nohup command to make it run on the background
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $&amp;gt; nohup mysqlrouter -c &amp;lt;c1-config-directory&amp;gt; &amp;amp;
  $&amp;gt; nohup mysqlrouter -c &amp;lt;c2-config-directory&amp;gt; &amp;amp;
  $&amp;gt; nohup mysqlrouter -c &amp;lt;c3-config-directory&amp;gt; &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;to check your setup is working just check the &lt;code&gt;ps&lt;/code&gt; command
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ps -ef | grep mysqlrouter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;the command above should show 3 of the instances of mysqlrouter processes has been successfully started.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thats All, Thanks for reading!&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>innodb</category>
      <category>router</category>
      <category>client</category>
    </item>
    <item>
      <title>Laravel Dusk with Github Actions </title>
      <dc:creator>Muhammad Adib Ahmad Roslan</dc:creator>
      <pubDate>Sat, 28 Nov 2020 03:37:01 +0000</pubDate>
      <link>https://dev.to/adbrsln/laravel-dusk-with-github-actions-3ipk</link>
      <guid>https://dev.to/adbrsln/laravel-dusk-with-github-actions-3ipk</guid>
      <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;i was tasked to do Unit Testing for one of my projects, the test case that i was tasked with is :-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User can login and see Dashboard&lt;/li&gt;
&lt;li&gt;User can login and see Developer Portal&lt;/li&gt;
&lt;li&gt;User can login and see Administration Panel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;basically the test is quite easy and straight-forward right?&lt;/p&gt;

&lt;p&gt;so im off with installing &lt;code&gt;Laravel Dusk&lt;/code&gt; since this kind of test involves with the actions of seeing the UI itself.&lt;/p&gt;

&lt;p&gt;if you're not familiar with Laravel Dusk, Laravel Dusk is a official library that are supported by the Laravel itself. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a standalone ChromeDriver installation. However, you are free to utilize any other Selenium compatible driver you wish. - &lt;a href="https://laravel.com/docs/8.x/dusk#introduction"&gt;Laravel Dusk&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So Without further ado, &lt;/p&gt;

&lt;h2&gt;
  
  
  The Preparation
&lt;/h2&gt;

&lt;p&gt;Make sure that you have created the user factory, user seeder as well as enable user factory inside &lt;code&gt;DatabaseSeeder.php&lt;/code&gt; file before starting this unit test. since its requires dummy user to test the test case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Laravel Dusk Installation
&lt;/h2&gt;

&lt;p&gt;installing Laravel Dusk is quite the breeze, just run this into the CLI of your project &lt;code&gt;composer require --dev laravel/dusk&lt;/code&gt; after installing the packages you can then run &lt;code&gt;php artisan dusk:install&lt;/code&gt; to install your laravel dusk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Laravel Dusk Environment Configuration
&lt;/h2&gt;

&lt;p&gt;By Default, when the laravel dusk environment configurations file &lt;code&gt;.env.dusk&lt;/code&gt; is not exist, it will automatically use the .env as the environment configuration temporarily. in our case, we need to use a separate database which is called &lt;code&gt;dusktest&lt;/code&gt; database and create the &lt;code&gt;.env.dusk&lt;/code&gt; file onto your root project folder. Here's the sample of my &lt;code&gt;.env.dusk&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt; Make sure to generate the APP_KEY as well. run &lt;code&gt;php artisan key:generate&lt;/code&gt; then copy the key from &lt;code&gt;.env&lt;/code&gt; to &lt;code&gt;.env.dusk&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;APP_NAME=dusk
APP_ENV=local
APP_KEY={your-key-here}
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000

LOG_CHANNEL=stack
FLARE_KEY=

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dusktest
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=array
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=array
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_NAME="${APP_NAME}"
MAIL_FROM_ADDRESS="no-reply@ksud.com"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Test Scripts
&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;php artisan dusk:make CommonTest&lt;/code&gt; onto your CLI , it will created the Test File inside &lt;code&gt;my-project/tests/Browser/CommonTest.php&lt;/code&gt; . After that we need to create the test case inside the test scripts . Here's the test scripts that i've created .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace Tests\Browser;

use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Artisan;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class CommonTest extends DuskTestCase
{
    use DatabaseMigrations;

    /**
     * Can Login and see Dashboard
     *
     * @return void
     */
    public function testCanLoginAndSeeDashboard()
    {
        //Seed dummy user data
        Artisan::call('db:seed');
        $user = User::first();
        $this-&amp;gt;browse(function ($first) use ($user){
            $first-&amp;gt;loginAs($user)
                  -&amp;gt;visit('/dashboard')
                  -&amp;gt;assertSee('Dashboard');
        });
    }

    /**
     * Can Login and see Developer Portal
     *
     * @return void
     */
    public function testCanLoginAndSeeDeveloperPortal()
    {
        //Seed dummy user data
        Artisan::call('db:seed');
        $user = User::first();
        $this-&amp;gt;browse(function ($first) use ($user){
            $first-&amp;gt;loginAs($user)
                  -&amp;gt;visit('/developer')
                  -&amp;gt;assertSee('Connective Exchange');
        });
    }

    /**
     * Can Login and see Administration Panel
     *
     * @return void
     */
    public function testCanLoginAndSeeAdministrationPanel()
    {
        //Seed dummy user data
        Artisan::call('db:seed');
        $user = User::first();
        $this-&amp;gt;browse(function ($first) use ($user){
            $first-&amp;gt;loginAs($user)
                  -&amp;gt;visit('/admin')
                  -&amp;gt;assertSee('Resources');
        });
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Github Action Workflow
&lt;/h2&gt;

&lt;p&gt;So basically if you're familiar with github actions , the github action workflow scripts should be inside &lt;code&gt;my-project/.github/workflows/actions.yml&lt;/code&gt; you can rename the file as you desired.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# my-project/.github/workflows/actions.yml
name: Unit Test

on:
  push:
    branches: [develop]
  pull_request:
    branches: [master, develop]

jobs:
  PHPUnit:
    runs-on: ubuntu-latest
    services:
      mysql:
        image: mysql:8.0.21
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_DATABASE: dusktest
        ports:
          - 3306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - uses: actions/checkout@v2
      - name: Configure Application
        run: bin/ci
      - name: Configure Laravel Dusk
        run: bin/ci-dusk
      - name: Execute Dusk tests via PHPUnit
        run: php artisan dusk

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you have to create some of this bash files to ensure the scripts working.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# my-project/bin/ci

#!/usr/bin/env bash

cp .env.example .env
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
chmod -R 777 storage bootstrap/cache
php artisan key:generate
php artisan config:clear

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# my-project/bin/ci-dusk

#!/usr/bin/env bash

php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
chmod -R 0755 vendor/laravel/dusk/bin/
php artisan serve  &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;
curl localhost:8000 &amp;amp;
./vendor/laravel/dusk/bin/chromedriver-linux &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simpy push your codes to github, and it should be good to go! Thank you for reading.&lt;/p&gt;

&lt;p&gt;Honorable Mentions &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nasrul Hazim (Helping out with the workflow configurations)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>laravel</category>
      <category>dusk</category>
      <category>github</category>
      <category>ci</category>
    </item>
    <item>
      <title>Working the project with 'Team'</title>
      <dc:creator>Muhammad Adib Ahmad Roslan</dc:creator>
      <pubDate>Wed, 26 Feb 2020 02:37:45 +0000</pubDate>
      <link>https://dev.to/adbrsln/working-with-team-25hk</link>
      <guid>https://dev.to/adbrsln/working-with-team-25hk</guid>
      <description>&lt;h2&gt;
  
  
  introductions
&lt;/h2&gt;

&lt;p&gt;This is maybe not gonna work for some of you . but so far it has been helping me throughout my software development career path. &lt;/p&gt;

&lt;h2&gt;
  
  
  Tips &amp;amp; Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Naming Conventions
&lt;/h3&gt;

&lt;p&gt;it would be nice if the variable naming conventions follows &lt;a href="http://www.laravelbestpractices.com/"&gt;Laravel Best Practice&lt;/a&gt; it would be like 20 minutes reading.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pushing and Pulling Codes from Repositories
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;refer this docs &lt;a href="https://www.atlassian.com/git/tutorials/git-forks-and-upstreams"&gt;git forks and upstreams&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;always pull from

&lt;code&gt;Master (upstream/master)&lt;/code&gt;

upstream branch every single time u want to commit or start coding or before pushing codes. &lt;/li&gt;
&lt;li&gt;always check for conflict issue and fix it before pushing .&lt;/li&gt;
&lt;li&gt;always follow commit message formats &lt;a href="https://dev.to/puritanic/how-are-you-writing-a-commit-message-1ih7"&gt;Commit Message Standards &lt;/a&gt;. most of the time i'll be using feat and fix. below are the sample of my commit message

&lt;ul&gt;
&lt;li&gt;fixes - &lt;code&gt;fix : update logic codes of this feature&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;feature - &lt;code&gt;feat : create new endpoints for feature&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt; if youre fixing bug or adding feature or enhancement, put the github issue number as follows &lt;code&gt;fix : issue #385&lt;/code&gt; or &lt;code&gt;feat : issue #385&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;always run &lt;code&gt;bin/csfix.sh&lt;/code&gt; before pushing. this is to ensures that code style across application would be the same and formatted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Code Branching
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;always practice creating a new branch for new features or fix. &lt;/li&gt;
&lt;li&gt;everytime you want to do sprint endpoints always create new branch for your sprint eg: &lt;code&gt;sprint-12&lt;/code&gt; do not use the &lt;code&gt;Master&lt;/code&gt; branch for every commit you want to make. &lt;/li&gt;
&lt;li&gt;once the commit and push the codes into the branch , make a pull request to &lt;strong&gt;upstream&lt;/strong&gt; &lt;code&gt;Master (upstream/master)&lt;/code&gt; branch .&lt;/li&gt;
&lt;li&gt;it'll be easier if u create new branch from &lt;strong&gt;upstream&lt;/strong&gt; &lt;code&gt;Master (upstream/master)&lt;/code&gt; and code whatever u need  inside that separate branch. &lt;/li&gt;
&lt;li&gt;after pull request has been merge, please delete the branch. and start over again if you want to run a new sprint.&lt;/li&gt;
&lt;li&gt;always pull codes from &lt;strong&gt;upstream&lt;/strong&gt;  &lt;code&gt;Master (upstream/master)&lt;/code&gt; by running &lt;code&gt;git pull upstream master&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;i would be grateful if you can add more.&lt;/p&gt;

</description>
      <category>git</category>
      <category>laravel</category>
      <category>php</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Setting up MySQL InnoDB cluster on Private Network</title>
      <dc:creator>Muhammad Adib Ahmad Roslan</dc:creator>
      <pubDate>Wed, 26 Feb 2020 02:27:22 +0000</pubDate>
      <link>https://dev.to/adbrsln/setting-up-mysql-innodb-cluster-on-private-network-5boh</link>
      <guid>https://dev.to/adbrsln/setting-up-mysql-innodb-cluster-on-private-network-5boh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Out off all the tutorial out there, all the cluster setup are shown for non private networks. since the setup is for private network, u need to skip certain stuff or might as well add few stuffs. &lt;/p&gt;

&lt;h2&gt;
  
  
  First thing first, the checklist:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;All the server nodes in the same  &lt;strong&gt;Private Network&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Minimum of 3 Servers nodes.&lt;/li&gt;
&lt;li&gt;MySQL 8.0 community version installed on all those servers over here &lt;a href="https://dev.mysql.com/doc/refman/8.0/en/linux-installation.html"&gt;MySQL Installation&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;MySQL Shell installed on one those servers &lt;a href="https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-install.html"&gt;MySQL Shell Installation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Server Setup Details
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;App Server : apt 127.0.0.4&lt;/li&gt;
&lt;li&gt;DB Server node 1 : dbt1 127.0.0.1&lt;/li&gt;
&lt;li&gt;DB Server node 2 : dbt2 127.0.0.2&lt;/li&gt;
&lt;li&gt;DB Server node 3 : dbt3 127.0.0.3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After checked all the checklist, start off with the hosts config inoder to allow the private network can talk to each other.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run &lt;code&gt;sudo nano /etc/hosts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;set the nodes internal ip into the host .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  127.0.0.1 db1
  127.0.0.2 db2
  127.0.0.3 db3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;remove all iptables config by running &lt;code&gt;sudo iptables -F&lt;/code&gt; or set the iptables properly&lt;/li&gt;
&lt;li&gt;set the &lt;strong&gt;firewalld&lt;/strong&gt; permanent to allow &lt;code&gt;3306&lt;/code&gt; &lt;code&gt;33060&lt;/code&gt; &lt;code&gt;33061&lt;/code&gt; &lt;code&gt;33062&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;configure the &lt;strong&gt;my.cnf&lt;/strong&gt; settings on &lt;code&gt;/etc/my.cnf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;backup the mysql database (incase of emergency)&lt;/li&gt;
&lt;li&gt;create a user specifically for clusteradmin access to all the server nodes&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setting up MySQL Innodb Cluster
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;start setting up the cluster by running the &lt;code&gt;$ mysqlshell&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;run this on the cli &lt;code&gt;$ mysqlshell&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;run this on the mysqlshell &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;dba.configureInstance('clusteradmin@127.0.0.1')&lt;/code&gt; to configure dbt1 for mysql clustering
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dba.configureInstance('clusteradmin@127.0.0.2')&lt;/code&gt; to configure dbt2 for mysql clustering&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dba.configureInstance('clusteradmin@127.0.0.3')&lt;/code&gt; to configure dbt3 for mysql clustering.&lt;/li&gt;
&lt;li&gt;on the same mysqlshell run this command &lt;code&gt;\c clusteradmin@127.0.0.1&lt;/code&gt; . to connect to the first master nodes which is the dbt1.&lt;/li&gt;
&lt;li&gt;run and type this in the mysqlshell &lt;code&gt;cluster=dba.createCluster('clusterName')&lt;/code&gt; to instantiate and create the cluster group.&lt;/li&gt;
&lt;li&gt;after that we need to add the instance to the group by running this commands&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cluster.addInstance('clusteradmin@127.0.0.2')&lt;/code&gt; this commands is for adding the second db nodes to the cluster group of &lt;code&gt;clusterName&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;just key in the password of clusteradmin user and choose &lt;code&gt;clone&lt;/code&gt; to clone from the master nodes.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cluster.addInstance('&lt;a href="mailto:clusteradmin@127.0.0.3"&gt;clusteradmin@127.0.0.3&lt;/a&gt;')&lt;/code&gt; this commands is for adding the third db nodes to the cluster group of &lt;code&gt;clusterName&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;just key in the password of clusteradmin user and choose &lt;code&gt;Incremental Recovery&lt;/code&gt; to get the metadata from the master nodes.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;after all the instance successfully added, you can run &lt;code&gt;cluster.status()&lt;/code&gt; in the connected mysqlshell to check if the clustering working. if the output as shown 3 nodes are available, then the clustering is working .&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setting up the MySQL Router
&lt;/h3&gt;

&lt;p&gt;Always make sure that you have installed the mysql-router into your application server. following this tutorial &lt;a href="https://dev.mysql.com/doc/mysql-router/8.0/en/mysql-router-installation-linux.html"&gt;MySQL Router Installation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Steps to Configure: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if you have mysqld installed and running make sure that mysqld on your app server is not running by run the command  &lt;code&gt;$ sudo systemctl stop mysqld&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;just run this command to bootsrapping the router to the cluster server &lt;code&gt;$ mysqlrouter --bootstrap mysqlrouter@127.0.0.1:3306 --conf-use-sockets --directory=/tmp/mysqlrouter&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;change directory to &lt;code&gt;/tmp/mysqlrouter&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;bash start.sh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;Enter&lt;/code&gt; on your keyboard&lt;/li&gt;
&lt;li&gt;it will create the router sockets automatically for you.&lt;/li&gt;
&lt;li&gt;configure your MySQL client at &lt;code&gt;/etc/my.cnf&lt;/code&gt; with :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   [client]
   socket=/tmp/mysqlrouter/mysql.sock
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verifiying the MySQL Router Works
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;configure your application by using the new port given .&lt;/li&gt;
&lt;li&gt;try to logged into the cluster through router config by running &lt;code&gt;mysql -uroot -p -P 6446&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;see if the database shown on the output is has the same amount of tables in the cluster &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://lefred.be/content/mysql-innodb-cluster-with-2-data-centers-for-disaster-recovery-howto/"&gt;MySQL innodb cluster setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.mysql.com/doc/mysql-port-reference/en/mysql-ports-reference-tables.html"&gt;Port for MySQL innodb cluster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://lefred.be/content/mysql-innodb-cluster-automatic-provisioning-firewall-and-selinux/"&gt;Firewall Provisions &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.mysql.com/doc/refman/8.0/en/linux-installation.html"&gt;MySQL Installation &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techopedia.com/definition/25142/hosts-file"&gt;what is host file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.mysql.com/doc/mysql-router/8.0/en/mysql-router-installation-linux.html"&gt;MySQL Router Installation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-install.html"&gt;MySQL Shell Installation&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>mysql</category>
      <category>cluster</category>
      <category>database</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
