sowell

Member
Jun 26, 2007
5
0
51
Is it possible with cpanel to do mysql clustering where sql will reside on a server outside the webhosting environment??? Would it even make sense to do such a thing?

We are in the midst of trying to configure a scalable, easy to use solution and we are extremely interested in cpanel so i am just curious if this is possible.



</firstpost>
 

hostmedic

Well-Known Member
Apr 30, 2003
544
0
166
Washington Court House, Ohio, United States
cPanel Access Level
DataCenter Provider
Very Easy

In short - this is very simple to do.

What you would do - is add a server into your network with a private IP
add a private IP into your local machine - (suggest a gigabit connection :) but thats just me )

now go into WHM and setup a remote SQL server...


You can change the MySQL server from the local server ("localhost") to point to a remote server. This allows MySQL functions to be performed by another computer.


Steps

1 To access the SQL Services Menu, click on SQL Services, on the main screen of your WebHost Manager interface.

2 Click on Setup Remote MySQL server.

3 Enter the name (or ip) of the remote server in the Remote MySQL Host field and its password in the Remote Mysql Host's Root Password field.

NOTE: Do not enter the root password for the remote MySQL server in the Remote MySQL Host's Root Password field.

4 Click on Setup.
 

sowell

Member
Jun 26, 2007
5
0
51
thanks ALOT for the detailed reply and help. If this is the way things go around here I'm glad to be a part. again homedic thanks for the reply.
 

hostmedic

Well-Known Member
Apr 30, 2003
544
0
166
Washington Court House, Ohio, United States
cPanel Access Level
DataCenter Provider

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator

SoftDux

Well-Known Member
May 27, 2006
1,025
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
In short - this is very simple to do.

What you would do - is add a server into your network with a private IP
add a private IP into your local machine - (suggest a gigabit connection :) but thats just me )

now go into WHM and setup a remote SQL server...


You can change the MySQL server from the local server ("localhost") to point to a remote server. This allows MySQL functions to be performed by another computer.


Steps

1 To access the SQL Services Menu, click on SQL Services, on the main screen of your WebHost Manager interface.

2 Click on Setup Remote MySQL server.

3 Enter the name (or ip) of the remote server in the Remote MySQL Host field and its password in the Remote Mysql Host's Root Password field.

NOTE: Do not enter the root password for the remote MySQL server in the Remote MySQL Host's Root Password field.

4 Click on Setup.
If a new domain is added to the main server, or a new DB is created by a cuser, will it automatically be created / replicated on the other server?
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
If a new domain is added to the main server, or a new DB is created by a cuser, will it automatically be created / replicated on the other server?
Once the Remote DB setup is performed, new databases, database users, etc, will be done on the remote server, not the local one (barring bugs).
 

katmai

Well-Known Member
Mar 13, 2006
564
3
168
Brno, Czech Republic
small question. if the mysql is under heavy usage. how will i make 2 servers clustered to handle the mysql load? i mean .. the same database.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
small question. if the mysql is under heavy usage. how will i make 2 servers clustered to handle the mysql load? i mean .. the same database.
It kind of depends upon the level of complexity you want. Generally speaking it would involve a threee server setup:

Two MySQL servers
One proxy server

Along with customizing the application because such a setup would likely use Replication which mandates that data modification only happen on one server, the Master. Hence the application would need customized to send INSERT, UPDATE and DELETE type statements to the Master, while SELECT type statements would go to the proxy server for load balancing. Hopefully your application does far more SELECTing than UPDATEing.

You might checkout http://forge.mysql.com/wiki/MySQL_Proxy for info about a proxy, or http://haproxy.1wt.eu/ for a more generalized solution. Also, it is possible to do soemthing like combinae the Master MySQL and Proxy onto one server.

It's really difficult to give a pat answer to these types of questions because:

1) There are numerous ways to reach the stated goal

2) The particular requirements should be fully defined - which can be difficult to convey on a Forum


Anyway, if the videos from the Seminar are posted, look for my presentation on MySQL replication and clustering.
 

katmai

Well-Known Member
Mar 13, 2006
564
3
168
Brno, Czech Republic
i was checking it now. thanks for the tips, i will be reading into this and see what i can come up with :)
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
You're welcome. We are always here for Q & A. There might be some weak areas with the presentation, since it was originally to be 30 min, but was redone for a 60 min time slot a couple days before the seminar :D (love scheduling, so much fun ;))

One thing I mentioned in a prior thread is we will be removing the current way of mapping MySQL database names to the cPanel account name. When and how this will happen is unknown, but once it happens it will simplify this entire topic.
 

big

Well-Known Member
Aug 12, 2001
224
0
316
Earth
how can mysql -h localhost work ?

because all users have 'localhost' in their config.php files for their applications and now they are all down

mysql -h 192.168.2.10 is working just fine but not mysql -h localhost or mysql -h 127.0.0.1
 

big

Well-Known Member
Aug 12, 2001
224
0
316
Earth
also all users in the mysql "user" table are granted access with 'localhost' not the other server IP

how to automatically fix it?