Recently i have reviewed a simple web application, where problem was with moving “read” count of news from main table to another table in MySQL. The logic is separating counting “read”s for news from base table. The way you can accomplish this task, you can create a new “read” table in MySQL, then add necessary code to news admin panel for inserting id,read,date into this new “read” table, while adding new articles. But for test purposes, i decide to move this functionality to MongoDB. Overall task is -> Same data must be in MySQL, counting logic must be in MongoDB and data must be synced from MongoDB to MySQL. Any programming language will be sufficient but, Python is an easy one to use. You can use Official mysql-connector-python and pymongo. Firstly you must create empty “read” table in MySQL, insert all necessary data from base table to “read” and there should be after insert trigger for …
[Read more]In an earlier post titled Using Perl to send tweets stored in a MySQL database to twitter, I showed you a way to use MySQL to store tweets, and then use Perl to automatically send your tweets to twitter.
In this post, we will look at automatically sending a “thank you” to people who retweet your tweets – and we will be using Perl and MySQL again.
Just like in the first post, you will need to register your application with twitter via apps.twitter.com, and obtain the following:
consumer_key consumer_secret access_token access_token_secret
One caveat: twitter has a rate limit on how often you may connect with your application – depending upon what you are trying to do. See …
[Read more]By Erkan Yanar
In the previous article of this series, we described how to run a multi-node Galera Cluster on a single Docker host.
In this article, we will describe how to deploy Galera Cluster over multiple Docker hosts.
By design, Docker containers are reachable using port-forwarded TCP ports only, even if the containers have IP addresses. So we will set up port forwarding for all TCP ports that are required for Galera to operate.
The following TCP port are used by Galera:
- 3306-MySQL port
- 4567-Galera Cluster
- 4568-IST port
- 4444-SST port
Before we start, we need to stop enforcing AppArmor for Docker:
$ aa-complain /etc/apparmor.d/docker
Building a multi-node cluster using the default ports
Building a multi-node cluster using the default ports is not complicated. Besides mapping the ports 1:1, we also need to set …
[Read more]
This is in continuation to the previous post, if you have not read
that, I would advise you to go through that before continue
reading.
I discussed about three use cases in my last post, here I will
explain them in detail.
- Extracting data from a binary log file:
The binary log file is full of information, but what if you want selected info, for example:- printing the timestamp for every event in the binary log file.
- extracting the event types of all the events occurring in the binary log file.
And any other such data from an event in real time. Below is some sample code which shows how to do that step by step.
- Connect to the available transport
// …
MySQL replication is among the top features of MySQL. In
replication data is replicated from one MySQL Server (also knows
as Master) to another MySQL Server(also known as Slave). MySQL
Binlog Events is a set of libraries which work on top of
replication and open directions for myriad of use cases like
extracting data from binary log files, building application to
support heterogeneous replication, filtering events from binary
log files and much more.
All this in REAL TIME .
INTRODUCTION
I have already defined what MySQL Binlog Events is, to deliver on
any of the above use-cases, you first need to read the event from
the binary log. This can be done using two types of transports:
1) TCP transport: Here your application will connect to an online MySQL Server and receive events as and when they occur.
2) File transport: As the name suggests the application will connect to an …
[Read more]
Gcc 5.0 has added support for FDO which uses perf to
generate profile. There is documentation for this in gcc manual,
to quote:
-fauto-profile=path
Enable sampling-based feedback-directed optimizations, and the
following optimizations which are generally profitable only with
profile feedback available: -fbranch-probabilities, -fvpt,
-funroll-loops, -fpeel-loops, -ftracer, -ftree-vectorize,
-finline-functions, -fipa-cp, -fipa-cp-clone,
-fpredictive-commoning, -funswitch-loops, -fgcse-after-reload,
and -ftree-loop-distribute-patterns.
path is the name of a file containing AutoFDO profile
information. If omitted, it defaults to fbdata.afdo in the
current directory.
Producing an AutoFDO …
Wanted to send a pointer to the slides from my session at #GIDS 2015.
Will followup with an impressions blog soon.
1) To find slow queries
pt-query-digest /var/lib/mysql/cloud-server-01-slow.log > slowqueroutput.log
2) Between a particular time range
pt-query-digest –since ’2015-04-10 00:00:00′ –until ’2015-04-10 23:59:59′ /var/lib/mysql/cloud-server-01-slow.log > slowqueryrange.log
3) For a particular database
pt-query-digest –filter ‘$event->{db} && $event->{db} =~ /employee/’ /var/lib/mysql/cloud-server-01-slow.log > slowqueroutputemp.log
pt-query-digest –filter ‘$event->{db} && $event->{db} =~ /market/’ /var/lib/mysql/cloud-server-01-slow.log > slowqueroutputmkt.log
4) For a particular user
pt-query-digest –filter ‘$event->{user} && $event->{user} =~ /root/’ /var/lib/mysql/cloud-server-01-slow.log > slowqueryoutputuser.log …
[Read more]Hi all, a few months have passed since our first preview release of MySQL Group Replication. Now is the time for the second preview release of MySQL Group Replication, the plugin that brings multi-master update everywhere to MySQL, as described in Hello World post.
Introduced changes User interface changes
After receiving plenty of feedback and continuing to pursue a more integrated look and feel with MySQL, we have given the user interface a facelift. Some of the changes are:
- The plugin has been renamed to group_replication, and as a consequence the plugin’s option names were also renamed to group_replication_*;
- Start/stop command: now the commands are START/STOP GROUP_REPLICATION;
- Performance_schema tables were improved to have better names, fields and relationships. …
Open Query is supporting the mysql-cli Kickstarter project (for MySQL and MariaDB) by Amjith Ramanujam who already successfully completed a similar tool for PostgreSQL.
It is a new MySQL client with Auto-Completion and Syntax Highlighting. From the info provided, it’s Python based, thus portable, and can be installed without root access. Could be a very useful tool. The good old mysql command line client does lack some things, yet a relatively low-level command line client is often useful for remote tasks (as opposed to graphical tools) so we reckon it’s good that this realm gets a bit of attention!