<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Control WebPanel Wiki &#187; Load-Balancers</title>
	<atom:link href="http://wiki.centos-webpanel.com/category/load-balancers/feed" rel="self" type="application/rss+xml" />
	<link>http://wiki.centos-webpanel.com</link>
	<description>CentOS WebPanel Wiki</description>
	<lastBuildDate>Wed, 12 Feb 2025 20:38:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>DNS Load Balancing</title>
		<link>http://wiki.centos-webpanel.com/dns-load-balancing</link>
		<comments>http://wiki.centos-webpanel.com/dns-load-balancing#comments</comments>
		<pubDate>Thu, 02 Jul 2015 21:27:41 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Load-Balancers]]></category>
		<category><![CDATA[DNS Load-Balancing]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=336</guid>
		<description><![CDATA[How to set a simple load balancing with DNS, even Google does it. In this example we will setup load balancing for domain test.com with 3 web servers. Here's all what you will need: - Multiple A records for host name or domain in the DNS service of your choice - 3 VPS or Dedicated [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>How to set a simple load balancing with DNS, even Google does it.</strong><br />
In this example we will setup load balancing for domain test.com with 3 web servers.</p>
<p><strong>Here's all what you will need:</strong><br />
    - Multiple A records for host name or domain in the DNS service of your choice<br />
    - 3 VPS or Dedicated servers (even shared hosting account are fine)</p>
<p>Firstly to have a good load balancing you need to have a good, reliable and stable dns provider with multiple DNS servers.<br />
With your Domain provider for domain in our example test.com we will set A record with the following IP's.<br />
- VPS1 IP: 107.203.104.34 (server location Germany)<br />
- VPS2 IP: 5.42.34.205 (server location US)<br />
- VPS3 IP: 35.42.34.205 (server location Japan)</p>
<p>Now you need to set A record for each of this IP addresses.<br />
After you have done that test your DNS records, you should have them displayed similar to google's.</p>
<p><strong>Test and compare:</strong></p>
<pre>dig a google.com</pre>
<p>Example output of google.com</p>
<pre>;; ANSWER SECTION:
google.com.		268	IN	A	208.117.229.245
google.com.		268	IN	A	208.117.229.250
google.com.		268	IN	A	208.117.229.244
google.com.		268	IN	A	208.117.229.248
google.com.		268	IN	A	208.117.229.249
google.com.		268	IN	A	208.117.229.247
google.com.		268	IN	A	208.117.229.246
google.com.		268	IN	A	208.117.229.251</pre>
<p>Notice also that Google is using a 100-300 second TTL on its “A” records.  This helps (but does not eliminate) client-side DNS caching that can lessen the effectiveness of the round-robin DNS load balancing.</p>
<p>For most purposes you don’t need to have a TTL that low, however.  A TTL of 10 to 30 minutes is fine for most websites.</p>
<p>Each time you execute this command your first A record will be on the other server ip.<br />
The order in which IP addresses are returned varies by the DNS server and provider used but often follows a round-robin or geographically specific algorithm.</p>
<p>The idea here is that different clients will get different ordered lists of IP addresses corresponding to your domain name. This has the effect of distributing requests across the group of IPs in a specific manner. If an IP address does not respond in an appropriate amount of time, the client will time out on that request and move on to the next IP address until the list is exhausted or it finds a connection that's valid.</p>
<p>Now don't forget that you need to have your website uploaded on all 3 servers.</p>
<p><strong>For assistance you can contact our support</strong><br />
<a href="http://centos-webpanel.com/contact" title="Contact CentOS support" target="_blank">http://centos-webpanel.com/contact</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wiki.centos-webpanel.com/dns-load-balancing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote MySQL with SOCAT socket</title>
		<link>http://wiki.centos-webpanel.com/remote-mysql-with-socat-socket</link>
		<comments>http://wiki.centos-webpanel.com/remote-mysql-with-socat-socket#comments</comments>
		<pubDate>Tue, 30 Jun 2015 20:50:20 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Clusters]]></category>
		<category><![CDATA[Load-Balancers]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[remote MySQL]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=320</guid>
		<description><![CDATA[How to make a remote MySQL server with socket by using SOCAT. Remote MySQL advantages - move MySQL CPU usage from local CWP web server - move MySQL disk IO operations from disk - move MySQL disk space usage to other server - improve performances by moving MySQL to SSD multi-core powered server ... on [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>How to make a remote MySQL server with socket by using SOCAT.</strong><br />
Remote MySQL advantages<br />
- move MySQL CPU usage from local CWP web server<br />
- move MySQL disk IO operations from disk<br />
- move MySQL disk space usage to other server<br />
- improve performances by moving MySQL to SSD multi-core powered server<br />
...</p>
<p><strong>on the remote MYSQL server</strong><br />
This needs to be a clean server, best would be a clean CentOS 6 minimal without any control panel.</p>
<p>Install MySQL server and Socat</p>
<pre>yum install mysql-server socat -y</pre>
<p>Run Socat listening for MySQL on the port 3307</p>
<pre>socat TCP-LISTEN:3307,reuseaddr,fork UNIX-CONNECT:/var/lib/mysql/mysql.sock &#038;</pre>
<p><strong>on the CWP Web server</strong><br />
1. Backup all databases<br />
2. Import databases to the remote MySQL server<br />
3. Update MySQL root password from MySQL server and add it in following files:<br />
- /root/.my.cnf<br />
- /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php<br />
Update postfix<br />
- /usr/local/cwpsrv/htdocs/resources/admin/include/postfix.php<br />
** Other option would be that you change MySQL root password on the MySQL server.<br />
4. Stop local MySQL server<br />
5. Add IP from CWP server to MySQL and from MySQL to CWP in firewall allow list.</p>
<p>Please note that also in the bellow listed files you need to replace <b>$db_host</b> and <b>$db_host_postfix</b> from <b>localhost</b> to your remote mysql server ip<br />
/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php<br />
/usr/local/cwpsrv/htdocs/resources/admin/include/postfix.php</p>
<p>Now lets create remote MySQL socket connection with socat (replace SERVER-IP)</p>
<pre>socat UNIX-LISTEN:/var/lib/mysql/mysql.sock,fork,reuseaddr,unlink-early,user=mysql,group=mysql,mode=777 TCP:SERVER-IP:3307 &#038;</pre>
<p>If you have successful login in the cwp and local MySQL server is stopped than this means that you are connected on the remote MySQL server.<br />
Once you have a working remote mysql server then you need to create remote mysql users root/postifx</p>
<pre>
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'postfix'@'%' IDENTIFIED BY 'old-password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'old-password';
MariaDB [(none)]> flush privileges;</pre>
<p>Disable or remove local MySQL server from web hosting server.</p>
<p><strong>For assistance you can contact our support</strong><br />
<a href="http://centos-webpanel.com/contact" title="Contact CentOS support" target="_blank">http://centos-webpanel.com/contact</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wiki.centos-webpanel.com/remote-mysql-with-socat-socket/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
