How to Implement Load Balancing In Database Servers?

How to Implement Load Balancing In Database Servers?

Database Load Balancing Servers is a classic method allocate the workload with multiple servers and traffic of incoming network of database server which is running at the backend. The main goal of Database Load Balancing is to offer an endpoint of a single database to increase queries, minimize latency, applications to connect to the database server.

Types of Load Balancing in Database Servers:

There are three methods of Load Balancing to be performed. They are as follow:

Load Balancing with Hardware
– For balancing the traffic, Load Balancing with Hardware is used as a strategy. The Hardware load balancing can be used as committed hardware devices that handle the load balancing and network traffic. Most of the hardware load balancing runs or works under Linux. As a main disadvantage Load Balancing with the Hardware is considered to be high priced.

Load Balancing with Software – As expected Load Balancing with software is a very reliable and effective way of issuing the loads connecting the servers. Using the software objectives balancing the algorithms with the allocation of server in Linux platform.

Load Balancing using DNS– With the help of DNS the load balancing can balance the domain with multiple servers. We do not have any control over the balancing algorithm while using DNS for performing network traffic. Very little DNS cache is considered as a very important feature of using Load Balancing with DNS. DNS provides the client (which sends the request) with the IP address.

HAProxy or MySQL Proxy can be used as one of the methods of load balancing in database servers. And here is the general acceptance of Load Balancing with HAProxy& MySQL Proxy.

HAProxy Load Balancing:
Most of the load balancing algorithms are used under HAProxy and those algorithms were selected based on the demand. Here are some of the common algorithms used in HAProxy.

Round Robin Algorithm: HAProxy works most commonly using Round Robin Algorithm that selects the server from the list and it will send a new request to the server which is at the top of the list once it reaches the end of the server.

Weighted Round Robin: The weight of the server allotted to request forward is used by the Weighted Round Robin.

Dynamic Round Robin Algorithm: Revised weight list of every server to request forward used by Dynamic Round Robin algorithm.

Source Algorithm: Server-based is choose by the source Algorithm on the IP address of the source of hash needs to be connected with the matching server.

High Availability: When there are more requests the load balancing will become slow and due to which the end-user receive response with time delay. On resolving this issue, another Load balancer is used and that is called secondary load balancing. In case the main load balance receives more requests, and second load balancer comes to the rescue. And those load balancers examine each other’s health.

We make use of the main load balancer which is active mode, and the second load balancer is in passive mode. We can also join more load balancers in passive mode. In load balancing, we can use a failover mechanism.

Load Balancing in MySQL Proxy:

MySQL server and the client gets data from MySQL. Whenever it is necessary for both changes and directions, the proxy will review information flow that will be useful for MySQL server protection from queries of malicious or information modification of client without database changes.

In CentOS, the EPEL repository has the bundle and EPEL provides many packages which are not accessible in the main CentOS repository.repository./etc/sysconfig/mysql-proxy is MySQL Proxy’s main location for the configuration file, We shall declare with the help of rpm -qc mysql-proxy command. Here q represents query and c represents configuration files. Below mentioned options can be used with the help of /etc/sysconfig/MySQL-proxy:

ADMIN_USER – For Proxy’s administrator interface acts as a username. The admin user can be left as default.

ADMIN_PASSWORD – It is used as the password for administrator users. And it is used to change the default password for security purposes.

ADMIN_LUA_SCRIPT – In Lua programming language, it acts as administrator script and the admin interface will be worked without this. A default value can be left in the field.

PROXY_USER – It is the user under which the proxy work. By default, it is mysql-proxy, and it’s safe to leave it.

PROXY_OPTIONS – Using PROXY_OPTIONS configuration has been done like Lua scripts, plugins, logging level loaded.

Using “mysql proxy start” MySQL Proxy can be started once the setup is done. When the proxy had action, the observation can be started and checking status. Use the following commands if has an IP address as 192.168.1.11.

Code:
mysql –host=192.168.1.11 –port=4041 -u admin -p<em>secret_pa$s</em>
The admin login is specified in /etc/sysconfig/mysql-proxy.

Though there are some drawbacks in MySQL Proxy like insufficient documentation, it is more effective, simple, easy to access & understand and preventing advancement (can interrupt changes in a fast manner)
Author
kumkumsharma
Views
151
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top