1

i need to override the Mage_Index module to reindex data in a different database. I can't find where can i override the current connection. I need to execute it via shell through "php shell/indexer -reindexall". Anyone could help me?

EDIT (info from comments):

It is needed to get an import of >900000 Products done, where the reindex kills the Shop.

2

You can create your own local.xml in some folder in app/etc/connections:

<?xml version="1.0"?>
<config>
<global>
    <resources>
        <default_setup>
            <connection>
                <host><![CDATA[localhost]]></host>
                <username><![CDATA[root]]></username>
                <password></password>
                <dbname><![CDATA[db_name]]></dbname>
                <active>1</active>
            </connection>
        </default_setup>
    </resources>
</global>
</config>

In your code you need to run:

$config = new Mage_Core_Model_Config('connections/local.xml');
Mage::getConfig()->extend($config);

Or

Starting magento or running magento scripts you can tell where your local.xml is located.

Mage::app('default', 'store', '/path/to/test/etc');
  • this will not work, if he also wants to use the index tables on the other database. – Flyingmana Jan 28 '14 at 20:36
  • I did not get your point. Could you please explain? – oleksii.svarychevskyi Jan 28 '14 at 21:18
  • Usecase 1: let the index tables create on another database. (solved by your setting) Usecase 2: use this index tables from a different database, when ppl request your side. But still have the normal db as mail, so if someone puts something into cart, its on the main, not the extra database. – Flyingmana Jan 29 '14 at 8:32
  • We don't know what is his goal. If he wants to have several databases for one instance of magento, maybe it would be better to make mysql replication. – oleksii.svarychevskyi Jan 29 '14 at 8:39
  • I need it because i have to import all products and reindex them in another db and than i will do the mysql replication – giovanni Jan 29 '14 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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