Magento中的独立读写数据库 [英] Separate read and write databases in Magento

查看:75
本文介绍了Magento中的独立读写数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上找不到任何有关如何为Magento配置两个独立数据库的示例-一个用于读取请求,一个用于写入请求.我认为这应该在app/etc/local.xml中发生,但是我不知道语法是什么.是否有人知道语法,或者是否有指向博客文章的链接,或者我搜索没有找到的内容?

I can't find any examples online of how to configure two separate databases for Magento - one for read requests and one for write requests. I assume that this should happen in app/etc/local.xml but I don't know what the syntax is. Does anybody know the syntax or have a link to a blog post or something that my searching didn't turn up?

我正在运行Magento 1.6.1.0

I'm running Magento 1.6.1.0

谢谢

推荐答案

在您的app/etc/local.xml中,以以下方式填写<resources>:

In your app/etc/local.xml fill <resources> in next way:

    <resources>
        <db>
            <table_prefix><![CDATA[]]></table_prefix>
        </db>
        <core_read>
            <connection>
                <use /> 
                <host><![CDATA[localhost]]></host>
                <username><![CDATA[root]]></username>
                <password><![CDATA[]]></password>
                <dbname><![CDATA[db_read_name]]></dbname>
                <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                <model><![CDATA[mysql4]]></model>
                <type><![CDATA[pdo_mysql]]></type>
                <pdoType><![CDATA[]]></pdoType>
                <active>1</active>
            </connection>
        </core_read>
        <core_write>
            <connection>
                <use />
                <host><![CDATA[localhost]]></host>
                <username><![CDATA[root]]></username>
                <password><![CDATA[]]></password>
                <dbname><![CDATA[db_write_name]]></dbname>
                <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                <model><![CDATA[mysql4]]></model>
                <type><![CDATA[pdo_mysql]]></type>
                <pdoType><![CDATA[]]></pdoType>
                <active>1</active>
            </connection>
        </core_write>
    </resources>

这篇关于Magento中的独立读写数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆