brunoroeder / m2-ce-splitdb

Magento 2 split read / write database project.

Home Page:https://magemojo.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MageMojo

SplitDb

Magento 2 module to redirect SELECT queries to another database connection.

Version 1.6.0

Contributing

See CONTRIBUTING.md.

Manual Install

  • Download this ZIP and paste in your root folder.

  • Add a new connection in your file app/etc/env.php called readonly and readonly_setup, like the example env.php file below.

'db' =>
  array (
    'table_prefix' => '',
    'connection' =>
    array (
      'default' =>
      array (
        'host' => 'default_writer',
        'dbname' => 'db_name',
        'username' => 'user_name',
        'password' => 'yourpassword',
        'active' => '1',
      ),

      'readonly' =>
      array (
        'host' => 'reader_host',
        'dbname' => 'db_name',
        'username' => 'user_name',
        'password' => 'yourpassword',
        'active' => '1',
      ),

    ),
  ),
  'resource' =>
  array (
    'default_setup' =>
    array (
      'connection' => 'default',
    ),
    'readonly' =>
    array (
      'connection' => 'readonly',
    ),
  ),

  • Run these commands in your terminal:
bin/magento module:enable MageMojo_SplitDb
bin/magento setup:upgrade

License

License: MIT

About

Magento 2 split read / write database project.

https://magemojo.com

License:MIT License


Languages

Language:PHP 100.0%