Tag: MySQL

Apache Access Logs to MySQL Database

Apache Access Logs

Centralising Apache logs can be useful in many scenarios. Let’s get the basics 1st. So Apache logs can be defined as

In order to effectively manage a web server, it is necessary to get feedback about the activity and performance of the server as well as any problems that may be occuring. The Apache HTTP Server provides very comprehensive and flexible logging capabilities.
Today we’ll setup Apache to log each access request to MySQL database rather than storing it in a flat file. Unlike logging to a flat text file, a SQL-based log exhibits tremendous flexibility and power of data extraction. Let’s dive in.

and Apache access logs can be defined as

The server access log records all requests processed by the server. The location and content of the access log are controlled by the CustomLog directive.

Today let’s see how to setup Apache to use MySQL to store the all the logs. Apache access logs will be sent to MySQL database through the Apache log module.

Apache Access Logs to MySQL

Apache Access Logs to MySQL

– Read More –

monit

What? How? Why? When? Monit

What Monit?

Let me explain about the utility. It has the ability to start a process if it is not running, restart a process if not responding and stop a process if uses high resources. In simple words it’s a helpful program that automatically monitors and manages server programs/resources to ensure that they stay online 24/7 while maintaining the correct file size, checksum and permissions. It’s important system monitoring tool anyone would like to have in their mission critical systems. With the web interface given you could see what’s going on with your system. In this article I’ll be covering end-to-end and providing you value links to be bookmarked in your browser(tongue-out-face).
– Read More –

mysql-load-balancing-haproxy

MySQL Load Balancing With HAProxy

Loading balancing is a hot topic when it comes to high availability(HA). You can distribute the workload among server using a load balancer such as HAProxy. Today we are going to take a look at MySQL loading balancing with HAProxy. To load balance at least you should have 2 nodes of MySQL running. If you haven’t got 2 MySQL nodes running refer the previous post on MySQL Master-Master replication.

What’s HAProxy

HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and
powers quite a number of the world’s most visited ones.

Server Setup

Server 1 – Node 1
Hostname: mysql-1
IP: 192.ABC.X.28

Server 2 – Node 2
Hostname: mysql-2
IP: 192.ABC.Y.29

Server 3 – Load Balancer
Hostname: haproxy
IP: 192.ABC.Z.30

 

haproxy-mysql

Load balancing MySQL with HAProxy

– Read More –

MySQL Master-Master Replication

What’s MySQL Replication

Replication enables data from one MySQL database server (the master) to be replicated to one or more MySQL database servers (the slaves).

So MySQL Master-Master Replication

In other words MySQL replication is the process by which data stored in a database, will be copied to a second server’s database. This is called MySQL master-slave replication. Today I’m going to focus on MySQL master-master replication where it allows data to be copied from either server. In other words perform reads or writes from either server.

 MySQL master-master replication, Image Courtesy : alexfilatov.com

Image Courtesy : alexfilatov.com

– Read More –

#1093 – You can’t specify target table ‘table_name’ for update in FROM clause

Have you ever got this MySQL error? Oh! You are searching for a solution right? You have come to the right place. Let me give you the simplest answer and it works charm.

For the time being assume that this is your query.

What you can do is change the query to something like this below.

Okay let me explain how the magic happens here.

– Read More –

Older Posts