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

查看:25
本文介绍了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 中填写 如下:

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天全站免登陆