简体   繁体   English

我可以将远程数据库用于机架云服务器吗?

[英]Can I use remote database for rackspace cloud server?

We previously had a company setup our website on a web host and they set it up on a rackspace cloud server (unmanaged). 我们以前有一家公司在虚拟主机上设置我们的网站,然后他们在机架式云服务器(非托管)上进行设置。 It is an expression engine website. 这是一个表达引擎网站。

I have now rebuilt the website into Wordpress but cannot figure out how to setup the database on rackspace. 现在,我已将网站重建为Wordpress,但无法弄清楚如何在机架空间上设置数据库。 There isn't a database setup on rackspace now, so I'm not sure how the EE site is setup. 现在在机架空间上没有数据库设置,所以我不确定如何设置EE站点。

I am wondering... Is it possible to just load the wordpress files on the Rackspace server, then connect the Wordpress site to a remote mysql database hosted on Hostgator? 我想知道...是否可以只在Rackspace服务器上加载wordpress文件,然后将Wordpress网站连接到Hostgator上托管的远程mysql数据库?

If so, does someone know aa tutorial to do this? 如果是这样,有人知道要这样做吗?

I'm clueless when it comes to uploading a database on Rackspace via SSH. 对于通过SSH在Rackspace上上传数据库,我一无所知。 I'm familiar with phpmyadmin but not good with unmanaged servers. 我对phpmyadmin很熟悉,但对非托管服务器却不太满意。

Any suggestion what would be the best for my needs? 有什么建议最适合我的需求吗? For now, I need to get the site up and running on Rackspace until I can get a managed dedicated or VPS server setup. 现在,我需要在Rackspace上启动并运行该站点,直到获得托管专用或VPS服务器设置。

* UPDATE * * 更新 *

I have tried to change the DB host in the Wordpress config file to the IP address instead of localhost, but no luck. 我试图将Wordpress配置文件中的数据库主机更改为IP地址而不是localhost,但是没有运气。 Any ideas? 有任何想法吗? This is part of the wp-config.php file in the root directory. 这是根目录中wp-config.php文件的一部分。 I have removed the values. 我已经删除了值。 I've tried the hostname like this also with no luck... XXX.XXX.XX.XXX:3306 我也尝试过这样的主机名,但也没有运气... XXX.XXX.XX.XXX:3306

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'remote_DB_name');


    /** MySQL database username */
    define('DB_USER', 'remote_DB_user');


    /** MySQL database password */
    define('DB_PASSWORD', 'hiddenpassword');


    /** MySQL hostname */
    define('DB_HOST', 'XXX.XXX.XX.XXX');

I'm not an expert with Wordpress but it should be possible to have your wordpress site running on a Rackspace Cloud Server connect to a database that is not on Rackspace. 我不是Wordpress的专家,但是应该可以在Rackspace Cloud Server上运行的wordpress网站连接到不在Rackspace上的数据库。

According to http://codex.wordpress.org/Editing_wp-config.php#Configure_Database_Settings , there should be a file named wp-config.php in the base directory of your Wordpress site. 根据http://codex.wordpress.org/Editing_wp-config.php#Configure_Database_Settings的说明 ,Wordpress网站的基本目录中应该有一个名为wp-config.php的文件。 You should be able to edit the values of the constants starting with DB_ to configure database connection settings. 您应该能够编辑以DB_开头的常量的值,以配置数据库连接设置。 Specifically, you will want to change the value of the DB_HOST constant to be the hostname or IP address of your database server that is not on Rackspace. 具体来说,您将需要将DB_HOST常数的值更改为不在Rackspace上的数据库服务器的主机名或IP地址。

Normally wordpress allows different database server and can connect it with different servers. 通常,wordpress允许使用不同的数据库服务器,并且可以将其连接到不同的服务器。 But here it seems problem is not with connection settings you use. 但是在这里看来问题不在于您使用的连接设置。 You have to give proper permissions for your IP to the database server. 您必须为数据库服务器的IP授予适当的权限。 Please check and add permissions to your IP on database server using your credentials 请使用您的凭据检查并向数据库服务器上的IP添加权限

GRANT ALL PRIVILEGES ON *.* To 'dbusername'@'XXX.XXX.X.XX' IDENTIFIED BY 'dbpassword';

Check these option with your database administrator and try configuration again Reference : 与数据库管理员一起检查这些选项,然后再次尝试配置。参考:

Wordpress database COnfigurations Wordpress数据库配置

While it may or may not be possible to connect to a Hostgator database from a Rackspace server (contact their respective support departments for details), I know one thing for sure: It's a bad idea anyway. 虽然可能或不可能从Rackspace服务器连接到Hostgator数据库(请联系其各自的支持部门以获取详细信息),但我肯定知道一件事:不管怎么说,这是一个坏主意。 Don't do it. 不要这样

When they're being used for web applications, MySQL database connections are highly sensitive to latency. 当将它们用于Web应用程序时,MySQL数据库连接对延迟非常敏感。 Each MySQL query performed by your application will be slowed down by at least the round-trip time — for instance, if there is a 10 ms latency between your web server and database server, and your application performs ten MySQL queries for each page load, your page load will take a minimum of 100 ms (10 ms x 10) more than it would without that latency. 您的应用程序执行的每个MySQL查询都会至少减少往返时间-例如,如果您的Web服务器和数据库服务器之间存在10毫秒的延迟,并且您的应用程序为每个页面加载执行十次MySQL查询,与没有该延迟的情况相比,您的页面加载至少要花费100毫秒(10毫秒x 10)的时间。 Ten queries and 10 ms is a best-case scenario, too; 最好的情况是十个查询和十毫秒。 many web applications will use considerably more queries than that, and two distant servers may have a round-trip time much higher than 10 ms (100 ms wouldn't be unusual for a transcontinental connection). 许多Web应用程序将使用远远多于此的查询,并且两台远程服务器的往返时间可能远高于10毫秒(对于跨大陆连接,100毫秒并不罕见)。

Use a local database. 使用本地数据库。 If you don't know how to get one on Rackspace, ask their support team! 如果您不知道如何在Rackspace上买单,请咨询他们的支持团队!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM