Last time I wrote about MongoDB for MySQL DBAs I described some of the
basics of MongoDB querying, and this time I'll follow that up
with some more on querying.
As we saw last time, the basic format of a MongoDB query
is:
db.find(<query>,<attributes>)
Note that you do NOT replace db with the name of the database you
want to query here, you just make the database you want to use
the current one and issue the query, such as:
> use test
> db.mycoll.find()
The example above will find all objects in the mycoll collection,
and will include all the object attributes and also the key
(_id), like this:
{ "_id" : ObjectId("4eb0634807b16556bf46b214"), "c1" : 1 }
{ "_id" : ObjectId("4eb0634a07b16556bf46b215"), "c2" : 1 }
{ "_id" : …
Last time I wrote about MongoDB for MySQL DBAs I described some of the
basics of MongoDB querying, and this time I'll follow that up
with some more on querying.
As we saw last time, the basic format of a MongoDB query
is:
db.find(,)
Note that you do NOT replace db with the name of the database you
want to query here, you just make the database you want to use
the current one and issue the query, such as:
> use test
> db.mycoll.find()
The example above will find all objects in the mycoll collection,
and will include all the object attributes and also the key
(_id), like this:
{ "_id" : ObjectId("4eb0634807b16556bf46b214"), "c1" : 1 }
{ "_id" : ObjectId("4eb0634a07b16556bf46b215"), "c2" : 1 }
{ "_id" : ObjectId("4eb0635607b16556bf46b216"), "c1" : 2, "c2" :
2 } …
MySQL 5.6 proposes improved partition maintenance through "partition exchange". Even if not yet available, dbi services performed some tests on the MySQL Community Edition5.6.2 m5 release (still under Development).
The Issue
I haven't blogged in a while an I have a long TODO list of things
to publish: The repository for the SNMP Agent, video and slides
of my OSCON talk and a quick overview of MHA master-master
support. In the meantime, here's a little fact that I didn't know
from MySQL CREATE VIEW documentation:
Although it is possible to create a view with a nonexistent
DEFINER
account, an error occurs when the view is
referenced if the SQL SECURITY
value is
DEFINER
but the definer account does not exist.How
can this be possible?
The ProblemFor a number of reasons we don't have the same user
accounts on the master than we have on the slaves (ie: developers
shouldn't be querying the master). Our configuration files
include the following line:
replicate-ignore-table=mysql.user
So if …
[Read more]
Why This Post
While testing Yoshinori Matsunobo's MHA agent I found that
although the wiki has a very complete documentation, it was
missing a some details. This article intends to close that gap
and bring up some issues to keep in mind when you do your own
installation. At the end of the article I added a
Conclusions section, if you're not interested in the
implementation details, but to read my take on the project, feel
free to jump straight to the end from here.
My Test Case
Most of our production environments can be simplified to match
the MHA's agent most simple use case: 1 master w/ 2 or more
slaves and at least one more slave in an additional tier:
Master A --> …[Read more]
As a MySQL DBA, I guess you use the SHOW GLOBAL STATUS command or
the corresponding INFORMATION_SCHEMA.GLOBAL STATUS table to show
current mySQL status quite often. And many of us use different
tools to collect that data and view it.
But sometimes we use same command from the SQL prompt, because we
have to, because it's the only option or just because that is the
most convenient way. And often you kick of two such command in a
row, a few seconds apart, just to see how things are
moving:
SHOW GLOBAL STATUS LIKE 'innodb%rows%';
... DBA picks his or her nose for a few seconds ...
SHOW GLOBAL STATUS LIKE 'innodb%rows%';
And then you can see how things are advancing. But how much? To
figure of how much, you have to calculate the differnce between
the values returned by those two statements. And then there is
another issue. How much is the difference per second? To know
what the difference is per second, we …
Back in February I wrote an article titled A Small Fix For mysql-agent. Since then we did
a few more fixes to the agent and included a Bytes Behind
Master (or BBM) chart. For those who can't wait to get their
hands on the code, here's the current version: MySQL SNMP agent RPM. For those who'd like to
learn about it's capabilities and issues, keep reading.
What to Expect From this Version
The article I quoted above pretty much describes the main
differences with the original project, but we went further with
the changes while still relying on Masterzen's code for the data
collection piece.
The first big change is that we transformed Masterzen's code into
a Perl module, …
The most basic and most oft-repeated task that a DBA has to accomplish is to look at slow logs and filter out queries that are suboptimal, that consume lots of unnecessary resources and that hence slow down the database server. This post looks at why and how VIEWs can help against such suboptimal operations.
LVM (Logical Volume Management) is a very important tool to have in the toolkit of a MySQL DBA. It allows you to create and extend logical volumes on the fly. This allows me to, say, add another disk and extend a partition effortlessly. The other very important feature is the ability to take snapshots, that you can then use for backups. All in all its a must have tool. Hence, this guide will allow you to understand various terminologies associated with LVM, together with setting up LVM volumes and in a later part will also show you how to extend...
If you ever, and I think many of use DBAs have, been in the
situation where you are stuck with data in the database that
isn't used and isn't accessed, data which may consist of rows
that are no longer used, data rows that aren't references,
because you don't use FOREIGN KEYs or they weren't applicable in
this case. Or data that was once used, but no longer is.
And in many cases, this data is tucked in among your other good
rows of data :-( One way of cleaning up the database in a case
like this is to run standard DELETE statements, but there are a
few issues with this:
- You may be accessing a lot of data, so this may take a while.
- You will be locking large amount of data for this.
- The join statement to get the data that is no longer used and / or no longer referenced is complex.
- There is no really good way to split this DELETE in smaller chunks, except using LIMIT, but if what …