1

I have the following archtecture to a simple load balance magento store that I made with NGINX.

So far I have created a round-robin mechanism with NGINX in mySIte.com that redirects the client (user) to the srvMag-1, srvMag-2, srvMag-n,srvMag-1, srvMag-2, srvMag-n, ..., etc (round-robin).

As I am not specilalist in Magento (I am a begginer), my point now is if it is possible to create a server to deal only with the magento databse? The idea is to set srvMag-1, srvMag-2, srvMag-n point to that server db.

If is that possible how to setup only a databse for magento, without to setup the php files and in the other hand how to setup only the magento php files without the database?

To be clear:

  1. In srvMag-1, srvMag-2, srvMag-n I will only need the complete structure (php files, etc) but I dont want the database.
  2. In srvDB I only need the databse, but not the complete structure (php files, etc).

enter image description here

4
  • You can just put the files on srvMag1 then install it normally and on the database setup step fill in the credentials for your DB machine. Then copy/rsync/whatever the files from srvMag1 to srvMag2 & 3. Some other changes might be needed to make the 3 servers use the same media folder for example.
    – Marius
    Feb 10, 2017 at 15:10
  • hi Marius, I think that is what I would like to avoid. 'make the 3 servers use the same media folder'. My idea was to create each server independent to avoid overload the server. I must syncronize the every media file beetwen the server in the way they could be independent. But as I told, this is only my though as a programmer. I am just a begginer in Magento. Am I wrong? So your proposition is to install the db server as a regular magento instalation and make each other server to point to it. Correct?
    – IgorAlves
    Feb 10, 2017 at 15:35
  • If you don't want to share the images then ignore my previous comment after ' from srvMag1 to srvMag2 & 3'. Not sure about it but it should work like I explained. You can give it a try
    – Marius
    Feb 10, 2017 at 15:36
  • ok I wil try it.
    – IgorAlves
    Feb 10, 2017 at 15:37

1 Answer 1

0

This is very simple

Fresh Install:

Point the same database while setup magento2 [GUI or CLI]

Already Installed:

If you already Installed Just change the configuration file to point same db in both magento instance.

You need to change in <magento-root>/app/etc/env.php

'db' => 
  array (
    'table_prefix' => '',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => 'db-server-host',
        'dbname' => 'db-name',
        'username' => 'username',
        'password' => 'password',
        'model' => 'mysql4',
        'engine' => 'innodb',
        'initStatements' => 'SET NAMES utf8;',
        'active' => '1',
      ),
    ),
),

update

  • There is no condition DB server and magento instance in same machine
  • You can use database server remotely

My Setup

I hope this will point you right direction

I have setup like two magento instance + one database with shared redis session and cache + shared nfs media folder. It works like charm for me.

If you need any clarity, feel free to mention in comment.

3
  • hi Bilal, let me see if I got, so you mean, I must to install magento in my server DB, as a regular instalation, then install magento to each server 1, 2,3,n, and then make each on the previus server to point to the database server. Is it?
    – IgorAlves
    Feb 10, 2017 at 15:06
  • I updated my answer, please review @zwitterion Feb 10, 2017 at 15:16
  • yes it seems to be exactlly what I am doing. nd what I need to do.
    – IgorAlves
    Feb 10, 2017 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.